使用Docker部署OpenProject
docker方式
获取PG镜像
docker pull postgres:13
安装PG
mkdir /var/lib/postgresql/data
docker run -d -p 5432:5432 --name postgres \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=mysecretpassword \
-v /var/lib/postgresql/data:/var/lib/postgresql/data postgres:13
获取镜像
docker pull openproject/openproject:14
创建映射目录
mkdir -p /var/lib/openproject/{pgdata,assets}
创建Open Project
docker run -d -p 7080:80 --name openproject \
-e OPENPROJECT_HOST__NAME=10.60.100.4 \
-e OPENPROJECT_SECRET_KEY_BASE=MDdYycvvQF0g97K7m05dRZYqK5f1kXfG \
-e OPENPROJECT_DATABASE_URL=postgresql://postgres:mysecretpassword@10.60.100.4:5432/openproject_production \
-e OPENPROJECT_HTTPS=false \
-v /var/lib/openproject/pgdata:/var/openproject/pgdata \
-v /var/lib/openproject/assets:/var/openproject/assets \
openproject/openproject:14.3
docker-compose方式
本地创建三个文件夹
mkdir /var/lib/postgresql/data
mkdir /var/lib/openproject/data
mkdir /var/lib/openproject/static
docker-compose.yml文件
version: '3'
services:
db:
image: postgres:13
restart: always
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: mysecretpassword
POSTGRES_DB: openproject_production
volumes:
- openproject-db:/var/lib/postgresql/data
ports:
- '5432:5432'
openproject:
image: openproject/openproject:14.3
restart: always
depends_on:
- db
environment:
- OPENPROJECT_DATABASE_URL=postgresql://postgres:mysecretpassword@db/openproject_production
- OPENPROJECT_SECRET_KEY_BASE=secret
- OPENPROJECT_HOST__NAME=10.60.100.4
- OPENPROJECT_HTTPS=false
volumes:
- openproject-data:/var/lib/openproject/data
- openproject-static:/var/lib/openproject/static
ports:
- '7080:80'
volumes:
openproject-db:
openproject-data:
openproject-static: