Jam*_*111 5 postgresql circleci circleci-workflows circleci-2.0
MAX_CONNECTIONS我正在努力在 CircleCI 配置文件中配置postgres 配置。正如您在下面看到的,我尝试使用sed替换 max_connections 值,但这没有做任何事情, max_connections 保持为默认值100。我还尝试运行自定义命令(请参阅command: |下面的注释块),但这引发了以下错误并停止了circleCI进程:/docker-entrypoint.sh: line 100: exec: docker: not found Exited with code 127
version: 2
jobs:
test:
pre:
- sudo sed -i 's/max_connections = 100/max_connections = 300/g' /etc/postgresql/9.6/main/postgresql.conf # Allow more than 100 connections to DB
- sudo service postgresql restart
docker:
# Specify the version you desire here
- image: circleci/node:8.11
# Setup postgres and configure the db
- image: hegand/postgres-postgis
# command: |
# docker run --name hegand/postgres-postgis -e POSTGRES_PORT=$POSTGRES_PORT POSTGRES_PASSWORD=$POSTGRES_PASSWORD POSTGRES_DB=$POSTGRES_DB -d postgres -N 300
environment:
POSTGRES_USER: user
POSTGRES_DB: table
POSTGRES_PASSWORD: ""
POSTGRES_PORT: 5432
Run Code Online (Sandbox Code Playgroud)
在其中指定命令-image是正确的方法。您只需使用命令来启动 docker 容器,但该命令是在容器内运行的,即而不是CMDdockerfile 中的值。
我认为以下应该有效:
- image: hegand/postgres-postgis
command: postgres -c max_connections=300
Run Code Online (Sandbox Code Playgroud)
查看 CircleCI 配置参考:https://circleci.com/docs/2.0/configuration-reference/#docker