Guide
Our GeekAI Quick Deployment Tutorial is designed for new installations only, as it will clear all existing data tables. However, if you have already installed GeekAI and only need a smooth upgrade, what should you do? It's simple—just follow these two steps.
1. Upgrade the Database
If there is a database upgrade, we will prepare a update-x.x.x.sql
file for each version.
You only need to execute the SQL file for the version you are upgrading to.
Non-Container Deployment
First, you need to install the MySQL client (skip this step if already installed):
sudo apt install mysql-client
Connect to the database. By default, our MySQL container maps to port 3307, so you need to pass the --port
parameter as 3307. If you changed the port, use your custom port:
mysql -h127.0.0.1 --port 3307 -u username -p password # Connect to the database
use chatgpt_plus
source update-x.x.x.sql # Replace with the version you are upgrading to
Container Deployment
docker exec -i geekai-mysql sh -c 'exec mysql -uroot -p12345678 -D chatgpt_plus' < update-x.x.x.sql
Note:
If you are upgrading across multiple versions, you need to execute the intermediate update
SQL files in order. For example, if upgrading from 3.2.0 to 3.2.3, you need to execute update-v3.2.1.sql
, update-v3.2.2.sql
, and update-v3.2.3.sql
in sequence.
2. Upgrade the Image
Modify the docker-compose.yaml
file to update the version numbers for geekai-api
and geekai-web
:
version: '3'
services:
# mysql
geekai-mysql:
image: mysql:8.0.33
container_name: geekai-mysql
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
- MYSQL_ROOT_PASSWORD=12345678
ports:
- '3307:3306'
volumes:
- ./mysql/conf/my.cnf:/etc/mysql/my.cnf
- ./mysql/data:/var/lib/mysql
- ./mysql/logs:/var/log/mysql
- ./mysql/init.d:/docker-entrypoint-initdb.d/
# redis
geekai-redis:
image: redis:6.0.16
restart: always
container_name: geekai-redis
command: redis-server --requirepass 12345678
volumes:
- ./redis/data:/data
ports:
- '6380:6379'
# Backend API
geekai-api:
image: registry.cn-shenzhen.aliyuncs.com/geekmaster/geekai-api:v4.0.9-amd64 # Update the version here
container_name: geekai-api
restart: always
depends_on:
- geekai-mysql
- geekai-redis
environment:
- DEBUG=false
- LOG_LEVEL=info
- CONFIG_FILE=config.toml
ports:
- '5678:5678'
- '9999:9999'
volumes:
- /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime
- ./conf/config.toml:/var/www/app/config.toml
- ./logs:/var/www/app/logs
- ./static:/var/www/app/static
# Frontend Application
geekai-web:
image: registry.cn-shenzhen.aliyuncs.com/geekmaster/geekai-web:v4.0.9-amd64 # Update the version here
container_name: geekai-web
restart: always
depends_on:
- geekai-api
ports:
- '8080:8080'
volumes:
- ./logs/nginx:/var/log/nginx
- ./conf/nginx/conf.d:/etc/nginx/conf.d
- ./conf/nginx/nginx.conf:/etc/nginx/nginx.conf
- ./ssl:/etc/nginx/ssl
3. Add New Configurations
If this upgrade includes new configurations, you also need to modify the conf/config.toml
file. You can compare it with the default configuration file deploy/conf/config.toml
to identify any new configuration options.
4. Restart the Services
# Stop the services
docker-compose down
# Start the services
docker-compose up -d