flight
This commit is contained in:
@@ -4,12 +4,14 @@ echo "command: mount_volume <volume>"
|
|||||||
echo "alias: set_prod"
|
echo "alias: set_prod"
|
||||||
|
|
||||||
export hosts_file="/app/hosts.dev"
|
export hosts_file="/app/hosts.dev"
|
||||||
|
export host_vars_dir="/app/host_vars/"
|
||||||
|
|
||||||
export PS1="\[\e[32m\]\h:\w\$\[\e[0m\] "
|
export PS1="\[\e[32m\]\h:\w\$\[\e[0m\] "
|
||||||
df -h .
|
df -h .
|
||||||
|
|
||||||
set_prod() {
|
set_prod() {
|
||||||
export HOSTS_FILE="/app/hosts.all"
|
export hosts_file="/app/hosts.all"
|
||||||
echo "HOSTS_FILE set to: $HOSTS_FILE"
|
export host_vars_dir="/app/host_vars/vault/"
|
||||||
|
echo "LIVE MODE ENABLED !!! "
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
127.0.0.1 dev
|
127.0.0.1 dev
|
||||||
::1 dev
|
::1 dev
|
||||||
|
|
||||||
192.168.111.209 dev
|
192.168.111.209 dev n8n
|
||||||
|
|
||||||
192.168.9.11 saopaulo
|
192.168.9.11 saopaulo
|
||||||
192.168.9.17 mumbai
|
192.168.9.17 mumbai
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if [ "$#" -ne 3 ]; then
|
if [ "$#" -ne 3 ]; then
|
||||||
echo "Usage: $0 <localfile> <remotefile> <host_vars_dir>"
|
echo "Usage: $0 <localfile> <remotefile>"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
localfile="$1"
|
localfile="$1"
|
||||||
remotefile="$2"
|
remotefile="$2"
|
||||||
host_vars_dir="$3"
|
remotetmp="/var/tmp/4server"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while read -r host; do
|
while read -r host; do
|
||||||
echo "Processing host: $host"
|
echo "Processing host: $host"
|
||||||
@@ -32,7 +34,8 @@ while read -r host; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
echo "Copying to $host:$remotefile"
|
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"
|
done < "$hosts_file"
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
template templates/hosthostname /etc/hostname
|
template templates/hosthostname /etc/hostname
|
||||||
|
# ass swap file ????
|
||||||
# ------ create user 4server
|
# ------ create user 4server
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,2 @@
|
|||||||
#!/bin/ass
|
#!/bin/bash
|
||||||
|
rex doas restart
|
||||||
doas apk update
|
|
||||||
doas apk upgrade
|
|
||||||
|
|||||||
10
app/sbin/api
10
app/sbin/api
@@ -49,7 +49,8 @@ def init_db():
|
|||||||
comment text,
|
comment text,
|
||||||
domains text,
|
domains text,
|
||||||
status char (20).
|
status char (20).
|
||||||
created DATE
|
created DATE,
|
||||||
|
bump DATE
|
||||||
)
|
)
|
||||||
''')
|
''')
|
||||||
conn.commit()
|
conn.commit()
|
||||||
@@ -104,7 +105,7 @@ the shell script BIN_PATH/nukeContainer is called withtge containerid as paramet
|
|||||||
def info_container(request: InfoContainerRequest):
|
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
|
--> 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
|
--> 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='{"error": "Script failed"}', media_type="application/json", status_code=500)
|
||||||
return Response(content=result.stdout, media_type="application/json")
|
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)])
|
@app.get("/system/info", dependencies=[Depends(verify_api_key)])
|
||||||
def get_system_info():
|
def get_system_info():
|
||||||
return all INFOas JSON
|
return all INFOas JSON
|
||||||
in this function add last_update and return the content of /4server/data/update
|
in this function add last_update and return the content of /4server/data/update
|
||||||
if this file does not exist return NONE
|
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.
|
return the VERSION as well.
|
||||||
try:
|
try:
|
||||||
with open("/etc/alpine-release") as f:
|
with open("/etc/alpine-release") as f:
|
||||||
@@ -151,7 +153,7 @@ def get_resources():
|
|||||||
"cpu_count": psutil.cpu_count(logical=True),
|
"cpu_count": psutil.cpu_count(logical=True),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
--> create an endpoint that docker pulls all containers /system/pull
|
||||||
|
|
||||||
# ---------------------- Entry Point ----------------------
|
# ---------------------- Entry Point ----------------------
|
||||||
if __name__ == "__main__":
|
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 mkdir -p /4server
|
||||||
rex doas chmod 777 /4server
|
rex doas chmod 777 /4server
|
||||||
rex mkdir -p /4server/data
|
rex mkdir -p /4server/data
|
||||||
|
template templates/hosts /etc/hosts
|
||||||
|
|
||||||
|
|
||||||
### PACKAGES
|
### PACKAGES
|
||||||
template templates/repositories /etc/apk/repositories
|
template templates/repositories /etc/apk/repositories
|
||||||
rex doas apk update && upgrade
|
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
|
### own bins
|
||||||
prsync -h "$hosts_file" -avz ./sbin/ /4server/sbin/
|
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
|
template templates/4server /etc/4server
|
||||||
|
|
||||||
#INSTALL API SERVICE
|
#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 chmod 0755 /etc/init.d/4server-api
|
||||||
rex doas chown root:root /etc/init.d/4server-api
|
rex doas chown root:root /etc/init.d/4server-api
|
||||||
rex doas rc-update add 4server-api default
|
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-service docker start
|
||||||
rex doas rc-update add docker boot
|
rex doas rc-update add docker boot
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
rex mkdir -p /4server/data/treafik/config/
|
rex mkdir -p /4server/data/treafik/config/
|
||||||
template templates/traefik.yaml /4server/data/traefik/config/traefik.yaml
|
template templates/traefik.yaml /4server/data/traefik/config/traefik.yaml
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user