change docs

This commit is contained in:
qiaofeng1227 2023-07-03 10:36:36 +08:00
parent 2bef5ef34e
commit 9c3ef35bca
14 changed files with 36 additions and 109 deletions

View file

@ -4,4 +4,4 @@ router = APIRouter()
@router.get("/health") @router.get("/health")
def health_check(): def health_check():
return {"message": "StackHub API is alive"} return {"message": "stackhub API is alive"}

View file

@ -4,21 +4,19 @@
### 安装组件 ### 安装组件
1. python环境 1. python 环境
确保安装python3.6+ 确保安装 python3.6+
2. python的pip包fastapi,uvicorn[standard],gunicorn 2. python 的 pip 包 fastapi,uvicorn[standard],gunicorn
``` ```
pip install -r requirements.txt pip install -r requirements.txt
``` ```
3. 安装docker以及docker compose、创建docker 网络websoft9 3. 安装 docker 以及 docker compose、创建 docker 网络 websoft9
### 启动 ### 启动
``` ```
git clone https://github.com/Websoft9/StackHub.git && cd StackHub/docker/appmanage && docker compose up -d git clone https://github.com/Websoft9/stackhub.git && cd stackhub/docker/appmanage && docker compose up -d
``` ```

View file

@ -3,7 +3,7 @@ Websoft9/role_docker Install Docker and some applications on Docker public 2021-
Websoft9/ansible-superset Automatic installation for Apache Superset on Linux public 2021-09-26T03:19:56Z Websoft9/ansible-superset Automatic installation for Apache Superset on Linux public 2021-09-26T03:19:56Z
Websoft9/ansible-gitlab Automatic installation for GitLab on Linux public 2021-09-24T09:57:37Z Websoft9/ansible-gitlab Automatic installation for GitLab on Linux public 2021-09-24T09:57:37Z
Websoft9/docker-falcon Docker Compose to deploy Falcon-Plus in production public, fork 2021-09-24T02:58:00Z Websoft9/docker-falcon Docker Compose to deploy Falcon-Plus in production public, fork 2021-09-24T02:58:00Z
Websoft9/StackHub CLI to install hot open source stacks public 2021-09-23T10:06:45Z Websoft9/stackhub CLI to install hot open source stacks public 2021-09-23T10:06:45Z
Websoft9/ansible-ansible This repository is only for developer who want to testing and learning Ansible public 2021-09-18T11:08:52Z Websoft9/ansible-ansible This repository is only for developer who want to testing and learning Ansible public 2021-09-18T11:08:52Z
Websoft9/ansible-jenkins Automatic installation for Jenkins on Linux public 2021-09-18T03:40:34Z Websoft9/ansible-jenkins Automatic installation for Jenkins on Linux public 2021-09-18T03:40:34Z
Websoft9/docker-wordpress Docker Compose to deploy WordPress in production public, fork 2021-09-18T02:23:33Z Websoft9/docker-wordpress Docker Compose to deploy WordPress in production public, fork 2021-09-18T02:23:33Z

View file

@ -1,6 +1,6 @@
# 需求 # 需求
从两个主线理解 StackHub 的需求: 从两个主线理解 stackhub 的需求:
- 应用生命周期管理:寻找、安装、发布、停止、卸载、升级等软件全生命周期。 - 应用生命周期管理:寻找、安装、发布、停止、卸载、升级等软件全生命周期。
- 基础设施运维管理:安全、存储、文件、容器、监控等系统管理 - 基础设施运维管理:安全、存储、文件、容器、监控等系统管理
@ -108,7 +108,7 @@ UI 自适应各种屏幕尺寸
一键自动化安装程序,类似: 一键自动化安装程序,类似:
``` ```
curl https://websoft9.github.io/StackHub/install/install.sh | bash curl https://websoft9.github.io/stackhub/install/install.sh | bash
``` ```
主要步骤包括: 主要步骤包括:

View file

@ -4,11 +4,11 @@
1. 将 APP 的版本号、最小 CPU、内存、磁盘空间同步到 Contenful 数据表,通过自动化[Github Action](https://github.com/Websoft9/docker-library/blob/main/.github/workflows/requirement_to_contentful.yml)实现。 1. 将 APP 的版本号、最小 CPU、内存、磁盘空间同步到 Contenful 数据表,通过自动化[Github Action](https://github.com/Websoft9/docker-library/blob/main/.github/workflows/requirement_to_contentful.yml)实现。
2. 将 logo 图片同步到 Stackhub 项目的静态文件夹(/static/images),通过自动化[Github Action](https://github.com/Websoft9/StackHub/blob/main/.github/workflows/logo.yml)实现。 2. 将 logo 图片同步到 Stackhub 项目的静态文件夹(/static/images),通过自动化[Github Action](https://github.com/Websoft9/stackhub/blob/main/.github/workflows/logo.yml)实现。
## AppManage 镜像生成 ## AppManage 镜像生成
发布镜像到 Dockhub 的 websoft9dev 组织下,通过自动化[Github Action](https://github.com/Websoft9/StackHub/blob/main/.github/workflows/appmanage_docker.yml)实现。 发布镜像到 Dockhub 的 websoft9dev 组织下,通过自动化[Github Action](https://github.com/Websoft9/stackhub/blob/main/.github/workflows/appmanage_docker.yml)实现。
## 日志 ## 日志

View file

@ -1,6 +1,6 @@
## 架构图 ## 架构图
![image](https://github.com/Websoft9/StackHub/assets/43192516/3b52f27a-8dff-477b-acea-cf971096540c) ![image](https://github.com/Websoft9/stackhub/assets/43192516/3b52f27a-8dff-477b-acea-cf971096540c)
## 详细 ## 详细

View file

@ -69,7 +69,7 @@ cancel_jobs = cancel.get_job_ids()
### API 文档 ### API 文档
[FastAPI 文档](https://github.com/Websoft9/StackHub/blob/main/appmanage/docs/developer.md) 使用 swagger 自动生成访问地址http://IP:PORT/docs。 [FastAPI 文档](https://github.com/Websoft9/stackhub/blob/main/appmanage/docs/developer.md) 使用 swagger 自动生成访问地址http://IP:PORT/docs。
## 版本管理 ## 版本管理
@ -109,7 +109,7 @@ Websoft9 的 release 的版本号由项目主版本号和各微服务和插件
"Ubuntu": ["18.04","20.04","22.04"], "Ubuntu": ["18.04","20.04","22.04"],
"RedHat": ["7.9","8.6","9.2"] "RedHat": ["7.9","8.6","9.2"]
}, },
"VERSION": "0.7.0" // StackHub项目版本号上面所有组件的更新都会引起其版本更新 "VERSION": "0.7.0" // stackhub项目版本号上面所有组件的更新都会引起其版本更新
} }
``` ```
@ -138,9 +138,9 @@ Dockerhub, Github packages, Azure artifacts, CODING 制品库
#### 制品库自动化 #### 制品库自动化
* 插件制品管理:开发人员开发测试完成后,修改插件版本,触发 Action 构建 Github packages 制品 - 插件制品管理:开发人员开发测试完成后,修改插件版本,触发 Action 构建 Github packages 制品
* docker-libaray 库制品管理:开发人员测试完成后,修改 library 版本,触发 Action 构建 Github packages 制品 - docker-libaray 库制品管理:开发人员测试完成后,修改 library 版本,触发 Action 构建 Github packages 制品
* websoft9 制品管理:开发人员修改 appmanage 源码或微服务 docker-compose 测试完成后,修改 微服务 版本,触发 Action 构建 Dockerhub 镜像制品以及后台微服务 Github packages 制品 - websoft9 制品管理:开发人员修改 appmanage 源码或微服务 docker-compose 测试完成后,修改 微服务 版本,触发 Action 构建 Dockerhub 镜像制品以及后台微服务 Github packages 制品
> Portainer,redis,nginxproxymanager 使用外部 dockerhub 镜像 > Portainer,redis,nginxproxymanager 使用外部 dockerhub 镜像

View file

@ -6,7 +6,7 @@ function error_exit {
echo "$1" 1>&2 echo "$1" 1>&2
exit 1 exit 1
} }
trap 'error_exit "Please push issue to: https://github.com/Websoft9/StackHub/issues"' ERR trap 'error_exit "Please push issue to: https://github.com/Websoft9/stackhub/issues"' ERR
urls=( urls=(
https://github.com https://github.com

View file

@ -6,7 +6,7 @@ function error_exit {
echo "$1" 1>&2 echo "$1" 1>&2
exit 1 exit 1
} }
trap 'error_exit "Please push issue to: https://github.com/Websoft9/StackHub/issues"' ERR trap 'error_exit "Please push issue to: https://github.com/Websoft9/stackhub/issues"' ERR
urls=( urls=(
https://ghproxy.com/https://github.com https://ghproxy.com/https://github.com
@ -359,7 +359,7 @@ echo "fast url is: "$fasturl
# download apps # download apps
mkdir -p /data/apps mkdir -p /data/apps
clone_repo $fasturl/Websoft9/docker-library /data/library clone_repo $fasturl/Websoft9/docker-library /data/library
clone_repo $fasturl/Websoft9/StackHub /data/apps/stackhub clone_repo $fasturl/Websoft9/stackhub /data/apps/stackhub
} }
StartAppMng(){ StartAppMng(){

View file

@ -6,7 +6,7 @@ function error_exit {
echo "$1" 1>&2 echo "$1" 1>&2
exit 1 exit 1
} }
trap 'error_exit "Please push issue to: https://github.com/Websoft9/StackHub/issues"' ERR trap 'error_exit "Please push issue to: https://github.com/Websoft9/stackhub/issues"' ERR
urls=( urls=(
https://ghproxy.com/https://github.com https://ghproxy.com/https://github.com
@ -125,7 +125,7 @@ fi
} }
StackhubUpdate(){ StackhubUpdate(){
echo "Update stackhub ..." echo "Update stackhub ..."
cd /tmp && rm -rf version.json && wget https://websoft9.github.io/StackHub/install/version.json cd /tmp && rm -rf version.json && wget https://websoft9.github.io/stackhub/install/version.json
if [ ! -f /data/apps/stackhub/install/version.json ]; then if [ ! -f /data/apps/stackhub/install/version.json ]; then
old_version="0.0.1" old_version="0.0.1"
@ -140,14 +140,14 @@ if [ "$old_version" \< "$release_version" ]; then
echo "fasturl is: "$fasturl echo "fasturl is: "$fasturl
cd /tmp && rm -rf /tmp/stackhub cd /tmp && rm -rf /tmp/stackhub
if [[ $fasturl == *gitee.com* ]]; then if [[ $fasturl == *gitee.com* ]]; then
wget $fasturl/websoft9/StackHub/repository/archive/$release_version wget $fasturl/websoft9/stackhub/repository/archive/$release_version
unzip $release_version unzip $release_version
mv StackHub* stackhub mv stackhub* stackhub
rm -f $release_version rm -f $release_version
else else
wget $fasturl/websoft9/StackHub/archive/refs/tags/$release_version.zip wget $fasturl/websoft9/stackhub/archive/refs/tags/$release_version.zip
unzip $release_version.zip unzip $release_version.zip
mv StackHub* stackhub mv stackhub* stackhub
rm -f $release_version.zip rm -f $release_version.zip
fi fi
rm -rf /data/apps/stackhub rm -rf /data/apps/stackhub

View file

@ -6,7 +6,7 @@ function error_exit {
echo "$1" 1>&2 echo "$1" 1>&2
exit 1 exit 1
} }
trap 'error_exit "Please push issue to: https://github.com/Websoft9/StackHub/issues"' ERR trap 'error_exit "Please push issue to: https://github.com/Websoft9/stackhub/issues"' ERR
urls=( urls=(
https://ghproxy.com/https://github.com https://ghproxy.com/https://github.com

View file

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

View file

@ -1,71 +0,0 @@
#!/bin/bash
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
# get applist
if [ -d StackHub ] ; then
echo "StackHub is exists"
else
git clone --depth=1 https://ghproxy.com/https://github.com/Websoft9/StackHub.git
fi
appnames=$(ls StackHub/apps/roles |grep -v Template |grep -v README.md |grep -v role)
targetlist=""
# get all of the running container's information( containername and imagename)
for appinfo in $(docker ps --format '{{.Names}}%{{.Image}}'); do
containername=$(echo $appinfo |awk -F"%" '{print $1}')
imagename=$(echo $appinfo |awk -F"%" '{print $2}')
for appname in $appnames; do
if [[ $containername == $appname ]];then
if [[ $targetlist =~ $appname ]];then
continue
fi
echo "$containername容器名匹配成功app:$appname"
targetlist="$targetlist $appname"
cp /data/apps/library/apps/"$appname"/src/get_version.sh /tmp/"$appname"_get_version.sh
chmod +x /tmp/"$appname"_get_version.sh
bash /tmp/"$appname"_get_version.sh $containername
break
fi
done
done
for appinfo in $(docker ps --format '{{.Names}}%{{.Image}}'); do
containername=$(echo $appinfo |awk -F"%" '{print $1}')
imagename=$(echo $appinfo |awk -F"%" '{print $2}')
for appname in $appnames; do
if [[ $imagename =~ $appname ]];then
if [[ $targetlist =~ $appname ]];then
continue
fi
tmpvar="-"
if [[ $containername =~ $tmpvar ]];then
echo "$imagename=镜像名匹配成功app:$appname, and容器名是$containername"
targetlist="$targetlist $appname"
cp /data/apps/library/apps/"$appname"/src/get_version.sh /tmp/"$appname"_get_version.sh
chmod +x /tmp/"$appname"_get_version.sh
bash /tmp/"$appname"_get_version.sh $containername
break
fi
else
realapp=echo $containername|awk -F"-" '{print $1}'
services=docker compose -p $realapp ps --services
for service in $services; do
if [[ $service == $appname ]];then
echo "$service服务名匹配成功app:$appname, and容器名是$containername"
targetlist="$targetlist $appname"
cp /data/apps/library/apps/"$appname"/src/get_version.sh /tmp/"$appname"_get_version.sh
chmod +x /tmp/"$appname"_get_version.sh
bash /tmp/"$appname"_get_version.sh $containername
break
fi
done
fi
done
done

View file

@ -67,9 +67,9 @@ echo $repo_name
echo $repo_init echo $repo_init
cd /tmp cd /tmp
rm -rf StackHub rm -rf stackhub
wget -N https://websoft9.github.io/StackHub/scripts/githubclone.sh && bash githubclone.sh websoft9 StackHub wget -N https://websoft9.github.io/stackhub/scripts/githubclone.sh && bash githubclone.sh websoft9 stackhub
cd StackHub/apps cd stackhub/apps
sudo echo "localhost" > hosts sudo echo "localhost" > hosts
ansible-playbook -i hosts application.yml -c local -e init=$repo_init -e appname=$repo_name ansible-playbook -i hosts application.yml -c local -e init=$repo_init -e appname=$repo_name
if [ $repo_init -ne 0 ]; then if [ $repo_init -ne 0 ]; then