Hello,
I am looking to dockerize your product such that it deploys ghost on a ubuntu container (What your product actually is built for). My goals are:
1- the docker image to must be able to run docker-cli commands just like as if it was installed on an ubuntu server
2- Must connect to external services (Mysql & Nginx) or run self contained (sqlite and other services)
3- Must be configurable to run in development (Sqlite) and production (Mysql)
Over the past few days, I’ve run into a few issues along the way but been able to overcome them.
I am currently at the point where it’s trying to initialize the DB but failing. (Because I’ve really done a barebones ghost install in order to avoid any interactivity with the user so as to be able to automate it.
Currently I am able to install ghost-cli and use it to install ghost.
Having been unable to find dependencies in your package.json for ghost/ghost-cli on knex-migrator, how is that being installed and/or how should I install it? (Currently doing so manually)
Questions:
1- Do you foresee any problems with my approach? Do you think all the ghost-cli commands will actually work if I have the ghost directory mounted to a host so it can survive container restarts? For example: ghost doctor, ghost update, ghost setup etc. Do those only touch files in the ghost directory? (I am assuming that)
If this is a valid approach, can you point me or guide me to:
1- How do I determine what version of knex-migrator a particular version of ghost / ghost-cli supports? I currently hardcoded installation because I can’t understand how it’s installed (I couldn’t find references to it in the ghost / ghost-cli code). So presumably this is done afterwards manually? Unsure.
2- Can I use ghost setup or ghost config to setup the different sections of the config.json file? I don’t want to be prompted, my desire is to automatically set things up.
Some information:
my ghost install:
RUN ghost install ${GHOST_VERSION} local \
--no-prompt \
--no-stack \
--no-setup-nginx \
--no-setup-systemd \
--no-setup-mysql \
--dir "${GHOST_INSTALL_DIR}" \
--process local
produces. the following config:
config.development.json
{
"url": "http://localhost:2368",
"server": {
"port": 2368,
"host": "::"
},
"mail": {
"transport": "Direct"
},
"logging": {
"transports": [
"file",
"stdout"
]
},
"process": "systemd",
"paths": {
"contentPath": "/var/lib/ghost/content"
}
}
config.production.json
{
"url": "http://localhost:2368",
"server": {
"port": 2368,
"host": "::"
},
"mail": {
"transport": "Direct"
},
"logging": {
"transports": [
"file",
"stdout"
]
},
"process": "systemd",
"paths": {
"contentPath": "/var/lib/ghost/content"
}
}
my logs are:
[2024-11-22T14:11:19+0000]: Starting Ghost initialization...
[2024-11-22T14:11:19+0000]: Environment configured:
[2024-11-22T14:11:19+0000]: Content Directory: /var/lib/ghost/content
[2024-11-22T14:11:19+0000]: Server Port: 2368
[2024-11-22T14:11:19+0000]: Server Host: 0.0.0.0
[2024-11-22T14:11:19+0000]: URL: http://localhost:2368
[2024-11-22T14:11:19+0000]: Using SQLite database
[2024-11-22T14:11:19+0000]: Initializing SQLite database...
[2024-11-22T14:11:19+0000]: Generating Ghost configuration for development mode...
[2024-11-22T14:11:19+0000]: Initializing Ghost content...
[2024-11-22 14:11:20] ERROR An error has occurred applying a database migration.
An error has occurred applying a database migration.
Error ID:
a5d77600-a8db-11ef-95ab-739e0281c27e
----------------------------------------
TypeError: Cannot read properties of undefined (reading 'connection')
at Object.loadConfig (/var/lib/ghost/versions/5.101.2/node_modules/knex-migrator/lib/utils.js:43:15)
at Object.sanitizeDatabaseProperties (/var/lib/ghost/versions/5.101.2/core/shared/config/utils.js:64:25)
at Object.loadNconf (/var/lib/ghost/versions/5.101.2/core/shared/config/loader.js:53:16)
at Object.<anonymous> (/var/lib/ghost/versions/5.101.2/core/shared/config/index.js:3:25)
at Module._compile (node:internal/modules/cjs/loader:1356:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
at Module.load (node:internal/modules/cjs/loader:1197:32)
at Module._load (node:internal/modules/cjs/loader:1013:12)
at Module.require (node:internal/modules/cjs/loader:1225:19)
at require (node:internal/modules/helpers:177:18)
at Object.<anonymous> (/var/lib/ghost/versions/5.101.2/MigratorConfig.js:2:16)
npm notice
npm notice New minor version of npm available! 10.2.4 -> 10.9.1
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.9.1
npm notice Run npm install -g npm@10.9.1 to update!
npm notice
Thank you in advance,
Eric Gulatee