最新版部署

# 1、克隆项目到您的本地或服务器
git clone --depth=1 https://github.com/jamebal/jmal-cloud-server.git
# 或者
git clone --depth=1 https://gitee.com/jmal/jmal-cloud-server.git

# 2、进入目录
cd jmal-cloud-server

# 3、一键安装
./jc.sh install

升级

./jc.sh pull
./jc.sh update

重制管理员密码

进入mongo shell

./jc.sh mongo mongo
> use jmalcloud;
> db.getCollection('user').update({ "creator": true }, {$set: { 'password': '1000:c5b705ea13a1221f5e59110947ed806f8a978e955fbd2ed6:22508de12228c34a235454a0caf3bcaa5552858543258e56' }},{"multi": false, "upsert": false});

Ctrl + C 退出

重制后密码为:jmalcloud

v2.2.40之前的版本升级到最新版

以下步骤中, 目录 /Users/jmal/temp/jmalcloud-docker/files替换为你自己的网盘存储目录

1、备份数据库

备份到 /Users/jmal/temp/jmalcloud-docker/files/jmalcloud

docker exec -it jmalcloud /bin/bash -c 'mongodump -d jmalcloud -o /jmalcloud/files/ --gzip'

2、停止并移除容器

docker stop jmalcloud
docker rm jmalcloud

3、克隆项目

git clone --depth=1 https://gitee.com/jmal/jmal-cloud-server.git
# 进入目录
cd jmal-cloud-server
# 创建目录
mkdir -p ./docker/jmalcloud/mongodb/backup
# 把之前备份的数据库文件复制到这个目录中
cp -R '你的网盘存储目录'/jmalcloud ./docker/jmalcloud/mongodb/backup

4、创建文件 vim .env

以下是文件内容

RESOURCE_FILE_PATH=你的网盘存储目录

5、一键安装

./jc.sh init

6、安装完后恢复数据库

docker exec -it jmalcloud_mongodb /bin/bash -c 'mongorestore -d jmalcloud --dir /dump/jmalcloud --gzip'

v2.2.40之前的版本部署

拉取镜像

选个离你近的即可, 这里以广州为例

杭州: docker pull registry.cn-hangzhou.aliyuncs.com/jmalcloud/jmalcloud:2.2.35

广州: docker pull registry.cn-guangzhou.aliyuncs.com/jmalcloud/jmalcloud:2.2.35

成都: docker pull registry.cn-chengdu.aliyuncs.com/jmalcloud/jmalcloud:2.2.35

北京: docker pull registry.cn-beijing.aliyuncs.com/jmalcloud/jmalcloud:2.2.35

以下两种启动方式二选一, 推荐使用docker-compose

docker run 方式启动

docker run \
--restart=always \
--name jmalcloud \
-p 7070:80 \
-p 7071:8080 \
-p 7072:8088 \
-p 27018:27017 \
-v /Users/jmal/temp/jmalcloud-docker/files/:/jmalcloud/files/ \
-v /Users/jmal/temp/jmalcloud-docker/db/:/data/db/ \
-d registry.cn-guangzhou.aliyuncs.com/jmalcloud/jmalcloud:2.2.35

docker-compose 方式启动

编辑docker-compose.yml文件

version: "3.5"
services:
  jmalcloud:
    image: registry.cn-guangzhou.aliyuncs.com/jmalcloud/jmalcloud:2.2.35
    container_name: jmalcloud
    volumes:
      - /Users/jmal/temp/jmalcloud-docker/files/:/jmalcloud/files/
      - /Users/jmal/temp/jmalcloud-docker/db/:/data/db/
    ports:
      - "7070:80"
      - "7071:8080"
      - "7072:8088"
      - "27018:27017"

启动:在docker-compose.yml文件目录下运行以下命令

docker-compse up -d

启动参数

Port :
7070 : 网盘入口
7071 : 博客入口
7072 : 网盘api入口, 例如:http://localhost:7072/public/doc.html
27018 : MongoDB
Volume :
/jmalcloud/files/ : 网盘文件存储目录
/data/db/ : mongodb数据存储目录

访问试试看

启动后等待40秒左右,访问7070端口看到如下界面,说明部署成功

20210301截屏144.png

nginx 配置

server {
            listen 80;
            server_name  localhost;

            location / {
                    proxy_pass   http://localhost:7070;
                    proxy_set_header Host $proxy_host;
                    #下边是为获取真实IP所做的设置
                    proxy_set_header X-real-ip $remote_addr;
                    proxy_set_header    X-Forwarded-For  $proxy_add_x_forwarded_for;
                    proxy_set_header    HTTP_X_FORWARDED_FOR $remote_addr;
                    proxy_set_header    X-Forwarded-Proto $scheme;
                    proxy_redirect      default;
            }

            location /mq {
                    proxy_pass   http://localhost:7070/mq/;
                    #websocket额外配置开始
                    proxy_http_version 1.1;
                    proxy_set_header Upgrade $http_upgrade;
                    proxy_set_header Connection "upgrade";
                    proxy_connect_timeout 60s;#l连接超时时间,不能设置太长会浪费连接资源
                    proxy_read_timeout 500s;#读超时时间
                    proxy_send_timeout 500s;#写超时时间
                    #websocket额外配置结束
            }
    }