mirror of
https://github.com/Websoft9/websoft9.git
synced 2024-09-29 08:11:14 +00:00
online install
This commit is contained in:
parent
3725148cfd
commit
29b9edd337
|
@ -4,45 +4,42 @@
|
|||
|
||||
|
||||
server {
|
||||
set $forward_scheme http;
|
||||
set $server "172.17.0.1";
|
||||
set $port 9000;
|
||||
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
server_name domain.com;
|
||||
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $http_connection;
|
||||
proxy_http_version 1.1;
|
||||
access_log /data/logs/proxy-host-2_access.log proxy;
|
||||
error_log /data/logs/proxy-host-2_error.log warn;
|
||||
access_log /data/logs/proxy-host-1_access.log proxy;
|
||||
error_log /data/logs/proxy-host-1_error.log warn;
|
||||
|
||||
location /AppManage/ {
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-Scheme $scheme;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_pass http://websoft9-appmanage:5000/;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $http_connection;
|
||||
proxy_http_version 1.1;
|
||||
auth_basic "Protected Area";
|
||||
auth_basic_user_file /data/nginx/proxy_host/.htpasswd;
|
||||
if ($http_referer ~* /portainer/) {
|
||||
rewrite ^/locales/(.*) /portainer/locales/$1 break;
|
||||
}
|
||||
|
||||
|
||||
location /portainer/ {
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-Scheme $scheme;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header Accept-Encoding \"\";
|
||||
proxy_pass http://websoft9-portainer:9000/;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $http_connection;
|
||||
proxy_http_version 1.1;
|
||||
proxy_http_version 1.1;
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
|
||||
if ($request_method = OPTIONS) {
|
||||
return 204;
|
||||
}
|
||||
set $quot_tmp "\"";
|
||||
set $portainer_jwt "${quot_tmp}${arg_portainer_jwt}${quot_tmp}";
|
||||
# sub_filter '</head>' "<script>window.localStorage.setItem('portainer.JWT', '$portainer_jwt');</script></head>";
|
||||
sub_filter '</head>' "<script>if (!window.localStorage.getItem('portainer.JWT')) { window.localStorage.setItem('portainer.JWT', '$portainer_jwt'); }</script></head>";
|
||||
sub_filter_once on;
|
||||
sub_filter_types *;
|
||||
}
|
||||
|
||||
location /nginxproxymanager/ {
|
||||
|
@ -59,9 +56,13 @@ server {
|
|||
proxy_cache_bypass $http_upgrade;
|
||||
proxy_set_header Connection $http_connection;
|
||||
proxy_cache_bypass $http_secret_header;
|
||||
proxy_set_header Accept-Encoding "";
|
||||
proxy_set_header Accept-Encoding \"\";
|
||||
add_header Pragma "no-cache";
|
||||
add_header Cache-Control "no-cache";
|
||||
if ($request_method = OPTIONS) {
|
||||
return 204;
|
||||
}
|
||||
sub_filter '</head>' "<script>var token='$arg_Token';(token)?window.localStorage.setItem('nginx-proxy-manager-tokens', '[{\"t\":\"$arg_Token\",\"n\":\"$arg_Name\"}]'):null;</script></head>";
|
||||
# source changes
|
||||
sub_filter 'href="/' 'href="/nginxproxymanager/';
|
||||
sub_filter 'src="/' 'src="/nginxproxymanager/';
|
||||
|
@ -75,19 +76,15 @@ server {
|
|||
sub_filter 'window.location="/"' 'window.location="/nginxproxymanager/"';
|
||||
sub_filter 'history.start({pushState:!0})' 'history.start({pushState:!0,root: "/nginxproxymanager/"})';
|
||||
sub_filter 'i.history.navigate(e.' 'i.history.navigate(e.replace("/nginxproxymanager","").';
|
||||
sub_filter_types text/css text/javascript application/javascript;
|
||||
sub_filter_types *;
|
||||
sub_filter_once off;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $http_connection;
|
||||
proxy_http_version 1.1;
|
||||
|
||||
# Proxy!
|
||||
include conf.d/include/proxy.conf;
|
||||
}
|
||||
|
||||
# Custom
|
||||
include /data/nginx/custom/server_proxy[.]conf;
|
||||
}
|
||||
}
|
|
@ -8,8 +8,9 @@ function error_exit {
|
|||
}
|
||||
trap 'error_exit "Please push issue to: https://github.com/Websoft9/stackhub/issues"' ERR
|
||||
|
||||
install_way=$1
|
||||
|
||||
urls=(
|
||||
https://github.com
|
||||
https://ghproxy.com/https://github.com
|
||||
)
|
||||
|
||||
|
@ -314,28 +315,34 @@ echo "Set cockpit port to 9000 ..."
|
|||
sudo sed -i 's/ListenStream=9090/ListenStream=9000/' /lib/systemd/system/cockpit.socket
|
||||
|
||||
# install plugins
|
||||
# install appstore
|
||||
mkdir /usr/share/cockpit/appstore
|
||||
cp -r /data/apps/plugin-appstore/build/* /usr/share/cockpit/appstore
|
||||
cp -r /data/apps/plugin-appstore/data /usr/share/cockpit/appstore/static/
|
||||
if [ "${install_way}" == 'online' ] ;then
|
||||
# install appstore
|
||||
mkdir /usr/share/cockpit/appstore
|
||||
cp -r /data/apps/plugin-appstore/build/* /usr/share/cockpit/appstore
|
||||
cp -r /data/apps/plugin-appstore/data /usr/share/cockpit/appstore/static/
|
||||
|
||||
# install portainer
|
||||
mkdir /usr/share/cockpit/container
|
||||
cp -r /data/apps/plugin-portainer/build/* /usr/share/cockpit/container
|
||||
# install portainer
|
||||
mkdir /usr/share/cockpit/container
|
||||
cp -r /data/apps/plugin-portainer/build/* /usr/share/cockpit/container
|
||||
|
||||
## install nginx
|
||||
mkdir /usr/share/cockpit/nginx
|
||||
cp -r /data/apps/plugin-nginx/build/* /usr/share/cockpit/nginx
|
||||
## install nginx
|
||||
mkdir /usr/share/cockpit/nginx
|
||||
cp -r /data/apps/plugin-nginx/build/* /usr/share/cockpit/nginx
|
||||
|
||||
## install settings
|
||||
mkdir /usr/share/cockpit/settings
|
||||
cp -r /data/apps/plugin-settings/build/* /usr/share/cockpit/settings
|
||||
|
||||
## install myapps
|
||||
mkdir /usr/share/cockpit/myapps
|
||||
cp -r /data/apps/plugin-myapps/build/* /usr/share/cockpit/myapps
|
||||
cp -r /data/apps/plugin-myapps/logos /usr/share/cockpit/appstore/static/
|
||||
rm -rf /data/apps/plugin-*
|
||||
else
|
||||
echo "install from artifact"
|
||||
fi
|
||||
|
||||
## install settings
|
||||
mkdir /usr/share/cockpit/settings
|
||||
cp -r /data/apps/plugin-settings/build/* /usr/share/cockpit/settings
|
||||
|
||||
## install myapps
|
||||
mkdir /usr/share/cockpit/myapps
|
||||
cp -r /data/apps/plugin-myapps/build/* /usr/share/cockpit/myapps
|
||||
cp -r /data/apps/plugin-myapps/logos /usr/share/cockpit/appstore/static/
|
||||
rm -rf /data/apps/plugin-*
|
||||
|
||||
# install navigator
|
||||
if [ "$os_type" == 'Ubuntu' ] || [ "$os_type" == 'Debian' ] ;then
|
||||
|
@ -362,7 +369,12 @@ fi
|
|||
rm -rf /usr/share/cockpit/apps /usr/share/cockpit/selinux /usr/share/cockpit/kdump /usr/share/cockpit/sosreport /usr/share/cockpit/packagekit
|
||||
|
||||
# configure cockpit
|
||||
cp /data/apps/websoft9/cockpit/cockpit.conf /etc/cockpit/cockpit.conf
|
||||
if [ "${install_way}" == 'online' ] ;then
|
||||
cp /data/apps/websoft9/cockpit/cockpit.conf /etc/cockpit/cockpit.conf
|
||||
else
|
||||
echo "install from artifact"
|
||||
fi
|
||||
|
||||
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable --now cockpit
|
||||
|
@ -423,14 +435,20 @@ if [ -z "$fasturl" ]; then
|
|||
fi
|
||||
# download apps
|
||||
mkdir -p /data/apps
|
||||
clone_repo $fasturl/Websoft9/docker-library /data/library
|
||||
clone_repo $fasturl/Websoft9/websoft9 /data/apps/websoft9
|
||||
clone_repo $fasturl/Websoft9/plugin-appstore /data/apps/plugin-appstore
|
||||
clone_repo $fasturl/Websoft9/plugin-myapps /data/apps/plugin-myapps
|
||||
clone_repo $fasturl/Websoft9/plugin-portainer /data/apps/plugin-portainer
|
||||
clone_repo $fasturl/Websoft9/plugin-settings /data/apps/plugin-settings
|
||||
clone_repo $fasturl/Websoft9/plugin-nginx /data/apps/plugin-nginx
|
||||
cp -r /data/apps/websoft9/docker /data/apps/w9services
|
||||
|
||||
if [ "${install_way}" == 'online' ] ;then
|
||||
clone_repo $fasturl/Websoft9/docker-library /data/library
|
||||
clone_repo $fasturl/Websoft9/websoft9 /data/apps/websoft9
|
||||
clone_repo $fasturl/Websoft9/plugin-appstore /data/apps/plugin-appstore
|
||||
clone_repo $fasturl/Websoft9/plugin-myapps /data/apps/plugin-myapps
|
||||
clone_repo $fasturl/Websoft9/plugin-portainer /data/apps/plugin-portainer
|
||||
clone_repo $fasturl/Websoft9/plugin-settings /data/apps/plugin-settings
|
||||
clone_repo $fasturl/Websoft9/plugin-nginx /data/apps/plugin-nginx
|
||||
cp -r /data/apps/websoft9/docker /data/apps/w9services
|
||||
else
|
||||
echo "install from artifact"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
StartAppMng(){
|
||||
|
@ -439,7 +457,11 @@ echo "Start appmanage API ..."
|
|||
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/websoft9/scripts/get_ip.sh`
|
||||
if [ "${install_way}" == 'online' ] ;then
|
||||
public_ip=`bash /data/apps/websoft9/scripts/get_ip.sh`
|
||||
else
|
||||
public_ip=`curl https://websoft9.github.io/websoft9/scripts/get_ip.sh |bash`
|
||||
fi
|
||||
echo $public_ip > /data/apps/w9services/w9appmanage/public_ip
|
||||
appmanage_ip=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' websoft9-appmanage)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue