Closed raspberrycoulis closed 2 years ago
See https://github.com/docker-library/ghost/pull/323#issuecomment-1212554428 (temporary solutions are to downgrade to 5.8 or add those environment variables - long term solution is to migrate to MySQL).
Thanks @tianon - I just found that after digging around various other posts and complaints about the same issue.
Sorry, but how would I go about migrating to MySQL? I've been running my blogs using the Docker image, so I've not even set the database to anything. Whilst adding the variables to use sqlite3 does fix my issue temporarily, is there a way to migrate my site to MySQL other than starting it in a new container and importing the content again?
I actually have the same issue with 5.14.1-alpine
The Ghost container cannot connect to the MySQL server. (err 500 etc.. as same as raspberrycoulis)
How can I fix it ? Why this issue is closed ?
version: '3.1'
services:
ghost:
image: ghost:5.14.1-alpine
restart: always
user: 1003:1003
ports:
- 2368:2368
volumes:
- ./ghost:/var/lib/ghost/content:rw
environment:
database__client: mysql
database__connection__host: db
database__connection__user: root
database__connection__password: TheBigPassword
database__connection__database: ghost
url: https://domain.com
db:
image: mysql:8.0
restart: always
environment:
MYSQL_ROOT_PASSWORD: TheBigPassword
@edrcq - I ended up migrating to MySQL instead. If you're interested in knowing how, I published this guide on my Ghost related blog which might be helpful.
@raspberrycoulis when I tried to access your blog
@raspberrycoulis when I tried to access your blog
Hmm, odd. What country do you live in? Might be a Cloudflare thing...
Brazil, I`ll try run a test with a vpn
Brazil, I`ll try run a test with a vpn
Ah, yes. Brazil was on my block list because I noticed quite a few people attempting to do something shady with IP's from Brazil. It should be more lenient now if you wanted to try again.
Ouch, people here are easy target for mirroring and attack networks, we are trying to improve our digital education, to avoid that.
Now it's working perfectly, thanks 😊
Hi, I am having the same issue as reported above. My compose:
version: "3.7"
services:
ghost:
container_name: ghost
image: ghost:latest
volumes:
- ./ghost/content:/var/lib/ghost/content
environment:
#- url=${BLOG_URL}
- TZ=${TZ}
- database__client=mysql
- database__connection__host=mysql
- database__connection__user=${MYSQL_USER}
- database__connection__password=${MYSQL_PSW}
- database__connection__database=${MYSQL_DB}
ports:
- 2368:2368
depends_on:
- mysql
restart: unless-stopped
mysql:
container_name: ghost-db
image: 'mysql:latest'
volumes:
- ./mysql:/var/lib/mysql
cap_add:
- SYS_NICE
environment:
- MYSQL_ROOT_HOST=172.*.*.*
- MYSQL_ROOT_PASSWORD=${MYSQL_PSW}
- MYSQL_DATABASE=${MYSQL_DB}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PSW}
restart: unless-stopped
Any idea? :(
@AlexKalopsia yes, read the comments in this thread. I said the following previously:
@edrcq - I ended up migrating to MySQL instead. If you're interested in knowing how, I published this guide on my Ghost related blog which might be helpful.
@raspberrycoulis I am actually following your guide (thank you), and still having the same issue. I can't even seem to be able to run ghost+mysql8 before migrating the content
[2022-12-29 11:42:07] INFO Ghost is running in production...
[2022-12-29 11:42:07] INFO Your site is now available on http://localhost:2368/
[2022-12-29 11:42:07] INFO Ctrl+C to shut down
[2022-12-29 11:42:07] INFO Ghost server started in 21.428s
[2022-12-29 11:42:10] ERROR Invalid database host.
Invalid database host.
"Please double check your database config."
Error ID:
500
Error Code:
ENOTFOUND
----------------------------------------
Error: getaddrinfo ENOTFOUND mysql
at /var/lib/ghost/versions/5.26.3/node_modules/knex-migrator/lib/database.js:50:23
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:109:26)
[2022-12-29 11:42:10] WARN Ghost is shutting down
[2022-12-29 11:42:10] WARN Ghost has shut down
[2022-12-29 11:42:10] WARN Your site is now offline
[2022-12-29 11:42:10] WARN Ghost was running for a few seconds
That looks like a different issue then. I'd check that your database is working first. It might also be worth checking that the folder for your db is completely empty as there are hidden files in there. That stopped mine from working as well. Think it's in my guide. If you've done all that and it wasn't working before then it may be a different issue.
mmm yeah the msql container definitely shows something odd is happening
2022-12-29T11:49:31.701390Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31) MySQL Community Server - GPL.
2022-12-29 11:49:55+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.31-1.el8 started.
2022-12-29 11:49:56+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-12-29 11:49:56+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.31-1.el8 started.
2022-12-29 11:49:56+00:00 [Note] [Entrypoint]: Initializing database files
2022-12-29T11:49:56.953377Z 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.
2022-12-29T11:49:56.953586Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.31) initializing of server in progress as process 80
2022-12-29T11:49:56.958769Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2022-12-29T11:49:56.958784Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
2022-12-29T11:49:56.959374Z 0 [ERROR] [MY-010119] [Server] Aborting
EDIT: ok, seems like there is a mysql.sock
file that Windows is not showing me in the file explorer, that might be it
so, I actually had to fully remove the mysql
folder and create a new one, then it unlocked the initialization process.
Sadly it still results in
[2022-12-29 12:09:26] INFO Ghost is running in production...
[2022-12-29 12:09:26] INFO Your site is now available on http://localhost:2368/
[2022-12-29 12:09:26] INFO Ctrl+C to shut down
[2022-12-29 12:09:26] INFO Ghost server started in 1.745s
[2022-12-29 12:09:27] ERROR connect ECONNREFUSED 172.30.0.2:3306
connect ECONNREFUSED 172.30.0.2:3306
"Unknown database error"
Error ID:
500
Error Code:
ECONNREFUSED
----------------------------------------
Error: connect ECONNREFUSED 172.30.0.2:3306
at /var/lib/ghost/versions/5.26.3/node_modules/knex-migrator/lib/database.js:57:19
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
[2022-12-29 12:09:27] WARN Ghost is shutting down
[2022-12-29 12:09:27] WARN Ghost has shut down
[2022-12-29 12:09:27] WARN Your site is now offline
[2022-12-29 12:09:27] WARN Ghost was running for a few seconds
It looks as if ghost container is unable to communicate with the other container
@AlexKalopsia i think your root password for the db has to be different to the standard user password.
@AlexKalopsia I had this problem too. This solution was very simple, just wait. It takes a long time for the database to initialize the first time. More than 5 minutes for me, maybe even 10. And then Ghost will install, which took another 20 minutes.
Definitely what @rubenhensen said. I even mentioned this in my linked guide @AlexKalopsia (that the DB takes some time to initialise)…
On the first boot, you may see a few errors whilst the database is created - give it a couple of minutes and you should start to see the Ghost container creating the necessary database entries before finally telling you the blog is available via the URL you specified.
So, I've been running my three blogs without any issues for the past few years (self hosted on Synology NAS using Docker), but after updating to the latest alpine image, all three blogs shutdown whilst reporting the following issue:
This is also mentioned on the forums but without any solution as of yet.
I've tried reverting to
ghost:5.10.1-alpine
andghost:5.10-alpine
images, but the issue persists.