带 PostgreSQL 数据库的 Remotely docker-compose 配置

docker_compose_remotely.yml
services:
  postgres:
    image: postgres
    restart: unless-stopped
    volumes:
      - ./pg_data:/var/lib/postgresql/data
    environment:
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      - POSTGRES_DB=remotely
      - POSTGRES_USER=remotely
  remotely:
    image: immybot/remotely:latest
    restart: unless-stopped
    ports:
      - 38192:5000
    environment:
      - ASPNETCORE_ENVIRONMENT=Production
      - ASPNETCORE_HTTP_PORTS=5000
      - Remotely_ApplicationOptions__DbProvider=PostgreSQL
      - Remotely_ConnectionStrings__PostgreSQL=Host=postgres;Database=remotely;Username=remotely;Password=${POSTGRES_PASSWORD};
    volumes:
      - ./remotely_data:/app/AppData
    depends_on:
      - postgres

现在创建 .env 文件并使用随机 Postgres 密码:

create_env_file.sh
echo "POSTGRES_PASSWORD=$(pwgen 30 1)" >> .env

然后运行 docker-compose up -d 启动服务。现在你可以通过 http://localhost:38192 访问 Remotely。


Check out similar posts by category: Docker, DevOps