Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用portainer部署升级出现问题。 || There is a problem using portainer to deploy and upgrade. #372

Open
phantasy36 opened this issue Dec 24, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@phantasy36
Copy link

phantasy36 commented Dec 24, 2024

Describe the bug
我每次在portainer的stacks中使用docker compose脚本升级都出现数据库无法连接的错误。如果将原有永久化文件夹的数据全部删除后重新部署才行。

To Reproduce
Steps to reproduce the behavior:
升级步骤

  1. 进入portainer的stacks菜单中。
  2. 进入stacks中的脚本编辑页面。
  3. 点击页面底部的update stacks。
    4.激活re-pull image and redeploy按钮,重新拉取最新镜像。
  4. 点击update,开始重新拉取镜像,并使用运行docker compose脚本运行最新版本blinko。
  5. 提示部署成功后出现问题。

Expected behavior
部署成功后提示前端无法连接postgresql数据库。

Screenshots
{58800065-946D-450E-BE67-677DE9044E24}
数据库运行正常。
{E0841D3E-2B98-440E-BB90-7F00ABF9DCCC}

Desktop (please complete the following information):

  • OS: 群晖DMS7.2
  • Browser: edge
  • Version: 131.0.2903.112

Docker compose
networks: blinko-network: driver: bridge services: blinko-website: image: blinkospace/blinko:latest container_name: blinko-website environment: NODE_ENV: production # NEXTAUTH_URL: http://localhost:1111 # NEXT_PUBLIC_BASE_URL: http://localhost:1111 NEXTAUTH_SECRET: my_ultra_secure_nextauth_secret DATABASE_URL: postgresql://postgres:Huhong@postgres:5432/postgres depends_on: postgres: condition: service_healthy # Make sure you have enough permissions. volumes: - /volume5/docker/blinko:/app/.blinko restart: always logging: options: max-size: "10m" max-file: "3" ports: - 1111:1111 healthcheck: test: ["CMD", "curl", "-f", "http://blinko-website:1111/"] interval: 30s timeout: 10s retries: 5 start_period: 30s networks: - blinko-network postgres: image: postgres:14 container_name: blinko-postgres restart: always ports: - 5435:5432 environment: POSTGRES_DB: postgres POSTGRES_USER: postgres POSTGRES_PASSWORD: Huhong TZ: Asia/Shanghai # Persisting container data # Make sure you have enough permissions. volumes: - /volume5/docker/postgresql:/var/lib/postgresql/data healthcheck: test: ["CMD", "pg_isready", "-U", "postgres", "-d", "postgres"] interval: 5s timeout: 10s retries: 5 networks: - blinko-network


Describe the bug
Every time I use the docker compose script to upgrade in portainer's stacks, I get an error that the database cannot be connected. It will only work if you delete all the data in the original permanent folder and then redeploy it.

To Reproduce
Steps to reproduce the behavior:
Upgrade steps

  1. Enter portainer’s stacks menu.
  2. Enter the script editing page in stacks.
  3. Click update stacks at the bottom of the page.
  4. Activate the re-pull image and redeploy button to re-pull the latest image.
  5. Click update to start pulling the image again, and use the docker compose script to run the latest version of blinko.
  6. It prompts that a problem occurred after the deployment was successful.

Expected behavior
After successful deployment, it prompts that the front end cannot connect to the postgresql database.

Screenshots
<img width="834" alt="{58800065-946D-450E-BE67-677DE9044E24}" src="https://github.com/user-attachments/assets/14d256fc-e847-4ed3-8c22-e83c12b1d8fa" / >
The database is running normally.
<img width="350" alt="{E0841D3E-2B98-440E-BB90-7F00ABF9DCCC}" src="https://github.com/user-attachments/assets/399a2f85-108b-4d1e-ab02-3622010250e5" / >

Desktop (please complete the following information):

  • OS: Synology DMS7.2
  • Browser: edge
  • Version: 131.0.2903.112

Docker compose
networks: blinko-network: driver:bridge services: blinko-website: image: blinkospace/blinko:latest container_name: blinko-website environment: NODE_ENV: production # NEXTAUTH_URL: http://localhost:1111 # NEXT_PUBLIC_BASE_URL: http://localhost:1111 NEXTAUTH_SECRET: my_ultra_secure_nextauth_secret DATABASE_URL: postgresql://postgres:Huhong@postgres:5432/postgres depends_on: postgres: condition: service_healthy # Make sure you have enough permissions. volumes: - /volume5/docker/blinko:/app/.blinko restart: always logging: options: max-size: "10m" max-file: "3" ports: - 1111:1111 healthcheck: test: ["CMD", "curl", "-f", "http://blinko-website:1111/"] interval: 30s timeout: 10s retries: 5 start_period: 30s networks: -blinko-network postgres: image: postgres:14 container_name: blinko-postgres restart: always ports: - 5435:5432 environment: POSTGRES_DB: postgres POSTGRES_USER: postgres POSTGRES_PASSWORD: Huhong TZ: Asia/Shanghai # Persisting container data # Make sure you have enough permissions. volumes: - /volume5/docker/postgresql:/var/lib/postgresql/data healthcheck: test: ["CMD", "pg_isready", "-U", "postgres", "-d", "postgres"] interval: 5s timeout: 10s retries: 5 networks: -blinko-network

@github-actions github-actions bot changed the title 使用portainer部署升级出现问题。 使用portainer部署升级出现问题。 || There is a problem using portainer to deploy and upgrade. Dec 24, 2024
Copy link

dosubot bot commented Dec 24, 2024

@phantasy36 你好!我是Dosu,我是一个可以帮助你解决问题,回答你的问题,并成为贡献者的机器人。我在这里帮助你,等待人类维护者。

To resolve the database connection issue during upgrades in Portainer, ensure the following configurations are correct:

  1. Volume Persistence: Make sure the PostgreSQL data is correctly persisted. Your current setup uses:

    volumes:
      - /volume5/docker/postgresql:/var/lib/postgresql/data

    This should persist the data across container restarts and upgrades. Verify that the /volume5/docker/postgresql directory has the correct permissions and is not being cleared during the upgrade process.

  2. Port Configuration: Ensure that the ports are correctly mapped. The postgres service is mapped from 5435 to 5432. Ensure that your DATABASE_URL in the blinko-website service reflects this mapping:

    DATABASE_URL: postgresql://postgres:Huhong175@postgres:5435/postgres
  3. Network Configuration: Both services should be on the same network (blinko-network) to communicate properly, which you have configured correctly.

  4. Health Checks: Ensure that the health checks are functioning correctly. The postgres service should pass its health check before the blinko-website service attempts to connect.

  5. Prisma Connection Error: The error code P1001 suggests a connection issue. Double-check that the DATABASE_URL is correct and matches the actual running configuration of your PostgreSQL service.

  6. Re-pull and Redeploy: When using the "re-pull image and redeploy" option, ensure that the new image is compatible with your existing data schema. If there are schema changes, you might need to run migrations.

By ensuring these configurations are correct, you should be able to resolve the connection issues during upgrades.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot dosubot bot added the bug Something isn't working label Dec 24, 2024
@phantasy36
Copy link
Author

phantasy36 commented Dec 24, 2024

还是一样提示连接不上数据库。
{5DB3D0B8-7D69-4FD7-9A99-9243BA853D91}


Still prompts that the database cannot be connected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant