Skip to content

Commit

Permalink
change w9services
Browse files Browse the repository at this point in the history
  • Loading branch information
qiaofeng1227 committed Jun 3, 2023
1 parent 12e2e4c commit 5da0741
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion appmanage/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ COPY static ./static
COPY requirements.txt main.py ./
RUN apt update

# Install supervisord
# Install supervisords
RUN apt install -y supervisor
COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY config/cmd.sh /cmd.sh
Expand Down
10 changes: 5 additions & 5 deletions appmanage/api/service/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ def get_apps_from_compose():
myLogger.info_logger(len(output_list))
ip = "localhost"
try:
ip_result = shell_execute.execute_command_output_all("cat /data/apps/stackhub/docker/w9appmanage/public_ip")
ip_result = shell_execute.execute_command_output_all("cat /data/apps/w9services/w9appmanage/public_ip")
ip = ip_result["result"].rstrip('\n')
except Exception:
ip = "127.0.0.1"
Expand Down Expand Up @@ -369,7 +369,7 @@ def get_apps_from_compose():
default_domain = ""
admin_path = ""
admin_domain_url = ""
if customer_name in ['w9appmanage', 'w9nginxproxymanager','w9redis','w9kopia','w9portainer'] or app_path == '/data/apps/stackhub/docker/' + customer_name:
if customer_name in ['w9appmanage', 'w9nginxproxymanager','w9redis','w9kopia','w9portainer'] or app_path == '/data/apps/w9services/' + customer_name:
continue

status_show = app_info["Status"]
Expand Down Expand Up @@ -960,7 +960,7 @@ def check_real_domain(domain):
cmd = "ping -c 1 " + domain + " | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | uniq"
domain_ip = shell_execute.execute_command_output_all(cmd)["result"].rstrip('\n')

ip_result = shell_execute.execute_command_output_all("cat /data/apps/stackhub/docker/w9appmanage/public_ip")
ip_result = shell_execute.execute_command_output_all("cat /data/apps/w9services/w9appmanage/public_ip")
ip_save = ip_result["result"].rstrip('\n')

if domain_ip == ip_save:
Expand Down Expand Up @@ -1080,7 +1080,7 @@ def set_domain(domain, app_id):
if "APP_URL" in app_url:
myLogger.info_logger("APP_URL is exist")
if domain == "":
ip_result = shell_execute.execute_command_output_all("cat /data/apps/stackhub/docker/w9appmanage/public_ip")
ip_result = shell_execute.execute_command_output_all("cat /data/apps/w9services/w9appmanage/public_ip")
domain = ip_result["result"].rstrip('\n')
cmd = "sed -i 's/APP_URL=.*/APP_URL=" + domain + "/g' /data/apps/" + customer_name +"/.env"
shell_execute.execute_command_output_all(cmd)
Expand All @@ -1096,7 +1096,7 @@ def set_domain(domain, app_id):
else:
myLogger.info_logger("APP_URL is not exist")
if domain == "":
ip_result = shell_execute.execute_command_output_all("cat /data/apps/stackhub/docker/w9appmanage/public_ip")
ip_result = shell_execute.execute_command_output_all("cat /data/apps/w9services/w9appmanage/public_ip")
domain = ip_result["result"].rstrip('\n')

cmd = "sed -i '/APP_NETWORK/a APP_URL=" + domain + "' /data/apps/" + customer_name +"/.env"
Expand Down
2 changes: 2 additions & 0 deletions docker/w9kopia/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ services:
container_name: $APP_NAME
restart: unless-stopped
# Setup the server that provides the web gui
ports:
- $APP_HTTP_PORT:51515
command:
- server
- start
Expand Down
17 changes: 9 additions & 8 deletions install/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -362,23 +362,24 @@ echo "fast url is: "$fasturl
mkdir -p /data/apps
clone_repo $fasturl/Websoft9/docker-library /data/library
clone_repo $fasturl/Websoft9/StackHub /data/apps/stackhub
cp -r /data/apps/stackhub/docker /data/apps/w9services
}

StartAppMng(){

echo "Start appmanage API ..."
cd /data/apps/stackhub/docker/w9redis && sudo docker compose up -d
cd /data/apps/stackhub/docker/w9appmanage && sudo docker compose up -d
cd /data/apps/w9services/w9redis && sudo docker compose up -d
cd /data/apps/w9services/w9appmanage && sudo docker compose up -d

public_ip=`bash /data/apps/stackhub/scripts/get_ip.sh`
echo $public_ip > /data/apps/stackhub/docker/w9appmanage/public_ip
echo $public_ip > /data/apps/w9services/w9appmanage/public_ip

}

StartPortainer(){

echo "Start Portainer ..."
cd /data/apps/stackhub/docker/w9portainer && sudo docker compose up -d
cd /data/apps/w9services/w9portainer && sudo docker compose up -d
docker pull backplane/pwgen
new_password=$(docker run --name pwgen backplane/pwgen 15)!
docker rm -f pwgen
Expand All @@ -393,8 +394,8 @@ echo "Start Kopia ..."
docker pull backplane/pwgen
new_password=$(docker run --name pwgen backplane/pwgen 15)!
docker rm -f pwgen
sudo sed -i "s/POWER_PASSWORD=.*/POWER_PASSWORD=$new_password/g" /data/apps/stackhub/docker/w9kopia/.env
cd /data/apps/stackhub/docker/w9kopia && sudo docker compose up -d
sudo sed -i "s/POWER_PASSWORD=.*/POWER_PASSWORD=$new_password/g" /data/apps/w9services/w9kopia/.env
cd /data/apps/w9services/w9kopia && sudo docker compose up -d

sudo sed -i 's/"KOPIA_USERNAME": ".*"/"KOPIA_USERNAME": "admin"/g' /usr/share/cockpit/myapps/config.json
sudo sed -i 's/"KOPIA_PASSWORD": ".*"/"KOPIA_PASSWORD": "'$new_password'"/g' /usr/share/cockpit/myapps/config.json
Expand All @@ -403,7 +404,7 @@ sudo sed -i 's/"KOPIA_PASSWORD": ".*"/"KOPIA_PASSWORD": "'$new_password'"/g' /us
InstallNginx(){

echo "Install nginxproxymanager ..."
cd /data/apps/stackhub/docker/w9nginxproxymanager && sudo docker compose up -d
cd /data/apps/w9services/w9nginxproxymanager && sudo docker compose up -d
sleep 25
echo "edit nginxproxymanager password..."
login_data=$(curl -X POST -H "Content-Type: application/json" -d '{"identity":"[email protected]","scope":"user", "secret":"changeme"}' http://127.0.0.1:9092/api/tokens)
Expand All @@ -421,7 +422,7 @@ echo "edit password success ..."
while [ ! -d "/var/lib/docker/volumes/w9nginxproxymanager_nginx_data/_data/nginx/proxy_host" ]; do
sleep 1
done
cp /data/apps/stackhub/docker/w9nginxproxymanager/initproxy.conf /var/lib/docker/volumes/w9nginxproxymanager_nginx_data/_data/nginx/proxy_host
cp /data/apps/w9services/w9nginxproxymanager/initproxy.conf /var/lib/docker/volumes/w9nginxproxymanager_nginx_data/_data/nginx/proxy_host
public_ip=`bash /data/apps/stackhub/scripts/get_ip.sh`
sudo sed -i "s/domain.com/$public_ip/g" /var/lib/docker/volumes/w9nginxproxymanager_nginx_data/_data/nginx/proxy_host/initproxy.conf

Expand Down

0 comments on commit 5da0741

Please sign in to comment.