Dokploy / dokploy

Open Source Alternative to Vercel, Netlify and Heroku.
https://dokploy.com/
Other
9.76k stars 486 forks source link

GhostCMS Template broken #774

Open SlavenIvanov opened 4 days ago

SlavenIvanov commented 4 days ago

To Reproduce

  1. In a Dokploy project click "Create Service"
  2. Pick "Template"
  3. Pick Ghost and click "Create"
  4. Pick the default server
  5. Navigate into the "Ghost" service
  6. Click "Deploy"
  7. Navigate to the "Domains" section and click on the *.traefik.me link

You get a 404 Not Found

In the GhostCMS logs are

----------------------------------------

Error: connect ECONNREFUSED 10.0.1.12:3306
    at /var/lib/ghost/versions/5.101.2/node_modules/knex-migrator/lib/database.js:134:19
    at /var/lib/ghost/versions/5.101.2/node_modules/knex-migrator/lib/database.js:57:19
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)

[2024-11-28 11:32:27] WARN Ghost is shutting down
[2024-11-28 11:32:27] WARN Ghost has shut down
[2024-11-28 11:32:27] WARN Your site is now offline
[2024-11-28 11:32:27] WARN Ghost was running for a few seconds
[2024-11-28 11:32:54] INFO Ghost is running in production...
[2024-11-28 11:32:54] INFO Your site is now available on http://playground-ghost-fc179e-188-245-166-181.traefik.me/
[2024-11-28 11:32:54] INFO Ctrl+C to shut down
[2024-11-28 11:32:54] INFO Ghost server started in 0.756s
[2024-11-28 11:32:54] WARN Database state requires initialisation.
[2024-11-28 11:32:54] ERROR connect ECONNREFUSED 10.0.1.12:3306

connect ECONNREFUSED 10.0.1.12:3306

"Unknown database error"

Error ID:
    500

Error Code: 
    DATABASE_CREATION_FAILED

----------------------------------------

Error: connect ECONNREFUSED 10.0.1.12:3306
    at /var/lib/ghost/versions/5.101.2/node_modules/knex-migrator/lib/database.js:134:19
    at /var/lib/ghost/versions/5.101.2/node_modules/knex-migrator/lib/database.js:57:19
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)

[2024-11-28 11:32:54] WARN Ghost is shutting down
[2024-11-28 11:32:54] WARN Ghost has shut down
[2024-11-28 11:32:54] WARN Your site is now offline
[2024-11-28 11:32:54] WARN Ghost was running for a few seconds

And the MySQL db logs are

2024-11-28T11:31:44.835399Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.40) initializing of server in progress as process 79
2024-11-28T11:31:44.843719Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-11-28T11:31:45.414150Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-11-28T11:31:48.190353Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2024-11-28 11:31:51+00:00 [Note] [Entrypoint]: Database files initialized
2024-11-28 11:31:51+00:00 [Note] [Entrypoint]: Starting temporary server
2024-11-28T11:31:52.384429Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
2024-11-28T11:31:52.395072Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.40) starting as process 121
2024-11-28T11:31:52.458789Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-11-28T11:31:52.892738Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-11-28T11:31:53.314717Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2024-11-28T11:31:53.314784Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2024-11-28T11:31:53.323416Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2024-11-28T11:31:53.345840Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.40'  socket: '/var/run/mysqld/mysqld.sock'  port: 0  MySQL Community Server - GPL.
2024-11-28T11:31:53.345928Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: /var/run/mysqld/mysqlx.sock
2024-11-28 11:31:53+00:00 [Note] [Entrypoint]: Temporary server started.
'/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.

2024-11-28 11:31:56+00:00 [Note] [Entrypoint]: Stopping temporary server
2024-11-28T11:31:56.400371Z 10 [System] [MY-013172] [Server] Received SHUTDOWN from user root. Shutting down mysqld (Version: 8.0.40).
2024-11-28T11:31:57.913820Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.40)  MySQL Community Server - GPL.
2024-11-28 11:31:58+00:00 [Note] [Entrypoint]: Temporary server stopped

2024-11-28 11:31:58+00:00 [Note] [Entrypoint]: MySQL init process done. Ready for start up.

2024-11-28T11:31:58.917038Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
2024-11-28T11:31:58.921241Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.40) starting as process 1
2024-11-28T11:31:58.938354Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-11-28T11:31:59.287851Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-11-28T11:31:59.568856Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2024-11-28T11:31:59.568985Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2024-11-28T11:31:59.583613Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2024-11-28T11:31:59.612568Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.40'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.
2024-11-28T11:31:59.612611Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock

Current vs. Expected behavior

I get a 404 on the website, and the site should be running

Provide environment information

Default Ubuntu x86 24.04 Hetzner VPS
Dokploy Version: v0.12.0

Which area(s) are affected? (Select all that apply)

Application, Databases, Docker Compose

Are you deploying the applications where Dokploy is installed or on a remote server?

Same server where Dokploy is installed

Additional context

I am loving Dokploy so far! Thank you for your work!

Will you send a PR to fix it?

Maybe, need help

Siumauricio commented 3 days ago

Strange I created a clean ghost template and is working without issues

image image image image

SlavenIvanov commented 3 days ago

Strange. The only thing I updated in my Dokploy instance was adding a custom domain. Do you think that might be the cause? I will try doing a clean install of Dokploy on a new VPS and come back to you.

SlavenIvanov commented 3 days ago

I was able to reproduce it on version Version: v0.13.1 If I setup the VPS and skip adding a Dokploy custom domain it works. After I add the domain:

  1. Add A record in DNS provider pointing to the VPS IP

  2. In Dokploy add the new domain (e.g. dokploy.****.com)

  3. Enter Lets Encrypt email

  4. Select Lets Encrypt certificate

  5. Save

  6. Reload server (works)

  7. Reload traefik (fails with 520 error ) (not sure if that is related)

    Screenshot 2024-11-29 at 10 29 17
  8. Test to see if the domain setting works by visiting dokploy.****.com (which loads successfully)

  9. Go through all steps in the Bug description I get this error when visiting the autogenerated ghost link:

    Screenshot 2024-11-29 at 10 25 47

And in the application logs I get:

Error: connect ECONNREFUSED 10.0.1.20:3306
    at /var/lib/ghost/versions/5.101.4/node_modules/knex-migrator/lib/database.js:57:19
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)

[2024-11-29 08:15:19] WARN Ghost is shutting down
[2024-11-29 08:15:19] WARN Ghost has shut down
[2024-11-29 08:15:19] WARN Your site is now offline
[2024-11-29 08:15:19] WARN Ghost was running for a few seconds
[2024-11-29 08:15:22] INFO Ghost is running in production...
[2024-11-29 08:15:22] INFO Your site is now available on http://newplayground-ghost-2d9fc7-135-181-201-15.traefik.me/
[2024-11-29 08:15:22] INFO Ctrl+C to shut down
[2024-11-29 08:15:22] INFO Ghost server started in 1.263s
[2024-11-29 08:15:23] INFO Database is in a ready state.
[2024-11-29 08:15:23] INFO Ghost database ready in 2.025s
[2024-11-29 08:15:24] WARN Missing mail.from config, falling back to a generated email address. Please update your config file and set a valid from address
[2024-11-29 08:15:24] ERROR Unhandled rejection: connect ECONNREFUSED 10.0.1.20:3306

connect ECONNREFUSED 10.0.1.20:3306

Error Code: 
    ECONNREFUSED

----------------------------------------

Error: connect ECONNREFUSED 10.0.1.20:3306
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)

[2024-11-29 08:15:26] INFO Invalidating assets for regeneration
[2024-11-29 08:15:27] INFO Adding offloaded job to the inline job queue
[2024-11-29 08:15:27] INFO Scheduling job mentions-email-report at 52 10 * * * *. Next run on: Fri Nov 29 2024 09:10:52 GMT+0000 (Coordinated Universal Time)
[2024-11-29 08:15:27] INFO Adding offloaded job to the inline job queue
[2024-11-29 08:15:27] INFO Scheduling job clean-expired-comped at 13 30 3 * * *. Next run on: Sat Nov 30 2024 03:30:13 GMT+0000 (Coordinated Universal Time)
[2024-11-29 08:15:27] INFO Adding offloaded job to the inline job queue
[2024-11-29 08:15:27] INFO Scheduling job clean-tokens at 30 47 13 * * *. Next run on: Fri Nov 29 2024 13:47:30 GMT+0000 (Coordinated Universal Time)
[2024-11-29 08:15:27] INFO Ghost booted in 6.211s
[2024-11-29 08:15:27] INFO Adding offloaded job to the inline job queue
[2024-11-29 08:15:27] INFO Scheduling job update-check at 58 22 23 * * *. Next run on: Fri Nov 29 2024 23:22:58 GMT+0000 (Coordinated Universal Time)
[2024-11-29 08:15:27] INFO Running milestone emails job on Sat Nov 30 2024 08:15:27 GMT+0000 (Coordinated Universal Time)
[2024-11-29 08:16:57] INFO Updating incoming recommendations on boot
[2024-11-29 08:21:26] INFO [Recommendations] Updating recommendations metadata

And for db logs:

2024-11-29T08:15:05.255037Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.40) initializing of server in progress as process 78
2024-11-29T08:15:05.271145Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-11-29T08:15:05.997698Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-11-29T08:15:08.499237Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2024-11-29 08:15:14+00:00 [Note] [Entrypoint]: Database files initialized
2024-11-29 08:15:14+00:00 [Note] [Entrypoint]: Starting temporary server
2024-11-29T08:15:14.695042Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
2024-11-29T08:15:14.700852Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.40) starting as process 120
2024-11-29T08:15:14.744467Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-11-29T08:15:15.223209Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-11-29T08:15:15.708514Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2024-11-29T08:15:15.708595Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2024-11-29T08:15:15.713954Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2024-11-29T08:15:15.756355Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: /var/run/mysqld/mysqlx.sock
2024-11-29T08:15:15.756866Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.40'  socket: '/var/run/mysqld/mysqld.sock'  port: 0  MySQL Community Server - GPL.
2024-11-29 08:15:15+00:00 [Note] [Entrypoint]: Temporary server started.
'/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.

2024-11-29 08:15:21+00:00 [Note] [Entrypoint]: Stopping temporary server
2024-11-29T08:15:21.302368Z 10 [System] [MY-013172] [Server] Received SHUTDOWN from user root. Shutting down mysqld (Version: 8.0.40).
2024-11-29T08:15:22.549086Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.40)  MySQL Community Server - GPL.
2024-11-29 08:15:23+00:00 [Note] [Entrypoint]: Temporary server stopped

2024-11-29 08:15:23+00:00 [Note] [Entrypoint]: MySQL init process done. Ready for start up.

2024-11-29T08:15:23.938656Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
2024-11-29T08:15:23.943666Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.40) starting as process 1
2024-11-29T08:15:23.957410Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-11-29T08:15:24.403911Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-11-29T08:15:24.805998Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2024-11-29T08:15:24.806238Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2024-11-29T08:15:24.815638Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2024-11-29T08:15:24.862809Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
2024-11-29T08:15:24.864464Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.40'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.