This commit is contained in:
Darren 2023-07-20 13:27:37 +08:00 committed by GitHub
parent 39ced4bacd
commit 954ae397f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 57 additions and 776 deletions

View file

@ -6,11 +6,13 @@
# What is Websoft9? # What is Websoft9?
Websoft9 is complete minimalist and web-based PaaS for running [open source application](https://github.com/Websoft9/docker-library/tree/main/apps) that have more than 1k stars on your own server. Websoft9 is web-based PaaS for running 200+ hot [open source application](https://github.com/Websoft9/docker-library/tree/main/apps) on your own server.
Although the architecture in cloud native emphasizes high availability and clustering, this is not suitable for simple applications or low-concurrency scenarios, after all, most applications on the Internet do not need to implement complex clusters or K8S. Websoft9 help you running multiple applications in a single server, that means we believe Microservices on single machine is reasonable. On the contrary, it becomes more and more valuable as computing power increases
Websoft9 solves the problem of using multiple applications in a single server from the beginning, and we strongly believe in the principle of minimalism.Microservices architecture on single machine is not outdated. On the contrary, it becomes more and more valuable as computing power increases Although the Cloud Native emphasizes high availability and clustering, but most of the time, applications do not need to implement complex clusters or K8S.
Websoft9's [architecture](https://github.com/Websoft9/websoft9/blob/main/docs/architecture.md) is simple, it did not create any new technology stack, and we fully utilize popular technology components to achieve our product goals, allowing users and developers to participate in our projects without the need to learn new technologies.
## Demos ## Demos
@ -22,8 +24,9 @@ You can see the sceenshoots below:
## Features ## Features
- Install 200+ template applications with any configuration - Applications listing
- Web-base file browser to manage files and folder - Install 200+ template applications without any configuration
- Web-based file browser to manage files and folder
- Manage user accounts - Manage user accounts
- Use a terminal on a remote server in your local web browser - Use a terminal on a remote server in your local web browser
- Nginx gui for proxy and free SSL with Let's Encrypt - Nginx gui for proxy and free SSL with Let's Encrypt
@ -31,33 +34,19 @@ You can see the sceenshoots below:
- Manage your Linux by GUI: Inspect and change network settings, Configure a firewall, Manage storage, Browse and search system logs, Inspect a systems hardware, Inspect and interact with systemd-based services, - Manage your Linux by GUI: Inspect and change network settings, Configure a firewall, Manage storage, Browse and search system logs, Inspect a systems hardware, Inspect and interact with systemd-based services,
- Supported languages: English, Chinese中文 - Supported languages: English, Chinese中文
## Containers # Install
Instead of reinventing the wheel, we integrate the best open source products into our interface so that customers don't have to learn new technology stacks or worry about the lack of maintenance of container components You should have root privileges user to install or upgrade Websoft9, if you use no-root user you can `sudo su` for it
- [Cockpit ](https://cockpit-project.org/): A web-based graphical interface for servers
- [Docker](https://www.docker.com/): Accelerate how you build, share, and run modern applications
- [Nginx Proxy Manager](https://nginxproxymanager.com/): A web-based Nginx management
- [Portainer](https://www.portainer.io/): Powerful container management for DevSecOps
- [Duplicati](https://www.duplicati.com/): Backup software to store encrypted backups online
- [Redis](https://redis.io/): The open source, in-memory data store
- [Appmanage](https://github.com/Websoft9/websoft9/tree/main/appmanage): API for manage docker compose based application powered by Wesoft9
# User Guide
## Installation ## Installation
``` ```
# when you have no root privileges
sudo su
wget https://websoft9.github.io/websoft9/install/install.sh && bash install.sh online wget https://websoft9.github.io/websoft9/install/install.sh && bash install.sh online
``` ```
## Upgrade ## Upgrade
``` ```
# when you have no root privileges
sudo su
curl https://websoft9.github.io/websoft9/install/update.sh | bash curl https://websoft9.github.io/websoft9/install/update.sh | bash
``` ```
@ -69,9 +58,10 @@ Using local Chrome or Firefox to visit the URL http://domain:9000 name or http:/
# Contributing # Contributing
- websoft9 appmanage Follow the [contributing guidelines](CONTRIBUTING.md) if you want to propose a change in the Websoft9 core. For more information about participating in the community and contributing to the Websoft9 project, see [this page](https://support.websoft9.com/docs/community/contributing).
- websoft9 docker-compose
Documentation for application templates based on Docker maintainers is in the [docker-library](https://github.com/Websoft9/docker-library).
# License # License
[LGPL-3.0](/License.md), Additional Terms: It is not allowed to publish free or paid image based on this repository in any Cloud platform's Marketplace without authorization (未经授权许可,不允许将基于本项目创建的镜像到云平台市场上售卖) Websoft9 is licensed under the [LGPL-3.0](/License.md), and additional Terms: It is not allowed to publish free or paid image based on this repository in any Cloud platform's Marketplace without authorization

View file

@ -1,492 +0,0 @@
#!/bin/bash
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
set -e
# Please modify this version and time after update
version(){
sudo echo "version: 1.6"
sudo echo "updated date: 2021-05-26"
}
# Tool list, apt or yum installation is only supported
tool_list=(
git
pwgen
jq
wget
curl
figlet
boxes
)
help_str="
Usage:
-h, --help Show this help message
-r, --repo_name The name of the warehouse
-p, --package Making local packs,Only when you need to pack
-v, --version Show version info
example: bash install.sh -r template -p
"
make_package=false
# Get option parameters
getopt_cmd=$(getopt -o r:phv --long repo_name:,package,help,version -n "Parameter error" -- "$@")
eval set -- "$getopt_cmd"
while [ -n "$1" ]
do
case "$1" in
-r|--repo_name)
repo_name=$2
shift ;;
-h|--help)
sudo echo -e "$help_str"
exit ;;
-p|--package)
make_package=true
shift ;;
-v|--version)
version
shift ;;
--)
break
shift ;;
esac
shift
done
[ ! -n "$repo_name" ] && exit 1
install_tools(){
if command -v apt > /dev/null;then
sudo apt update 1>/dev/null 2>&1
sudo apt install ${tool_list[*]} -y 1>/dev/null 2>&1
elif command -v yum > /dev/null;then
sudo yum clean all 1>/dev/null 2>&1
sudo yum makecache 1>/dev/null 2>&1
sudo yum install ${tool_list[*]} -y 1>/dev/null 2>&1
fi
}
download_docker_source(){
docker_download_url="https://download.docker.com/linux/static/stable/x86_64/docker-20.10.6.tgz"
cd /tmp/
sudo rm -rf docker.tgz
sudo wget $docker_download_url -O docker.tgz 1>/dev/null 2>&1
sudo echo -e "docker downloaded successfully"
sudo cat > /tmp/docker.service <<EOF
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP \$MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
EOF
}
install_docker_script(){
if command -v docker > /dev/null;then
sudo echo -e `docker -v`
sudo echo -e "Docker installed successfully"
else
sudo curl -fsSL https://get.docker.com -o get-docker.sh &>/dev/null && sh get-docker.sh &>/dev/null
sudo rm -rf get-docker.sh
sudo systemctl start docker
sudo systemctl enable docker &>/dev/null
sudo echo -e `docker -v`
sudo echo -e "Docker installed successfully"
fi
}
uninstall_docker(){
sudo rm -f /etc/systemd/system/docker.service
sudo rm -rf /usr/bin/docker*
sudo systemctl daemon-reload
sudo echo -e "Docker uninstalled successfully"
}
download_docker_compose(){
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.0/docker-compose-$(uname -s)-$(uname -m)" -o /tmp/docker-compose 1>/dev/null 2>&1
sudo chmod +x /tmp/docker-compose
sudo echo -e "docker-compose downloaded successfully"
}
install_docker_compose(){
curl -L "https://github.com/docker/compose/releases/download/1.29.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose 1>/dev/null 2>&1
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose &>/dev/mull || true
sudo echo `docker-compose -v`
sudo echo -e "docker-compose installed successfully"
}
save_images(){
sudo rm -rf /tmp/docker-$repo_name
sudo git clone https://github.com/Websoft9/docker-$repo_name.git /tmp/docker-$repo_name || sudo git clone https://github.com.cnpmjs.org/Websoft9/docker-$repo_name.git /tmp/docker-$repo_name
sudo docker rmi `docker images -aq` -f &>/dev/null || true
cd /tmp/docker-$repo_name
# Pull images and save images
sudo systemctl start docker
docker-compose pull
sudo echo -e "In image packaging, there is a long wait..."
sudo docker save $(docker images | grep -v REPOSITORY | awk 'BEGIN{OFS=":";ORS=" "}{print $1,$2}') -o /tmp/$repo_name.tar
sudo echo -e "The image was successfully saved as a tar package"
}
installation(){
sudo rm -rf $install_dir
sudo mkdir -p $install_dir /credentials 1>/dev/null 2>&1 && cd $install_dir
sudo git clone https://github.com/Websoft9/docker-$repo_name.git $install_dir || sudo git clone https://github.com.cnpmjs.org/Websoft9/docker-$repo_name.git $install_dir
# Rename compose and env file name
cd $install_dir
# Stop the container and remove the Volumes for sec_installation
cd $install_dir
rm -rf volumes
sudo docker-compose down -v 1>/dev/null 2>&1
# Avoiding db port conflicts
sudo echo -e "The database port is changing"
db_port_lines=$(cat $install_dir/.env |grep DB_.*PORT |wc -l)
db_port=$(cat $install_dir/.env |grep DB_.*PORT |cut -d= -f2 |sed -n 1p)
while true
do
if [ "$db_port_lines" -gt 0 ];then
os_db_port_lines=$(ss -ntulp |grep -w "$db_port" |wc -l)
if [ "$os_db_port_lines" -gt 0 ];then
db_port=`expr $db_port + 1`
sed -ri "s/(DB.*_PORT=).*/\1$db_port/" $install_dir/.env
else
break
fi
else
break
fi
done
# DB Random password
sudo echo -e "---$repo_name Installation Wizard----" |boxes |tee -a /credentials/password.txt
new_password=$(pwgen -ncCs 15 1)
db_password_lines=`cat $install_dir/.env |grep DB.*PASSWORD |wc -l`
db_user_lines=`cat $install_dir/.env |grep DB_.*_USER |wc -l`
if [ $db_password_lines -gt 0 ];then
if [ $db_user_lines -gt 0 ];then
db_username=$(cat $install_dir/.env |grep DB_.*_USER |cut -d= -f2 |sed -n 1p )
sudo echo "db username: $db_username" |tee -a /credentials/password.txt
else
sudo echo "db username: root" |tee -a /credentials/password.txt
fi
sudo sed -ri "s/(DB_.*_PASSWORD=).*/\1$new_password/" $install_dir/.env &>/dev/null || true
sudo echo "db password: $new_password" |tee -a /credentials/password.txt
else
sudo echo "No database password" |tee -a /credentials/password.txt
fi
if [ "$db_port_lines" -gt 0 ];then
sudo echo "db port: $db_port" |tee -a /credentials/password.txt
fi
sudo echo -e "************************************\n"|tee -a /credentials/password.txt
# APP Random password
app_password_lines=$(cat $install_dir/.env |grep -w "APP_PASSWORD_INIT" |wc -l)
app_user_lines=$(cat $install_dir/.env |grep -w "APP_USER" |wc -l)
app_port_lines=$(cat $install_dir/.env |grep -w "APP_PORT" |wc -l)
if [ "$app_user_lines" -gt 0 ];then
app_username=$(cat $install_dir/.env |grep -w "APP_USER" |cut -d= -f2 |sed -n 1p)
sudo echo "$repo_name login username: $app_username" |tee -a /credentials/password.txt
else
sudo echo "$repo_name login username: default username, please see the $install_dir/.env" |tee -a /credentials/password.txt
fi
if [ "$app_password_lines" -gt 0 ];then
sudo sed -ri "s/(APP_PASSWORD=).*/\1$new_password/" $install_dir/.env &>/dev/null || true
sudo echo "$repo_name login password: $new_password" |tee -a /credentials/password.txt
else
sudo echo "$repo_name login password: default password, please see the $install_dir/.env" |tee -a /credentials/password.txt
fi
if [ "$app_port_lines" -gt 0 ];then
app_port=$(cat $install_dir/.env |grep -w "APP_PORT" |cut -d= -f2 |sed -n 1p)
sudo echo "$repo_name login port: $app_port" |tee -a /credentials/password.txt
fi
sudo echo -e "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" |tee -a /credentials/password.txt
# Modify public network IP
public_ip=`wget -O - https://download.websoft9.com/ansible/get_ip.sh 2>/dev/null |bash`
case $repo_name in
"erpnext")
sudo sed -i "s/APP_SITE_NAME.*/APP_SITE_NAME=$public_ip/g" $install_dir/.env
sudo sed -i "s/APP_SITES=.*/APP_SITES=\`$public_ip\`/g" $install_dir/.env
;;
"graylog")
sudo sed -i "s#APP_HTTP_EXTERNAL_URI=.*#APP_HTTP_EXTERNAL_URI=http://$public_ip:9001/#g" $install_dir/.env
;;
"rocketchat")
sudo sed -i "s#APP_ROOT_URL=.*#APP_ROOT_URL=http://$public_ip:9001/#g" $install_dir/.env
;;
*)
;;
esac
# Change compose cli environment
export DOCKER_CLIENT_TIMEOUT=500
export COMPOSE_HTTP_TIMEOUT=500
sudo systemctl start docker
sudo docker-compose up -d
sleep 5
sudo clear
sudo echo -e "\n $repo_name installation complete\n" |boxes -d whirly
sudo echo -e "\n Please go to $repo_name to view the README file"
sudo docker ps -a
}
add_install_script(){
sudo rm -rf /tmp/install.sh /tmp/README /tmp/setup.sh
# Mirror package installation script
cat > /tmp/install.sh <<-EOF
# Install docker
sudo tar -xf docker.tgz
sudo systemctl stop docker &>/dev/mull || true
sudo mv docker.service /etc/systemd/system/docker.service
sudo mv docker/* /usr/bin/ 1>/dev/null 2>&1
sudo systemctl daemon-reload
sudo systemctl start docker
sudo systemctl enable docker &>/dev/null
sudo echo \$(docker -v)
sudo echo -e "Docker was installed successfully"
# Install docker-compose
sudo mv docker-compose /usr/local/bin/docker-compose 1>/dev/null 2>&1
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose &>/dev/mull || true
sudo echo \$(docker-compose -v)
sudo echo -e "docker-compose installed successfully"
# Pre_installation
sudo rm -rf $install_dir
sudo mkdir -p $install_dir /credentials 1>/dev/null 2>&1
sudo docker load -i $repo_name.tar
cur_dir=\$(pwd)
upper_dir=\$(dirname $install_dir)
sudo rm -rf \$upper_dir/$repo_name
cp=\$(which cp)
\$cp -rf \$cur_dir/docker-$repo_name \$upper_dir/$repo_name 1>/dev/null 2>&1
sudo mv README \$upper_dir/$repo_name/README 1>/dev/null 2>&1
# Stop the container and remove the Volumes for sec_installation
cd $install_dir
rm -rf volumes
sudo docker-compose down -v 1>/dev/null 2>&1
# Avoiding db port conflicts
db_port_lines=\$(cat $install_dir/.env |grep DB_.*PORT |wc -l)
db_port=\$(cat $install_dir/.env |grep DB_.*PORT |cut -d= -f2 |sed -n 1p)
while true
do
if [ "\$db_port_lines" -gt 0 ];then
os_db_port_lines=\$(ss -ntulp |grep \$db_port |wc -l)
if [ "\$os_db_port_lines" -gt 0 ];then
db_port=`expr \$db_port + 1`
sed -ri "s/(DB.*_PORT=).*/\1\$db_port/" $install_dir/.env
else
break
fi
else
break
fi
done
# DB Random password
sudo echo -e "---$repo_name Installation Wizard---\n" |tee -a /credentials/password.txt
new_password=\$(date | md5sum | awk '{print $1}' |cut -c 3-18)
db_password_lines=\$(cat $install_dir/.env |grep DB.*PASSWORD |wc -l)
db_user_lines=\$(cat $install_dir/.env |grep DB_.*_USER |wc -l)
if [ \$db_password_lines -gt 0 ];then
if [ \$db_user_lines -gt 0 ];then
db_username=\$(cat $install_dir/.env |grep DB_.*_USER |cut -d= -f2 |sed -n 1p)
sudo echo "db username: \$db_username" |tee -a /credentials/password.txt
else
sudo echo "db username: root" |tee -a /credentials/password.txt
fi
sudo sed -ri "s/(DB_.*_PASSWORD=).*/\1\$new_password/" $install_dir/.env &>/dev/null || true
sudo echo "db password: \$new_password" |tee -a /credentials/password.txt
else
sudo echo "No database password" |tee -a /credentials/password.txt
fi
if [ "\$db_port_lines" -gt 0 ];then
sudo echo "db port: \$db_port" |tee -a /credentials/password.txt
fi
sudo echo -e "************************************\n" |tee -a /credentials/password.txt
# APP Random password
app_user_lines=\$(cat $install_dir/.env |grep -w "APP_USER" |wc -l)
app_password_lines=\$(cat $install_dir/.env |grep -w "APP_PASSWORD_INIT" |wc -l)
app_port_lines=\$(cat $install_dir/.env |grep -w "APP_PORT" |wc -l)
if [ "\$app_user_lines" -gt 0 ];then
app_username=\$(cat $install_dir/.env |cut -d= -f2 |sed -n 1p)
sudo echo "$repo_name login username: \$app_username" |tee -a /credentials/password.txt
else
sudo echo "$repo_name login username: default username, please see the $install_dir/.env" |tee -a /credentials/password.txt
fi
if [ "\$app_password_lines" -gt 0 ];then
sudo sed -ri "s/(APP_PASSWORD=).*/\1\$new_password/" $install_dir/.env &>/dev/null || true
sudo echo "$repo_name login password: \$new_password" |tee -a /credentials/password.txt
else
sudo echo "$repo_name login password: default password, please see the $install_dir/.env" |tee -a /credentials/password.txt
fi
if [ "\$app_port_lines" -gt 0 ];then
app_port=\$(cat $install_dir/.env |grep -w "APP_PORT" |cut -d= -f2 |sed -n 1p)
sudo echo "$repo_name login port: \$app_port" |tee -a /credentials/password.txt
fi
sudo rm -rf \$cur_dir/{$repo_name.tar,get-docker.sh,docker.service,docker-compose,docker.tgz,docker,install.sh,docker-$repo_name}
sudo echo -e "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" |tee -a /credentials/password.txt
# Modify public network IP
public_ip=\$(wget -O - https://download.websoft9.com/ansible/get_ip.sh 2>/dev/null | timeout 10 bash)
case $repo_name in
"erpnext")
sudo sed -i "s/APP_SITE_NAME.*/APP_SITE_NAME=\$public_ip/g" $install_dir/.env
sudo sed -i "s/APP_SITES=.*/APP_SITES=\`\$public_ip\`/g" $install_dir/.env
;;
"graylog")
sudo sed -i "s#APP_HTTP_EXTERNAL_URI=.*#APP_HTTP_EXTERNAL_URI=http://\$public_ip:9001/#g" $install_dir/.env
;;
"rocketchat")
sudo sed -i "s#APP_ROOT_URL=.*#APP_ROOT_URL=http://\$public_ip:9001/#g" $install_dir/.env
;;
*)
;;
esac
# Change compose cli environment
export DOCKER_CLIENT_TIMEOUT=500
export COMPOSE_HTTP_TIMEOUT=500
sudo systemctl start docker
sudo docker-compose up -d
sudo clear && sudo docker ps -a
sudo echo -e "\n $repo_name installation complete\n"
sudo echo -e "\n Please go to \$upper_dir/$repo_name to view the README file"
EOF
# README file
cat > /tmp/README <<-EOF
Document address:
http://support.websoft9.com/docs/$repo_name/zh/
Project address:
https://github.com/websoft9/docker-$repo_name
Password file location:
/credentials/password.txt
EOF
# Unpack the pre-installed script
cat > /tmp/setup.sh <<-EOF
#!/bin/bash
line=\`wc -l \$0|awk '{print \$1}'\`
line=\`expr \$line - 7\`
tail -n \$line \$0 |tar zx -C ~
cd ~
./install.sh
ret=\$?
exit \$ret
EOF
sudo chmod +x /tmp/install.sh
sudo chmod +x /tmp/setup.sh
}
get_install_information(){
install_dir=`curl -s https://raw.githubusercontent.com/Websoft9/docker-$repo_name/main/variables.json |jq -r .installpath` 1>/dev/null
compose_file_name=`curl -s https://raw.githubusercontent.com/Websoft9/docker-$repo_name/main/variables.json |jq -r .compose_file` 1>/dev/null
compose_env_url="https://raw.githubusercontent.com/Websoft9/docker-$repo_name/main/.env"
url_status=`curl -s -m 5 -IL $compose_env_url |grep 200 || true`
if [[ $url_status == "" ]];then
sudo echo "The env file does not exist"
exit 1
fi
if [[ $install_dir == "null" || $compose_file_name = "null" ]];then
sudo echo "variables.json has an undefined parameter"
exit 1
fi
sudo echo install path $install_dir
sudo echo compose filename $compose_file_name
}
make_package(){
sudo rm -rf /tmp/$repo_name.tgz install-$repo_name
cd /tmp && tar -zcf /tmp/$repo_name.tgz ./{install.sh,README,$repo_name.tar,docker-$repo_name,docker.tgz,docker.service,docker-compose}
sudo cat setup.sh $repo_name.tgz > ~/install-$repo_name
sudo chmod +x ~/install-$repo_name
cd ~ && sudo echo -e "Image packaging successfully" |boxes -d whirly
}
print_information(){
sudo figlet websoft9
# Check if the repo exists
repo_name_exists=$(curl -s --head https://github.com/Websoft9/docker-$repo_name | head -n 1 |grep -c '200')
[ "$repo_name_exists" -ne 1 ] && sudo echo -e "The repo does not exist !" && exit 1
# Print installation information
if [ -n "$repo_name" ] && [ "$make_package" == false ];then
sudo echo "docker-$repo_name to be installed..."
fi
if [ -n "$repo_name" ] && [ "$make_package" == true ];then
sudo echo "$repo_name will be packaged as an image..."
fi
}
install_tools
print_information
get_install_information
if [ $make_package = false ]; then
install_docker_script
install_docker_compose
installation
fi
if [ $make_package = true ]; then
install_docker_script
install_docker_compose
download_docker_source
download_docker_compose
save_images
add_install_script
make_package
fi

View file

@ -1,47 +1,24 @@
## Architecture ## Architecture
```mermaid Websoft9 is very simple [architecture](https://www.canva.cn/design/DAFpI9loqzQ/hI_2vrtfoK7zJwauhJzipQ/view?utm_content=DAFpI9loqzQ&utm_campaign=designshare&utm_medium=link&utm_source=publishsharelink) which used [Redhat Cockpit ](https://cockpit-project.org/) for web framework and [Docker](https://www.docker.com/) for running [application](https://github.com/Websoft9/docker-library).
graph LR
Portainer --> NginxProxyManager --> Redis --> APPMANAGE
```
## 详细 The benefits of this architecture means you don't have to learn new technology stacks or worry about the lack of maintenance this project.
### 微服务 ![Alt text](image/archi.png)
存在的微服务以及选型:
- Cockpit(Monitor,SSH Ternimal,File Browser) What we do is integrating below stacks's API or interfaces to Cockpit console by [Cockpit packages (Also known as plugin)](https://cockpit-project.org/guide/latest/packages.html) :
- Cockpit plugins(Nodejs web)
- Container Manager(portainer container)
- Proxy&DNS(nginxproxymanager container)
- backup(kopia container)
- appstore(appmanager container)
- API gateway: Kong待定
- CLI待定
### 基础组件 - [Nginx Proxy Manager](https://nginxproxymanager.com/): A web-based Nginx management
- [Portainer](https://www.portainer.io/): Powerful container management for DevSecOps
- [Duplicati](https://www.duplicati.com/): Backup software to store encrypted backups online
- [Redis](https://redis.io/): The open source, in-memory data store
- [Appmanage](https://github.com/Websoft9/websoft9/tree/main/appmanage): API for create and manage docker compose based application powered by Websoft9
技术选型如下:
- 前端Nodejs, react, cockpit app As Websoft9 is a complete product, we also offer:
- 后端Python, Docker, Docker-compose, FastAPI
- API DOCS 生成与测试swagger
- 安全pwgen随机密码md5(htpasswd)
- 身份验证:(待定)
- CLI待定
### 产品文件目录 * API
* CLI
便于升级、便于用户使用的产品文件目录组织结构 It is more attractive to users is [200+ application templates](https://github.com/Websoft9/docker-library).
- 微服务容器:/stackhub/docker
- Cockpit 插件:/stackhub/cockpit
- 安装和升级脚本: /stackhub/install
- Appstore 后台源码: /stackhub/appmanage
- cli: /stackhub/cli(待定)
### Contributor
- 类型标签Bug, enhancement, Documetation
- 过程标签PRD, Dev, QA(include deployment), Documetation

View file

@ -176,3 +176,32 @@ Dockerhub, Github packages, Azure artifacts, CODING 制品库
## Cockpit 插件 ## Cockpit 插件
待补充。。。 待补充。。。
### 基础组件
技术选型如下:
- 前端Nodejs, react, cockpit app
- 后端Python, Docker, Docker-compose, FastAPI
- API DOCS 生成与测试swagger
- 安全pwgen随机密码md5(htpasswd)
- 身份验证:(待定)
- CLI待定
### 产品文件目录
便于升级、便于用户使用的产品文件目录组织结构
- 微服务容器:/stackhub/docker
- Cockpit 插件:/stackhub/cockpit
- 安装和升级脚本: /stackhub/install
- Appstore 后台源码: /stackhub/appmanage
- cli: /stackhub/cli(待定)
### Contributor
- 类型标签Bug, enhancement, Documetation
- 过程标签PRD, Dev, QA(include deployment), Documetation

BIN
docs/image/archi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

View file

@ -1,43 +1,3 @@
# Scripts # Scripts
## install.sh Some useful script for Websoft9 maintenance
install.sh 安装 Stackhub 的自动化脚本,支持两个参数:
- -r 代表项目名称例如magento, lamp, lnmp, wordpress, joomla, gitlab 等
- -i 代表是否用于镜像生产,支持 0默认值不用于镜像生产和 1 两种参数
主要有两种使用场景:
```
1 制作镜像
# 该场景下,脚本会删除服务器上的密钥对或运行云平台的某些恢复服务器出厂设置命令。
# 安装应用
wget -N https://websoft9.github.io/stackhub/scripts/install.sh; bash install.sh -r magento -i 1
# 中断后命令
cd /tmp/stackhub/apps && ansible-playbook -i hosts application.yml -c local -e init=1 -e appname=magento
2. 安装应用立即使用
# 此场景下,安装完成后,系统会强制重启
# 安装应用
wget -N https://websoft9.github.io/stackhub/scripts/install.sh; bash install.sh -r magento -i 0
# 中断后命令
cd /tmp/stackhub/apps && ansible-playbook -i hosts application.yml -c local -e init=0 -e appname=magento
```
## reset_mysql_password.sh
该脚本 fork from [Mysql_ResetPasswd_Script](https://github.com/EwigeveMicca/Mysql_ResetPasswd_Script),目前只适用于 CentOS7 以上的系统和 MySQL5.6 版本;
用法:
```
sudo git clone https://github.com/Websoft9/linuxscript.git; cd linuxscript/Mysql_ResetPasswd_Script;sudo sh reset_mysql_password.sh
```

View file

@ -1,79 +0,0 @@
#!/bin/bash
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
clear
# Check if user is root
[ $(id -u) != "0" ] && { echo "Error: You must be root to run this script, please use 'sudo su -' command to change root"; exit 1; }
version(){
echo "version: 0.1"
echo "updated date: 2019-12-30"
}
Show_Help(){
version
echo "Usage: $0 command ...[parameters]...
--help, -h Show this help message
--version, -v Show version info
"
}
echo "Pre-installation is starting, please wait for 1-3 minutes..."
# OracleLinux need install oaclelinux-developer-release-e* oracle-nodejs-release-e* oracle-epel-release-e* in Image before this script
if command -v yum > /dev/null; then
sudo yum install -y epel-release 1>/dev/null 2>&1
sudo yum install yum-utils git libselinux-python python python3 -y 1>/dev/null 2>&1
sudo python3 -m pip install -U --force-reinstall requests docker 1>/dev/null 2>&1
if command -v amazon-linux-extras > /dev/null; then
echo "amazon-linux-extras install ansible2"
sudo amazon-linux-extras install ansible2
else
echo "yum install ansible"
sudo yum install ansible sshpass -y 1>/dev/null 2>&1
fi
fi
if command -v apt > /dev/null; then
sudo apt-get install git python python3 git -y 1>/dev/null 2>&1
sudo apt install software-properties-common -y 1>/dev/null 2>&1
if [[ $(cat /etc/os-release |grep VERSION_CODENAME |cut -d= -f2) == focal ]];then
echo "have ansible pkg"
elif [[ $(cat /etc/os-release |grep VERSION_CODENAME |cut -d= -f2) == bionic ]];then
sudo apt-add-repository --yes --update ppa:ansible/ansible
fi
sudo apt install ansible sshpass -y
fi
sudo echo "Pre-installation has beend completed"
# r:repository; i:init
while getopts ":r:"":i:" opt
do
case $opt in
r)
repo_name=$OPTARG;;
i)
repo_init=$OPTARG
;;
?)
echo "no repository"
exit 1;;
esac
done
echo $repo_name
echo $repo_init
cd /tmp
rm -rf stackhub
wget -N https://websoft9.github.io/stackhub/scripts/githubclone.sh && bash githubclone.sh websoft9 stackhub
cd stackhub/apps
sudo echo "localhost" > hosts
ansible-playbook -i hosts application.yml -c local -e init=$repo_init -e appname=$repo_name
if [ $repo_init -ne 0 ]; then
echo "Image build success!"
else
echo "System must restart after 2s, then installation completed"; sleep 2 ; sudo reboot
fi

View file

@ -1,52 +0,0 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
# Check if user is root
if [ $(id -u) != "0" ]; then
echo -e "————————————————————————————————————————————————————
[ERROR] It is detected that you do not use root permissions to execute the script.
Please use the root account to log in to SSH to run this script
————————————————————————————————————————————————————"
exit
fi
clear
echo -e "————————————————————————————————————————————————————
Please enter the MySQL password you need to set up
Tip: do not enter a blank password.
————————————————————————————————————————————————————"
mysql_root_password=""
read -p "(Please enter the MySQL password you need to set up):" mysql_root_password
if [ "$mysql_root_password" = "" ]; then
echo "[ERROR] Please do not enter blank password\n"
exit 1
fi
printf "stop MySQL service......\n"
systemctl stop mysqld
printf "Setting the MySQL permissions table\n"
/usr/bin/mysqld_safe --skip-grant-tables >/dev/null 2>&1 &
printf "The permissions table is being refreshed and the password is reset\n"
sleep 10
/usr/bin/mysql -u root mysql << EOF
update user set password = Password('$mysql_root_password') where User = 'root';
EOF
reset_status=`echo $?`
if [ $reset_status = "0" ]; then
printf "The MySQL password has been set up successfully. Now restore the MySQL permissions table\n"
killall mysqld
sleep 10
printf "The MySQL service is being restarted\n"
systemctl start mysqld
echo -e "————————————————————————————————————————————————————
The MySQL password has been reset.
\033[33m $mysql_root_password \033[0m
————————————————————————————————————————————————————"
else
echo -e "————————————————————————————————————————————————————
[ERROR] Unable to reset the MySQL password.
————————————————————————————————————————————————————"
fi

View file

@ -1,52 +0,0 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
# Check if user is root
if [ $(id -u) != "0" ]; then
echo -e "————————————————————————————————————————————————————
[ERROR] It is detected that you do not use root permissions to execute the script.
Please use the root account to log in to SSH to run this script
————————————————————————————————————————————————————"
exit
fi
clear
echo -e "————————————————————————————————————————————————————
Please enter the MySQL password you need to set up
Tip: do not enter a blank password.
————————————————————————————————————————————————————"
mysql_root_password=""
read -p "(Please enter the MySQL password you need to set up):" mysql_root_password
if [ "$mysql_root_password" = "" ]; then
echo "[ERROR] Please do not enter blank password\n"
exit 1
fi
printf "stop MySQL service......\n"
systemctl stop mysqld
printf "Setting the MySQL permissions table\n"
/usr/bin/mysqld_safe --skip-grant-tables >/dev/null 2>&1 &
printf "The permissions table is being refreshed and the password is reset\n"
sleep 10
/usr/bin/mysql -u root mysql << EOF
update user set password = Password('$mysql_root_password') where User = 'root';
EOF
reset_status=`echo $?`
if [ $reset_status = "0" ]; then
printf "The MySQL password has been set up successfully. Now restore the MySQL permissions table\n"
killall mysqld
sleep 10
printf "The MySQL service is being restarted\n"
systemctl start mysqld
echo -e "————————————————————————————————————————————————————
The MySQL password has been reset.
\033[33m $mysql_root_password \033[0m
————————————————————————————————————————————————————"
else
echo -e "————————————————————————————————————————————————————
[ERROR] Unable to reset the MySQL password.
————————————————————————————————————————————————————"
fi