Ecs迁移

来自ling
跳转至: 导航搜索

安装docker

https://help.aliyun.com/zh/ecs/use-cases/deploy-and-use-docker-on-alibaba-cloud-linux-2-instances?spm=5176.8351553.top-nav.6.26f91991E9xCTX&scm=20140722.S_help%40%40%E6%96%87%E6%A1%A3%40%4051853.S_BB2%40bl%2BRQW%40ag0%2BBB1%40ag0%2Bhot%2Bos0.ID_51853-RL_docker%20%E5%AE%89-LOC_console~UND~help-OR_ser-V_3-P0_1

sudo dnf config-manager --add-repo=https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo dnf -y install dnf-plugin-releasever-adapter --repo alinux3-plus
sudo dnf -y install docker-ce --nobest
sudo docker -v

mkdir -p /data/tools/docker

sudo tee /etc/docker/daemon.json <<-'EOF'
{
"data-root":"/data/tools/docker","registry-mirrors": ["https://3ue1wki2.mirror.aliyuncs.com"]
}
EOF
sudo systemctl enable docker
sudo systemctl daemon-reload
sudo systemctl restart docker

迁移phpserver

docker tag docker.ling2.cn/phpserver registry.cn-shanghai.aliyuncs.com/ling/phpserver

docker login --username=102010cncger@sina.com registry.cn-shanghai.aliyuncs.com

docker push registry.cn-shanghai.aliyuncs.com/ling/phpserver

docker commit -m="centos base" -a="bo.wang" 0b2616b0e5a8 registry.cn-hangzhou.aliyuncs.com/ling/centos:latest

迁移mediawiki

cd /
tar -cvf mediawiki.tar  /alidata/dockerdata/mediawiki
sftp 192.168.0.223
put /mediawiki.tar /
cd /
tar –xvf mediawiki.tar
docker run --name mediawiki -it -p 73:80 \
-v /alidata/dockerdata/mediawiki/mediawiki-1.28.2:/var/www/html \
-v /alidata/dockerdata/mediawiki/images:/var/www/html/images \
-v /alidata/dockerdata/mediawiki/php/php.ini:/usr/local/etc/php/php.ini \
-v /alidata/dockerdata/mediawiki/LocalSettings.php:/var/www/html/LocalSettings.php \
 -d registry.cn-shanghai.aliyuncs.com/ling/phpserver

迁移禅道

https://hub.docker.com/r/idoop/zentao

cd /
tar -cvf zbox.tar  /alidata/dockerdata/zbox
sftp 192.168.0.223
put /zbox.tar /
cd /
tar –xvf zbox.tar
docker run -d -p 83:80 -p 3310:3306 \
       -e ADMINER_USER="root" -e ADMINER_PASSWD="Wb19831010!" \
       -e BIND_ADDRESS="false" \
       -v /alidata/dockerdata/zbox/:/opt/zbox/ \
       --name zentao \
       idoop/zentao:latest
       --add-host mail.ling2.cn:163.177.90.125 \


启动禅道时报错pid file /opt/zbox/tmp/apache/httpd.pid overwritten – Unclean shutdown of previous Apache run? 解决方法

1.echo 12345 >/opt/zbox/tmp/apache/httpd.pid

2.cat /opt/zbox/tmp/apache/httpd.pid

3.sh /opt/zbox/zbox start

develop

curl -sL https://rpm.nodesource.com/setup_18.x | sudo bash -
yum install nodejs

curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
sudo yum install yarn


 yum install java-1.8.0-openjdk
 yum install -y maven git

cd /workspace
git clone -b nginx http://robot:glpat-L_bBPSs96sXTDgsQnx1t@ling.ling2.cn:70/lowcode/amis-editor.git
cd amis-editor

安装nodejs版本 v18.19.0
npm i --registry=https://registry.npmmirror.com
npm run build


docker run --name develop -it -p 2888:2888 -p 5007:5007 -v /alidata/dockerdata/repository:/workspace/repository -v /alidata/dockerdata/develop/node_modules1:/workspace/node_modules -d registry.cn-shanghai.aliyuncs.com/ling/centos7-develop:1.0

nginx

yum install -y nginx
cd /etc/nginx/conf.d/


tail -f /var/log/nginx/

develop.conf

    server {
        listen       80;
        listen       443 ssl;
        server_name  develop.ling2.cn;

        charset utf-8;
        location ^~/api/ {
           proxy_set_header   Host             $host;
           proxy_set_header   X-Real-IP        $remote_addr;
           proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
           rewrite ^/api/(.*)$ /$1 break;
           proxy_pass http://localhost:5007;
           proxy_set_header Upgrade $http_upgrade;
           proxy_set_header Connection "upgrade";
           client_max_body_size    1000m;
        }
        location /editor/ {
          alias  /workspace/amis-editor/demo-ling/;
          index  index.html index.htm;
          proxy_set_header   Host             $host;
          proxy_set_header   X-Real-IP        $remote_addr;
          proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        }
        location / {
          proxy_pass http://localhost:2888/;
          proxy_set_header   Host             $host;
          proxy_set_header   X-Real-IP        $remote_addr;
          proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
          client_max_body_size    1000m;
        }
        ssl_certificate      /etc/letsencrypt/live/wiki.ling2.cn/fullchain.pem;
        ssl_certificate_key  /etc/letsencrypt/live/wiki.ling2.cn/privkey.pem;
    }

wiki.conf

    server {
        listen       80;
        listen       443 ssl;
        server_name  wiki.ling2.cn;

        charset utf-8;

        location / {
          proxy_pass http://192.168.0.223:73/;
          #proxy_pass http://qunhui.ling2.cn:73/;
          proxy_set_header   Host             $host;
          proxy_set_header   X-Real-IP        $remote_addr;
          proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
          client_max_body_size    1000m;
        }
        ssl_certificate      /etc/letsencrypt/live/wiki.ling2.cn/fullchain.pem;
        ssl_certificate_key  /etc/letsencrypt/live/wiki.ling2.cn/privkey.pem;
    }

zentao.conf

    server {
        listen       80;
        listen       443 ssl;
        server_name  zentao.ling2.cn;
        charset utf-8;

        location /zentao/ {
           proxy_redirect  off;
           proxy_set_header   Host             $host;
           proxy_set_header   X-Real-IP        $remote_addr;
           proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
           proxy_pass http://192.168.0.223:83/zentao/;
           proxy_set_header Upgrade $http_upgrade;
           proxy_set_header Connection "upgrade";
           client_max_body_size    1000m;
        }
        ssl_certificate      /etc/letsencrypt/live/wiki.ling2.cn/fullchain.pem;
        ssl_certificate_key  /etc/letsencrypt/live/wiki.ling2.cn/privkey.pem;
    }

shshengzhen

    server {
        listen       80;
        listen       443 ssl;
        server_name  www.shshenzhen.cn;

        charset utf-8;

        location / {
          root /alidata/laojia/;
          index  index.html index.htm;
          proxy_set_header   Host             $host;
          proxy_set_header   X-Real-IP        $remote_addr;
          proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        }
        ssl_certificate      /etc/letsencrypt/live/wiki.ling2.cn/fullchain.pem;
        ssl_certificate_key  /etc/letsencrypt/live/wiki.ling2.cn/privkey.pem;
    }
    server {
        listen       80;
        listen       443 ssl;
        server_name  shshenzhen.ling2.cn;

        charset utf-8;

        location / {
          root /alidata/laojia/;
          index  index.html index.htm;
          proxy_set_header   Host             $host;
          proxy_set_header   X-Real-IP        $remote_addr;
          proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        }
        ssl_certificate      /etc/letsencrypt/live/wiki.ling2.cn/fullchain.pem;
        ssl_certificate_key  /etc/letsencrypt/live/wiki.ling2.cn/privkey.pem;
    }

证书申请

https://blog.csdn.net/Richardlcx/article/details/132282722


停止nginx

nginx -s stop


yum install -y certbot
sudo certbot certonly --standalone --email 102010cncger@sina.com -d wiki.ling2.cn -d zentao.ling2.cn -d develop.ling2.cn


sudo certbot certonly --standalone --email 102010cncger@sina.com -d www.ling2.cn -d wiki.ling2.cn -d nexus.ling2.cn -d docker.ling2.cn -d rabbitmq.ling2.cn -d mantis.ling2.cn -d gitlab.ling2.cn -d gitlabssh.ling2.cn -d jenkins.ling2.cn -d kafka.ling2.cn  -d opencron.ling2.cn -d ivs.ling2.cn -d tuleap.ling2.cn -d minio.ling2.cn -d onlyoffice.ling2.cn -d oracle.ling2.cn -d zipkin.ling2.cn -d sonar.ling2.cn -d jira.ling2.cn  -d docservice.ling2.cn -d cloud.ling2.cn -d pay.ling2.cn -d elasticSearchdict.ling2.cn -d elasticSearch.ling2.cn -d document.ling2.cn -d onlyoffice.ling2.cn -d zy.ling2.cn -d dwct.ling2.cn -d md.ling2.cn -d dwctadmin.ling2.cn -d idp.ling2.cn -d idpapi.ling2.cn -d laojia.ling2.cn -d laojiaadmin.ling2.cn -d maxkey.ling2.cn -d maxkeymgt.ling2.cn -d nextcloud.ling2.cn -d lp.ling2.cn -d zentao.ling2.cn -d synology.ling2.cn -d css.ling2.cn -d develop.ling2.cn