Compare commits

...

51 commits
2.1.17 ... main

Author SHA1 Message Date
qiaofeng1227
3e70be3394 Merge branch 'dev' into main
Some checks failed
Build image to DockerHub / setup (push) Has been cancelled
Release to Github and Artifact / upload_artifact (push) Has been cancelled
Release to Github and Artifact / Build Github Pages (push) Has been cancelled
Build image to DockerHub / build (push) Has been cancelled
2025-01-02 14:47:55 +08:00
qiaofeng1227
37e5caf1fe 2.1.10
Some checks failed
Build image to DockerHub / setup (push) Has been cancelled
Release to Github and Artifact / upload_artifact (push) Has been cancelled
Release to Github and Artifact / Build Github Pages (push) Has been cancelled
Build image to DockerHub / build (push) Has been cancelled
2025-01-02 14:46:27 +08:00
qiaofeng1227
0ea418212e Merge branch 'dev' into main 2025-01-02 11:28:54 +08:00
qiaofeng1227
370cbc6393 dev 2025-01-02 11:28:07 +08:00
qiaofeng1227
7bc27c191e Merge branch 'main' of https://github.com/Websoft9/websoft9 into main 2025-01-02 11:26:36 +08:00
qiaofeng1227
381c3f8999 Merge branch 'dev' into main 2025-01-02 11:25:26 +08:00
qiaofeng1227
625edd42b5 apphub 2025-01-02 11:25:09 +08:00
qiaofeng1227
600600f3e2 delete W9_URL_WITH_PORT logic 2025-01-02 08:20:57 +08:00
qiaofeng1227
f2a700a07c
Merge pull request #579 from Websoft9/dev
Some checks failed
Build image to DockerHub / setup (push) Has been cancelled
Release to Github and Artifact / upload_artifact (push) Has been cancelled
Release to Github and Artifact / Build Github Pages (push) Has been cancelled
Build image to DockerHub / build (push) Has been cancelled
Dev
2025-01-01 10:24:36 +08:00
qiaofeng1227
75e3687a56
Update version.json
Some checks failed
Build image to DockerHub / setup (push) Has been cancelled
Release to Github and Artifact / upload_artifact (push) Has been cancelled
Release to Github and Artifact / Build Github Pages (push) Has been cancelled
Build image to DockerHub / build (push) Has been cancelled
2025-01-01 10:23:10 +08:00
qiaofeng1227
ac24903f76
Update .env 2025-01-01 10:22:22 +08:00
qiaofeng1227
eb29dad1aa
Update Dockerfile 2025-01-01 10:21:33 +08:00
qiaofeng1227
e4eda2a164 Merge branch 'dev' into main
Some checks are pending
Build image to DockerHub / build (push) Blocked by required conditions
Build image to DockerHub / setup (push) Waiting to run
2024-12-31 10:20:26 +08:00
qiaofeng1227
e6787fcb0b action edit 2024-12-31 10:18:46 +08:00
qiaofeng1227
35a8cb008d apphub-dev
Some checks failed
Build image to DockerHub / setup (push) Has been cancelled
Build image to DockerHub / build (push) Has been cancelled
2024-12-30 15:18:51 +08:00
qiaofeng1227
196aa685a9 test dev library and media 2024-12-30 14:52:53 +08:00
qiaofeng1227
3cc0b8d933 Merge branch 'dev' into main
Some checks are pending
Build image to DockerHub / setup (push) Waiting to run
Build image to DockerHub / build (push) Blocked by required conditions
2024-12-30 14:28:00 +08:00
qiaofeng1227
978c34242a dev call library to pass parameter 2024-12-30 14:27:42 +08:00
qiaofeng1227
0e2831b878 dev 2024-12-30 13:03:13 +08:00
qiaofeng1227
a461d448f3 test dev apphub 2024-12-30 12:04:51 +08:00
qiaofeng1227
5908ac8d4b Merge branch 'dev' of https://github.com/Websoft9/websoft9 into dev 2024-12-30 12:03:04 +08:00
qiaofeng1227
542be67a7d
Update Dockerfile
Some checks failed
Build image to DockerHub / setup (push) Has been cancelled
Release to Github and Artifact / upload_artifact (push) Has been cancelled
Release to Github and Artifact / Build Github Pages (push) Has been cancelled
Build image to DockerHub / build (push) Has been cancelled
2024-12-29 12:04:25 +08:00
qiaofeng1227
91689ef278
Merge pull request #577 from Websoft9/dev
Some checks failed
Release to Github and Artifact / Build Github Pages (push) Has been cancelled
Release to Github and Artifact / upload_artifact (push) Has been cancelled
action
2024-12-29 12:03:32 +08:00
qiaofeng1227
4ac3f9606a
Update docker.yml 2024-12-29 11:28:29 +08:00
qiaofeng1227
e8191b0550
Update version.json 2024-12-29 09:06:11 +08:00
qiaofeng1227
e5f13eb27c
Merge pull request #576 from Websoft9/dev
Update release.yml
2024-12-29 08:58:48 +08:00
qiaofeng1227
63c8d71f91
Update release.yml 2024-12-29 08:55:34 +08:00
qiaofeng1227
98eae4bb57 install 2024-12-27 10:28:30 +08:00
qiaofeng1227
9124abee7f Merge branch 'dev' of https://github.com/Websoft9/websoft9 into dev 2024-12-25 16:50:45 +08:00
qiaofeng1227
70575b5cb0 2.1.19
Some checks failed
Release to Github and Artifact / Build Github Pages (push) Has been cancelled
Release to Github and Artifact / upload_artifact (push) Has been cancelled
2024-12-25 16:50:17 +08:00
Darren
95c6b9af0b
Update README.md 2024-12-25 16:22:57 +08:00
qiaofeng1227
f4af397b02 2.1.19rc
Some checks failed
Release to Github and Artifact / upload_artifact (push) Waiting to run
Release to Github and Artifact / Build Github Pages (push) Waiting to run
Build image to DockerHub / setup (push) Has been cancelled
Build image to DockerHub / build (push) Has been cancelled
2024-12-25 10:57:29 +08:00
赵璟
630d607fbd
Update proxy_manager.py 2024-12-25 08:34:04 +08:00
赵璟
28987a5371
Update app_manager.py
To update the proxy port when redeploy the app
2024-12-25 08:32:46 +08:00
qiaofeng1227
30c8f86aa9 apphub 2024-12-24 17:41:54 +08:00
qiaofeng1227
22668468e8 improve docker 2024-12-24 15:24:15 +08:00
qiaofeng1227
61c80261de apphub 0.1.8
Some checks failed
Build image to DockerHub / setup (push) Has been cancelled
Build image to DockerHub / build (push) Has been cancelled
2024-12-23 15:05:39 +08:00
qiaofeng1227
9590abd6ec release 2.1.18
Some checks failed
Build image to DockerHub / setup (push) Has been cancelled
Release to Github and Artifact / upload_artifact (push) Has been cancelled
Release to Github and Artifact / Build Github Pages (push) Has been cancelled
Build image to DockerHub / build (push) Has been cancelled
2024-12-21 17:56:32 +08:00
qiaofeng1227
13b331815b websoft9
Some checks are pending
Build image to DockerHub / setup (push) Waiting to run
Build image to DockerHub / build (push) Blocked by required conditions
Release to Github and Artifact / Build Github Pages (push) Waiting to run
Release to Github and Artifact / upload_artifact (push) Waiting to run
2024-12-21 12:12:50 +08:00
Darren
1416a1297c
modify landing path 2024-12-21 12:08:11 +08:00
qiaofeng1227
967d81ffdf rc5
Some checks failed
Build image to DockerHub / setup (push) Has been cancelled
Release to Github and Artifact / upload_artifact (push) Has been cancelled
Release to Github and Artifact / Build Github Pages (push) Has been cancelled
Build image to DockerHub / build (push) Has been cancelled
2024-12-19 12:11:24 +08:00
qiaofeng1227
5ed7455276 rc 2024-12-19 11:56:08 +08:00
qiaofeng1227
a98411e5dd crontab 2024-12-19 11:55:18 +08:00
Darren
607a06a6a9
fix 2024-12-19 11:51:36 +08:00
qiaofeng1227
7fdf7ba3f1 rc4 2024-12-18 17:02:39 +08:00
qiaofeng1227
d279af60c4 rc3 2024-12-18 16:13:23 +08:00
qiaofeng1227
88a4d59efe rc 2024-12-17 15:19:36 +08:00
qiaofeng1227
c9ef887b4d release rc2.1.18 2024-12-17 14:21:43 +08:00
赵璟
e6bdb09f8f
Update config.ini 2024-12-17 14:08:10 +08:00
赵璟
e33c4e01e0
Update initproxy.conf 2024-12-17 14:07:15 +08:00
qiaofeng1227
4d3dd86ed1 update library 2024-12-16 08:19:03 +08:00
19 changed files with 240 additions and 78 deletions

View file

@ -11,7 +11,7 @@ name: Build image to DockerHub
on:
push:
branches: [main]
branches: [main, dev] # Include dev branch
paths:
- "docker/*/Dockerfile"
@ -38,8 +38,7 @@ jobs:
needs: setup
runs-on: ubuntu-latest
env:
# You can set it to choice where download from
MEDIA_FROM: "source"
MEDIA_FROM: "source" # You can set it to choice where download from
strategy:
matrix: ${{fromJson(needs.setup.outputs.matrix)}}
steps:
@ -53,23 +52,31 @@ jobs:
APP=${{ matrix.app }}
TAG=$(grep 'LABEL version' "docker/$APP/Dockerfile" | cut -d'"' -f2 | xargs)
echo $APP version is $TAG
if [[ "$TAG" == *"-"* ]]; then
TAGS="$TAG"
# Determine the channel based on the branch and TAG
if [[ $GITHUB_REF == *"refs/heads/dev"* ]]; then
echo "CHANNEL=dev" >> $GITHUB_ENV
TAGS="$TAG" # Use the TAG directly for dev
else
echo "CHANNEL=release" >> $GITHUB_ENV
IFS='.' read -ra PARTS <<< "$TAG"
TAGS="latest"
TAG_PART=""
for i in "${!PARTS[@]}"; do
if [ "$i" -eq 0 ]; then
TAG_PART="${PARTS[$i]}"
else
TAG_PART="${TAG_PART}.${PARTS[$i]}"
fi
TAGS="${TAGS},${TAG_PART}"
done
if [[ "$TAG" == *"-"* ]]; then
echo "CHANNEL=rc" >> $GITHUB_ENV
TAGS="$TAG"
else
echo "CHANNEL=release" >> $GITHUB_ENV
IFS='.' read -ra PARTS <<< "$TAG"
TAGS="latest"
TAG_PART=""
for i in "${!PARTS[@]}"; do
if [ "$i" -eq 0 ]; then
TAG_PART="${PARTS[$i]}"
else
TAG_PART="${TAG_PART}.${PARTS[$i]}"
fi
TAGS="${TAGS},${TAG_PART}"
done
fi
fi
echo "Building and pushing Docker image for $APP with tags: $TAGS"
echo "TAGS=$TAGS" >> $GITHUB_ENV
echo "APP=$APP" >> $GITHUB_ENV
@ -159,4 +166,4 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }}
repository: websoft9dev/${{env.APP}}
readme-filepath: ${{env.README}}
if: needs.setup.outputs.matrix != ''
if: needs.setup.outputs.matrix != ''

View file

@ -5,6 +5,7 @@ on:
push:
branches:
- main
- dev
paths:
- "version.json"
@ -24,9 +25,13 @@ jobs:
version_core=${version%%-*}
echo "VERSION=$version" >> $GITHUB_OUTPUT
echo "VERSION_CORE=$version_core" >> $GITHUB_OUTPUT
if [[ $version == *-* ]]; then
echo "rc release version"
if [[ $GITHUB_REF == *"refs/heads/dev"* ]]; then
echo "dev branch detected"
echo "CHANNEL=dev" >> $GITHUB_OUTPUT
elif [[ $version == *-* ]]; then
echo "rc release version"
echo "CHANNEL=rc" >> $GITHUB_OUTPUT
else
echo "release version"
echo "CHANNEL=release" >> $GITHUB_OUTPUT
@ -71,6 +76,7 @@ jobs:
destination-dir: ./${{ steps.convert_version.outputs.CHANNEL }}/websoft9
- name: Create Github Release
if: github.ref == 'refs/heads/main' # 仅在 main 分支上触发
uses: softprops/action-gh-release@v1
with:
files: |
@ -84,6 +90,7 @@ jobs:
pages:
name: Build Github Pages
if: github.ref == 'refs/heads/main' # 仅在 main 分支上触发
permissions:
contents: read
pages: write

View file

@ -62,7 +62,6 @@ Need root privileges user to install Websoft9, if you use no-root user you can `
# Install by default
wget -O install.sh https://websoft9.github.io/websoft9/install/install.sh && bash install.sh
# Install Websoft9 with parameters
wget -O install.sh https://websoft9.github.io/websoft9/install/install.sh && bash install.sh --port 9000 --channel release --path "/data/websoft9/source" --version "latest"
```

View file

@ -1,26 +1,26 @@
[nginx_proxy_manager]
base_url = http://websoft9-proxy:81/api
user_name = admin@mydomain.com
user_pwd = 9KCRwcL10saLCGaZ
user_pwd = LMFuCnajkQhK3zeb
nike_name = admin
listen_port = 80
listen_port = 443
[gitea]
base_url = http://websoft9-git:3000/api/v1
user_name = websoft9
user_email = admin@mydomain.com
user_pwd = kk95qed0Fxt8
user_pwd = 93HDu6tUWeGx
[portainer]
base_url = http://websoft9-deployment:9000/api
user_name = admin
user_pwd = FptfbwA1TpUr
user_pwd = 93sX)LLHKJY$
[api_key]
key = cc9223b3055471a6f4f9654e08371816a9637ba1c57383617b0684b92ac7b2f4
[domain]
wildcard_domain =
wildcard_domain =
[cockpit]
port = 9000

View file

@ -429,15 +429,17 @@ class AppManger:
# Verify the app is web app
is_web_app = envHelper.get_value("W9_URL")
url_with_port = envHelper.get_value("W9_URL_WITH_PORT")
# url_with_port = envHelper.get_value("W9_URL_WITH_PORT")
w9_url_with_replace = envHelper.get_value("W9_URL_REPLACE")
if is_web_app is not None:
if url_with_port is None:
if w9_url_with_replace is None:
envHelper.set_value("W9_URL", domain_names[0])
else:
try:
ipaddress.ip_address(domain_names[0])
envHelper.set_value("W9_URL", domain_names[0] + ":" + envHelper.get_value("W9_HTTP_PORT_SET"))
#envHelper.set_value("W9_URL", domain_names[0] + ":" + envHelper.get_value("W9_HTTP_PORT_SET"))
envHelper.set_value("W9_URL", domain_names[0] + ":" + (envHelper.get_value("W9_HTTP_PORT_SET") or envHelper.get_value("W9_HTTPS_PORT_SET")))
except ValueError:
envHelper.set_value("W9_URL", domain_names[0])
@ -599,6 +601,24 @@ class AppManger:
portainerManager.redeploy_stack(stack_id,endpointId,pull_image,user_name,user_pwd)
logger.access(f"Redeployed app: [{app_id}]")
app_info = self.get_app_by_id(app_id,endpointId)
forward_ports = [domain.get("forward_port") for domain in app_info.domain_names]
proxy_ids = [domain.get("id") for domain in app_info.domain_names]
if forward_ports:
http_port = app_info.env.get("W9_HTTP_PORT")
https_port = app_info.env.get("W9_HTTPS_PORT")
forward_port = http_port if http_port else https_port
forward_ports_str = [str(port) for port in forward_ports]
if not all(port == forward_port for port in forward_ports_str):
for proxy_id in proxy_ids:
ProxyManager().update_proxy_port_by_app(proxy_id, forward_port)
logger.access(f"Updated proxy port: {forward_port} for app: {app_id}")
def uninstall_app(self,app_id:str,purge_data:bool,endpointId:int = None):
"""
Uninstall app
@ -1082,7 +1102,7 @@ class AppManger:
# Get the w9_url and w9_url_replace
w9_url_replace = next((element.get("w9_url_replace") for element in app_info.domain_names if element.get("id") == proxy_id), None)
w9_url = next((element.get("w9_url") for element in app_info.domain_names if element.get("id") == proxy_id), None)
# validate w9_url_replace is true
if w9_url_replace:
domain_names = host.get("domain_names",None)
@ -1093,7 +1113,8 @@ class AppManger:
if w9_url in domain_names:
new_w9_url = None
if len(app_proxys) == 1 and app_proxys[0].get("id") == proxy_id:
new_w9_url = client_host
# 如果w9_url_with_port存在并且值为: true
new_w9_url = client_host+":"+ (app_info.env.get("W9_HTTP_PORT_SET") or app_info.env.get("W9_HTTPS_PORT_SET"))
elif len(app_proxys) > 1:
# Get the first proxy_host
proxy_host = next((proxy for proxy in app_proxys if proxy.get("id") != proxy_id), None)
@ -1228,4 +1249,4 @@ class AppManger:
raise e
except Exception as e:
logger.error(f"Update the git repo env file error:{e}")
raise CustomException()
raise CustomException()

View file

@ -205,6 +205,44 @@ class ProxyManager:
logger.error(f"Update proxy host:{proxy_id} error:{e}")
raise CustomException()
def update_proxy_port_by_app(self, proxy_id: int, forward_port: int):
"""
Update a proxy host's forward port
Args:
proxy_id (int): Proxy id
forward_port (int): Forward port
Returns:
dict: Proxy host
"""
# Get proxy host by id
req_json = self.get_proxy_host_by_id(proxy_id)
try:
if req_json is None:
raise CustomException(
status_code=400,
message=f"Invalid Request",
details=f"Proxy host:{proxy_id} not found"
)
# update forward_port
req_json["forward_port"] = forward_port
# delete useless keys from req_json(because the req_json is from get_proxy_host_by_id and update_proxy_host need less keys)
keys_to_delete = ["id", "created_on", "modified_on", "owner_user_id", "enabled", "certificate", "owner", "access_list", "use_default_location", "ipv6"]
for key in keys_to_delete:
req_json.pop(key, None)
response = self.nginx.update_proxy_host(proxy_id=proxy_id, json=req_json)
if response.status_code == 200:
return response.json()
else:
self._handler_nginx_error(response)
except CustomException as e:
raise e
except Exception as e:
logger.error(f"Update proxy host:{proxy_id} error:{e}")
raise CustomException()
def get_proxy_host_by_app(self,app_id:str):
"""
Get proxy host by app
@ -295,4 +333,4 @@ class ProxyManager:
except Exception as e:
logger.error(f"Get proxy host by id:{proxy_id} error:{e}")
raise CustomException()

View file

@ -1,4 +1,5 @@
### enhancement:
- Upgrade access to the Websoft9 platform from HTTP to HTTPS #566
- cockpit upgradeport change to 9090 when linux upgrage #556
- upgrade error at CentOS Stream #554
- Optimize install_docker.sh #547

View file

@ -1,5 +1,5 @@
# docs: https://cockpit-project.org/guide/latest/cockpit.conf.5.html
[WebService]
AllowUnencrypted = true
#AllowUnencrypted = true
LoginTitle= Websoft9 - Linux AppStore

View file

@ -1,4 +1,4 @@
APPHUB_VERSION=0.1.6
APPHUB_VERSION=0.1.9
DEPLOYMENT_VERSION=2.20.3
GIT_VERSION=1.21.9
PROXY_VERSION=2.11.3
PROXY_VERSION=2.11.3

View file

@ -1,11 +1,11 @@
# This file can running at actions
# MEDIA_VERSION and LIBRARY_VERSION will trigger its release
# modify time: 202412131246, you can modify here to trigger Docker Build action
# modify time: 202501021450, you can modify here to trigger Docker Build action
FROM python:3.10-slim-bullseye
LABEL maintainer="Websoft9<help@websoft9.com>"
LABEL version="0.1.6"
LABEL version="0.1.9"
WORKDIR /websoft9
@ -39,6 +39,7 @@ RUN apt update && apt install -y --no-install-recommends curl git jq cron iprout
cp -r ./w9source/apphub/src/config ./config && \
cp -r ./w9source/docker/apphub/script ./script && \
curl -o ./script/update_zip.sh $SOURCE_GITHUB_PAGES/scripts/update_zip.sh && \
curl -o /websoft9/version.json $SOURCE_GITHUB_PAGES/version.json && \
pip install --no-cache-dir --upgrade -r apphub/requirements.txt && \
pip install -e ./apphub && \
# Clean cache and install files
@ -46,6 +47,9 @@ RUN apt update && apt install -y --no-install-recommends curl git jq cron iprout
apt clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/man /usr/share/doc /usr/share/doc-base
# Create a file named migration_flag
RUN touch /websoft9/migration_flag
# supervisor
COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY config/logging_config.yaml /etc/supervisor/conf.d/logging_config.yaml

View file

@ -6,7 +6,11 @@ export PATH
set -e
bash /websoft9/script/migration.sh
# execute migration script when container create
if [ -f /websoft9/migration_flag ]; then
bash /websoft9/script/migration.sh
rm -f /websoft9/migration_flag
fi
try_times=5
supervisord

View file

@ -3,10 +3,9 @@
echo "$(date '+%Y-%m-%d %H:%M:%S') - INFO - start to migrate config.ini"
migrate_ini() {
# Define file paths, use template ini and syn exsit items from target ini
# Combine source_ini to target ini
export target_ini="$1"
export template_ini="$2"
export source_ini="$2"
python3 - <<EOF
import configparser
@ -14,36 +13,44 @@ import os
import sys
target_ini = os.environ['target_ini']
template_ini = os.environ['template_ini']
source_ini = os.environ['source_ini']
# Create two config parsers
target_parser = configparser.ConfigParser()
template_parser = configparser.ConfigParser()
source_parser = configparser.ConfigParser()
try:
target_parser.read(target_ini)
template_parser.read(template_ini)
source_parser.read(source_ini)
except configparser.MissingSectionHeaderError:
print("Error: The provided files are not valid INI files.")
sys.exit(1)
# use target_parser to override template_parser
# use target_parser to override source_parser
for section in target_parser.sections():
if template_parser.has_section(section):
if source_parser.has_section(section):
for key, value in target_parser.items(section):
if template_parser.has_option(section, key):
template_parser.set(section, key, value)
if source_parser.has_option(section, key):
source_parser.set(section, key, value)
with open(target_ini, 'w') as f:
template_parser.write(f)
source_parser.write(f)
EOF
}
# Special migration
post_migration(){
echo "$(date '+%Y-%m-%d %H:%M:%S') - INFO - Set listen_port to nginx_proxy_manager"
config_file="/websoft9/config/config.ini"
listen_port=$(grep -Po '^\s*listen_port\s*=\s*\K[0-9]+' "$config_file")
apphub setconfig --section nginx_proxy_manager --key listen_port --value "$listen_port"
}
migrate_ini "/websoft9/apphub/src/config/config.ini" "/websoft9/config/config.ini"
migrate_ini "/websoft9/apphub/src/config/system.ini" "/websoft9/config/system.ini"
post_migration
if [ $? -eq 0 ]; then
echo "$(date '+%Y-%m-%d %H:%M:%S') - INFO - Success to update config.ini"

View file

@ -1,9 +1,20 @@
#!/bin/bash
echo "$(date '+%Y-%m-%d %H:%M:%S') - INFO - Compare remote version and local version." | tee -a /var/log/supervisord.log
channel=release
if [ -f /websoft9/version.json ]; then
version=$(cat /websoft9/version.json | jq -r .version)
if [[ $version == *rc* ]]; then
channel=dev
fi
fi
echo "channel is $channel"
echo "$(date '+%Y-%m-%d %H:%M:%S') - INFO - Compare remote version and local version." | tee -a /var/log/supervisord.log
echo "$(date '+%Y-%m-%d %H:%M:%S') - INFO - Download remote packages and replace local data." | tee -a /var/log/supervisord.log
bash /websoft9/script/update_zip.sh --package_name "media-latest.zip" --sync_to "/websoft9/media"
bash /websoft9/script/update_zip.sh --package_name "library-latest.zip" --sync_to "/websoft9/library"
bash /websoft9/script/update_zip.sh --channel $channel --package_name "media-latest.zip" --sync_to "/websoft9/media"
bash /websoft9/script/update_zip.sh --channel $channel --package_name "library-latest.zip" --sync_to "/websoft9/library"
echo "$(date '+%Y-%m-%d %H:%M:%S') - INFO - Success to update library and media."

View file

@ -1,4 +1,4 @@
# modify time: 202412131435, you can modify here to trigger Docker Build action
# modify time: 202412211783, you can modify here to trigger Docker Build action
# from Dockerfile: https://github.com/NginxProxyManager/nginx-proxy-manager/blob/develop/docker/Dockerfile
# from image: https://hub.docker.com/r/jc21/nginx-proxy-manager

View file

@ -1,14 +1,20 @@
# ------------------------------------------------------------
# domain.com
# ------------------------------------------------------------
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name ~\.?[0-9a-zA-Z]$;
return 301 https://$host$request_uri;
}
server {
listen 80;
listen [::]:80;
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
server_name ~\.?[0-9a-zA-Z]$;
ssl_certificate /data/custom_ssl/0-self-signed.cert;
ssl_certificate_key /data/custom_ssl/0-self-signed.key;
access_log /data/logs/proxy-host-1_access.log proxy;
error_log /data/logs/proxy-host-1_error.log warn;
@ -17,7 +23,7 @@ server {
}
location / {
root /etc/websoft9/landing;
root /data/nginx/default_www/landing;
index index.html
# Proxy!
include conf.d/include/proxy.conf;

View file

@ -8,6 +8,13 @@ if [ ! -d /data/nginx/default_host ]; then mkdir -p /data/nginx/default_host; fi
cp -f /etc/websoft9/initproxy.conf /data/nginx/default_host/initproxy.conf
[ -f /etc/websoft9/initproxy.conf ] && rm -f /data/nginx/proxy_host/initproxy.conf
# Deploy Websoft9 landing pages
if [ ! -d /data/nginx/default_www/landing ]; then
mkdir -p /data/nginx/default_www/
cp -r /etc/websoft9/landing /data/nginx/default_www/
else
echo "/data/nginx/default_www/landing already exists."
fi
# If credential file then create it and init credential for NPM
# Reload NPM docker image Environments

View file

@ -18,7 +18,7 @@ export PATH
#
# $ sudo bash install.sh --port 9001
#
# --channel <release|dev>
# --channel <release|rc|dev>
# Use the --channel option to install a release(production) or dev distribution. default is release, for example:
#
# $ sudo bash install.sh --channel release
@ -302,6 +302,35 @@ install_tools(){
fi
}
download_artifact() {
local artifact_url="$1"
local source_zip="$2"
local max_attempts="$3"
for ((i=1; i<=max_attempts; i++)); do
wget -P /tmp "$artifact_url/$source_zip"
if [ $? -eq 0 ]; then
echo "Downloaded successfully using wget on attempt $i."
return 0
else
echo "Attempt $i failed using wget."
fi
done
for ((i=1; i<=max_attempts; i++)); do
curl -o /tmp/"$source_zip" "$artifact_url/$source_zip"
if [ $? -eq 0 ]; then
echo "Downloaded successfully using curl on attempt $i."
return 0
else
echo "Attempt $i failed using curl."
fi
done
echo "Failed to download source package after $((max_attempts * 2)) attempts."
return 1
}
download_source_and_checkimage() {
echo_prefix_source=$'\n[Download Source] - '
echo "$echo_prefix_source Download Websoft9 source code from $artifact_url/$source_zip"
@ -309,7 +338,7 @@ download_source_and_checkimage() {
find . -type f -name "websoft9*.zip*" -exec rm -f {} \;
rm -rf /tmp/$source_unzip
wget -P /tmp "$artifact_url/$source_zip"
download_artifact "$artifact_url" "$source_zip" 10
if [ $? -ne 0 ]; then
echo "Failed to download source package."
exit 1

View file

@ -4,6 +4,9 @@ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
cockpit_port="9000"
container_name="websoft9-apphub"
volume_name="websoft9_apphub_config"
cockpit_service_path="/lib/systemd/system/cockpit.socket"
cockpit_ssl_path="/etc/cockpit/ws-certs.d/"
npm_ssl_path="/var/lib/docker/volumes/websoft9_nginx_data/_data/custom_ssl/"
# get volume from container
function get_volume_path() {
@ -28,14 +31,12 @@ function get_volume_path() {
echo "Cannot get volume path"
exit 1
}
volume_path=$(get_volume_path "$container_name" "$volume_name")
config_path="$volume_path/config.ini"
cockpit_service_path="/lib/systemd/system/cockpit.socket"
FILES="$cockpit_service_path $config_path"
# 监控文件发生变动时需要做的事情
on_change() {
sync_cockpit_port() {
echo "sync cockpit port from config.ini"
set +e
cockpit_port=$(docker exec -i websoft9-apphub apphub getconfig --section cockpit --key port)
listen_stream=$(grep -Po 'ListenStream=\K[0-9]*' /lib/systemd/system/cockpit.socket)
@ -58,12 +59,32 @@ set_Firewalld(){
firewall-cmd --reload 2>/dev/nul
}
# when websoft9 restart, sync cockpit port
on_change
force_sync(){
echo "Force sync cockpit port and certs"
sync_cockpit_port
cp -r "${cockpit_ssl_path}"* $npm_ssl_path
}
# monitor /lib/systemd/system/cockpit.socket and config.ini, make sure config.ini port is the same with cockpit.socket
inotifywait -e modify,attrib -m $FILES | while read PATH EVENT FILE; do
echo "Set cockpit port by config.ini..."
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
on_change
done
# when websoft9 restart, force sync cockpit port and certs
force_sync
(
# monitor cockpit.socket and config.ini, make sure port at config.ins sync to cockpit.socket
inotifywait -e modify,attrib -m $FILES | while read PATH EVENT FILE; do
echo "Reset cockpit port when config.ini changed"
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
sync_cockpit_port
done
) &
(
# monitor cockpit ssl path and sync to NPM ssl path if changed
inotifywait -e create,modify,delete,attrib -m $cockpit_ssl_path | while read PATH EVENT FILE; do
echo "Sync CA files from cockipt to NPM when changed"
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
cp -r "${cockpit_ssl_path}"* $npm_ssl_path
done
) &
# Wait for background processes to finish
wait

View file

@ -1,5 +1,5 @@
{
"version": "2.1.17",
"version": "2.1.20",
"plugins": {
"portainer": "0.1.3",
"nginx": "0.1.0",
@ -11,8 +11,8 @@
},
"OS": {
"Fedora": [
"40",
"39"
"41",
"40"
],
"RedHat": [
"9",