flight
This commit is contained in:
@@ -4,12 +4,14 @@ echo "command: mount_volume <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 !!! "
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$#" -ne 3 ]; then
|
||||
echo "Usage: $0 <localfile> <remotefile> <host_vars_dir>"
|
||||
echo "Usage: $0 <localfile> <remotefile>"
|
||||
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"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
template templates/hosthostname /etc/hostname
|
||||
|
||||
# ass swap file ????
|
||||
# ------ create user 4server
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,2 @@
|
||||
#!/bin/ass
|
||||
|
||||
doas apk update
|
||||
doas apk upgrade
|
||||
#!/bin/bash
|
||||
rex doas restart
|
||||
|
||||
10
app/sbin/api
10
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__":
|
||||
|
||||
2
app/templates/hosts
Normal file
2
app/templates/hosts
Normal file
@@ -0,0 +1,2 @@
|
||||
127.0.0.1 {{hostname}} localhost
|
||||
10.5.0.200 beedb
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user