diff --git a/alpine/.bashrc b/alpine/.bashrc index 65156ee..d226a8b 100644 --- a/alpine/.bashrc +++ b/alpine/.bashrc @@ -4,12 +4,14 @@ echo "command: mount_volume " echo "alias: set_prod" export hosts_file="/app/hosts.dev" +export host_vars_dir="/app/host_vars/" export PS1="\[\e[32m\]\h:\w\$\[\e[0m\] " df -h . set_prod() { - export HOSTS_FILE="/app/hosts.all" - echo "HOSTS_FILE set to: $HOSTS_FILE" + export hosts_file="/app/hosts.all" + export host_vars_dir="/app/host_vars/vault/" + echo "LIVE MODE ENABLED !!! " } diff --git a/alpine/hosts b/alpine/hosts index 1e5b66a..24b66d5 100644 --- a/alpine/hosts +++ b/alpine/hosts @@ -1,7 +1,7 @@ 127.0.0.1 dev ::1 dev -192.168.111.209 dev +192.168.111.209 dev n8n 192.168.9.11 saopaulo 192.168.9.17 mumbai diff --git a/alpine/template b/alpine/template index 98615b2..390a71b 100755 --- a/alpine/template +++ b/alpine/template @@ -1,13 +1,15 @@ #!/bin/bash if [ "$#" -ne 3 ]; then - echo "Usage: $0 " + echo "Usage: $0 " exit 1 fi localfile="$1" remotefile="$2" -host_vars_dir="$3" +remotetmp="/var/tmp/4server" + + while read -r host; do echo "Processing host: $host" @@ -32,7 +34,8 @@ while read -r host; do done echo "Copying to $host:$remotefile" - echo "$content" | ssh "$host" "cat > $remotefile" + echo "$content" | ssh "$host" "cat > $remotetmp" + rex doas mv $remotetmp $remotefile done < "$hosts_file" diff --git a/app/onboarding b/app/onboarding index f2b07db..b8de7c0 100755 --- a/app/onboarding +++ b/app/onboarding @@ -1,6 +1,6 @@ #!/bin/bash template templates/hosthostname /etc/hostname - +# ass swap file ???? # ------ create user 4server diff --git a/app/restart b/app/restart index 888a967..3e1d84d 100755 --- a/app/restart +++ b/app/restart @@ -1,4 +1,2 @@ -#!/bin/ass - -doas apk update -doas apk upgrade +#!/bin/bash +rex doas restart diff --git a/app/sbin/api b/app/sbin/api index 1c90ebd..23208d8 100755 --- a/app/sbin/api +++ b/app/sbin/api @@ -49,7 +49,8 @@ def init_db(): comment text, domains text, status char (20). - created DATE + created DATE, + bump DATE ) ''') conn.commit() @@ -104,7 +105,7 @@ the shell script BIN_PATH/nukeContainer is called withtge containerid as paramet def info_container(request: InfoContainerRequest): --> refactor: When no container id is given, query all containers from the database. when a containeris is given, just select that one. Return the result - +--> create an endpoint that changes the container image to the latest version of that image /container/bump besides updating the container image, also update the SQL for this container and put the current date into "bump" --> add /container/quota return the disk and ram usage of this container. I think you can obtain this from docker @@ -120,13 +121,14 @@ def get_containers(): return Response(content='{"error": "Script failed"}', media_type="application/json", status_code=500) return Response(content=result.stdout, media_type="application/json") +--> create an endpoint that lkists all docker images available on the system /system/images @app.get("/system/info", dependencies=[Depends(verify_api_key)]) def get_system_info(): return all INFOas JSON in this function add last_update and return the content of /4server/data/update if this file does not exist return NONE - +also add the latest bump date of all images in the database return the VERSION as well. try: with open("/etc/alpine-release") as f: @@ -151,7 +153,7 @@ def get_resources(): "cpu_count": psutil.cpu_count(logical=True), } - +--> create an endpoint that docker pulls all containers /system/pull # ---------------------- Entry Point ---------------------- if __name__ == "__main__": diff --git a/app/templates/hosts b/app/templates/hosts new file mode 100644 index 0000000..d4e1d7a --- /dev/null +++ b/app/templates/hosts @@ -0,0 +1,2 @@ +127.0.0.1 {{hostname}} localhost +10.5.0.200 beedb diff --git a/app/update b/app/update index a154f40..4d45159 100755 --- a/app/update +++ b/app/update @@ -4,11 +4,13 @@ rex doas mkdir -p /4server rex doas chmod 777 /4server rex mkdir -p /4server/data +template templates/hosts /etc/hosts + ### PACKAGES template templates/repositories /etc/apk/repositories rex doas apk update && upgrade -rex doas apk add jq rsync mc vim docker docker-compose htop linux-lts sqlite bash +rex doas apk add jq rsync mc vim docker docker-compose htop linux-lts sqlite bash postgresql-16-client ### own bins prsync -h "$hosts_file" -avz ./sbin/ /4server/sbin/ @@ -19,7 +21,7 @@ prsync -h "$hosts_file" -avz ./sbin/ /4server/sbin/ template templates/4server /etc/4server #INSTALL API SERVICE -template templates/init.d/4server-api /etc/init.d/4server-api +template templates/init.d/4server-api /etc/init.d/4server-api: rex doas chmod 0755 /etc/init.d/4server-api rex doas chown root:root /etc/init.d/4server-api rex doas rc-update add 4server-api default @@ -31,6 +33,8 @@ rex doas rc-service 4server-api restart rex doas rc-service docker start rex doas rc-update add docker boot + + rex mkdir -p /4server/data/treafik/config/ template templates/traefik.yaml /4server/data/traefik/config/traefik.yaml diff --git a/od8n b/od8n deleted file mode 100644 index c11d89c..0000000 Binary files a/od8n and /dev/null differ