24 Commits
main ... main

Author SHA1 Message Date
val
1f1add13ee release notes 2025-10-17 17:40:48 +02:00
val
89a9b369bb chore: publish 1.1.1+6-alpine release 2025-10-17 17:40:02 +02:00
val
ccc8ee11e9 chore: publish 1.1.0+6-alpine release 2025-10-16 15:25:16 +02:00
val
900386ffa7 Merge pull request '[mass update] fix supporting multiple domains while enforcing ssl' (#4) from forceSsl into main
Reviewed-on: coop-cloud/ghost#4
2025-10-15 16:46:31 +00:00
1126e8cdf5 [mass update] fix supporting multiple domains while enforcing ssl 2025-09-08 08:11:16 -07:00
3wc
298401b27f chore: publish 1.0.1+5-alpine release 2025-09-01 15:25:59 -04:00
3wc
0b3cc6cd1e Add missing secret versions 2025-09-01 15:25:24 -04:00
val
0b22b0bab5 chore: publish 1.0.0+5-alpine release 2025-06-14 16:07:32 +02:00
val
937d84be3f Merge pull request 'version 1.0.0 - upgrade mysql db, added secret, added healthchecks' (#3) from revitalize into main
Reviewed-on: coop-cloud/ghost#3
2025-06-14 14:05:20 +00:00
val
69d6ffc2dd uncommented smtp user 2025-06-14 16:03:34 +02:00
val
7b07178bb1 how to modify env 2025-06-14 15:51:13 +02:00
val
dec5d0f89a hint on how to insert secrets 2025-06-14 15:43:44 +02:00
val
c885189143 added healthcheck and release note 2025-06-14 15:39:09 +02:00
val
3c467307fb with command 2025-06-14 11:18:17 +02:00
val
4954511131 how to ugrade mysql version from 5.7 to 8.0 2025-06-10 18:36:38 +02:00
val
71538b15a5 started versionizing 2025-06-08 14:28:49 +02:00
val
bf99dbc474 added option for matrix-synapse redirection 2025-06-08 14:27:12 +02:00
val
b4a0143cc5 upgraded mysql verison to recommended 2025-06-08 14:26:19 +02:00
0e13c185f8 Update .drone.yml 2025-01-08 10:09:12 -08:00
3wc
e2db681a2a Switch to self-hosted stack-ssh-deploy image [mass update] 2023-01-21 11:49:55 -08:00
3wc
f77001df04 Fix CI by adding networks: [mass update] 2023-01-20 11:58:41 -08:00
3wc
393122b51b Automatically generate catalogue on release [mass update]
Re: coop-cloud/recipes-catalogue-json#4
2023-01-20 10:27:11 -08:00
3wc
f58867abae Update abra syntax in examples (finally) [mass update] 2023-01-19 16:02:27 -08:00
f5fee003b3 Merge pull request 'Update Ghost to 5.2.4, add release notes, add mail config into env file' (#2) from xynosis/ghost:main into main
Reviewed-on: coop-cloud/ghost#2
2022-11-16 13:10:49 +00:00
11 changed files with 203 additions and 44 deletions

View File

@ -3,10 +3,12 @@ kind: pipeline
name: deploy to swarm-test.autonomic.zone
steps:
- name: deployment
image: decentral1se/stack-ssh-deploy:latest
image: git.coopcloud.tech/coop-cloud/stack-ssh-deploy:latest
settings:
host: swarm-test.autonomic.zone
stack: ghost
networks:
- proxy
purge: true
deploy_key:
from_secret: drone_ssh_swarm_test
@ -33,24 +35,17 @@ trigger:
---
kind: pipeline
name: recipe release
name: generate recipe catalogue
steps:
- name: release a new version
image: decentral1se/drone-abra:latest
settings:
command: recipe ghost release
deploy_key:
from_secret: abra_bot_deploy_key
- name: trigger downstream builds
image: plugins/downstream
settings:
server: https://drone.autonomic.zone
server: https://build.coopcloud.tech
token:
from_secret: decentral1se_token
from_secret: drone_abra-bot_token
fork: true
repositories:
- coop-cloud/auto-apps-json
depends_on:
- release a new version
ase a new version
- toolshed/auto-recipes-catalogue-json
trigger:
event: tag

View File

@ -1,4 +1,8 @@
#SECRET_DB_PASSWORD_VERSION=v1
#SECRET_SMTP_PASSWORD_VERSION=v1
TYPE=ghost
#IMAGE_VERSION=6.3.1
DOMAIN=ghost.example.com
@ -6,11 +10,23 @@ DOMAIN=ghost.example.com
#EXTRA_DOMAINS=', `www.ghost.example.com`'
LETS_ENCRYPT_ENV=production
## Mail settings
SECRET_DB_PASSWORD_VERSION=v1
SECRET_SMTP_PASSWORD_VERSION=v1
## Mail settings (mandatory)
#MAIL_TRANSPORT=smtp
#MAIL_FROM=admin@example.com
#MAIL_OPTIONS_HOST=mail.example.com
#MAIL_OPTIONS_PORT=587
#MAIL_OPTIONS_SECURE=false
#MAIL_OPTIONS_AUTH_USER=smtpuser@example.com
#MAIL_OPTIONS_AUTH_PASS=XXXX
## Advanced options
# see here: https://docs.ghost.org/config#number-of-connections
#DATABASE_POOL_MIN=2
#DATABASE_POOL_MAX=15
## Matrix-Synapse-Redirection
# COMPOSE_FILE="$COMPOSE_FILE:compose.matrix.yml"
# MATRIX_DOMAIN=matrix-synapse.example.com

View File

@ -1,17 +1,17 @@
# ghost
Headless Node.js CMS for professional publishing
Node.js CMS for professional publishing (headless possible).
<!-- metadata -->
* **Category**: Apps
* **Status**:
* **Image**:
* **Healthcheck**:
* **Backups**:
* **Email**: Y
* **Tests**:
* **SSO**:
* **Status**: 3, stable
* **Image**: [`ghost`](https://hub.docker.com/_/ghost), 4, upstream
* **Healthcheck**: Yes
* **Backups**: Yes
* **Email**: Yes
* **Tests**: No
* **SSO**: N/A
<!-- endmetadata -->
@ -21,10 +21,15 @@ Headless Node.js CMS for professional publishing
2. Deploy [`coop-cloud/traefik`]
3. `abra app new ${REPO_NAME} --secrets` (optionally with `--pass` if you'd like
to save secrets in `pass`)
4. `abra app YOURAPPDOMAIN config` - be sure to change `$DOMAIN` to something that resolves to
4. `abra app config YOURAPPDOMAIN` - be sure to change `$DOMAIN` to something that resolves to
your Docker swarm box, and configure mail if you intend to invite anyone else to the site
5. `abra app YOURAPPDOMAIN deploy`
5. `abra app deploy YOURAPPDOMAIN`
6. Open the configured domain in your browser to finish set-up
[`abra`]: https://git.coopcloud.tech/coop-cloud/abra
[`coop-cloud/traefik`]: https://git.coopcloud.tech/coop-cloud/traefik
## Further configuration
### Matrix-Synapse configuration
If you want to use Ghost on a top-level-domain which you want to use as matrix server name as well, just uncomment the respective section in `YOURAPPDOMAIN.env` and insert your `MATRIX_DOMAIN`

1
abra.sh Normal file
View File

@ -0,0 +1 @@
export GHOST_ENTRYPOINT_VERSION=v1

7
compose.matrix.yml Normal file
View File

@ -0,0 +1,7 @@
services:
app:
deploy:
labels:
- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirect-matrix-well-known"
- "traefik.http.middlewares.${STACK_NAME}-redirect-matrix-well-known.redirectregex.regex=^https://(.*)/.well-known/matrix/(.*)"
- "traefik.http.middlewares.${STACK_NAME}-redirect-matrix-well-known.redirectregex.replacement=https://${MATRIX_DOMAIN}/.well-known/matrix/$$2"

View File

@ -1,24 +1,36 @@
version: "3.8"
services:
app:
image: ghost:5-alpine
image: ghost:${IMAGE_VERSION:-6}-alpine
environment:
# see https://ghost.org/docs/config/#configuration-options
database__client: mysql
database__connection__host: ${STACK_NAME}_db
database__connection__user: root
database__connection__password: ghost
database__connection__database: ghost
database__connection__password_FILE: /run/secrets/db_password
database__pool__min: ${DATABASE_POOL_MIN:-0}
database__pool__max: ${DATABASE_POOL_MAX:-10}
url: https://$DOMAIN
mail__transport: ${MAIL_TRANSPORT}
mail__from: ${MAIL_FROM}
mail__options__host: ${MAIL_OPTIONS_HOST}
mail__options__port: ${MAIL_OPTIONS_PORT}
mail__options__secure: ${MAIL_OPTIONS_SECURE}
#mail__options__auth__user: ${MAIL_OPTIONS_AUTH_USER}
#mail__options__auth__pass: ${MAIL_OPTIONS_AUTH_PASS}
mail__options__auth__user: ${MAIL_OPTIONS_AUTH_USER}
mail__options__auth__pass_FILE: /run/secrets/smtp_password
# contrary to the default mentioned in the linked documentation, this image defaults to NODE_ENV=production (so development mode needs to be explicitly specified if desired)
#NODE_ENV: development
secrets:
- db_password
- smtp_password
configs:
- source: ghost_entrypoint
target: /abra-entrypoint.sh
mode: 0555
command: ["node", "current/index.js"]
entrypoint: /abra-entrypoint.sh
depends_on:
- db
networks:
- proxy
- backend
@ -35,33 +47,42 @@ services:
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
# Redirect from EXTRA_DOMAINS to DOMAIN
- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirect"
- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLForceHost=true"
- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}"
- "traefik.http.middlewares.${STACK_NAME}-redirect.redirectscheme.scheme=https"
- "traefik.http.middlewares.${STACK_NAME}-redirect.redirectscheme.permanent=true"
- "backupbot.backup=true"
- "backupbot.backup.path=/var/lib/ghost/content"
- "coop-cloud.${STACK_NAME}.version=0.1.0+5.2.4"
# healthcheck:
# test: ["CMD", "curl", "-f", "http://localhost"]
# interval: 30s
# timeout: 10s
# retries: 10
# start_period: 1m
- "coop-cloud.${STACK_NAME}.version=1.1.1+6-alpine"
healthcheck:
test: ["CMD", "wget", "--header=X-Forwarded-Proto: https", "--spider", "-q", "http://localhost:2368/ghost/api/admin/site"]
interval: 30s
timeout: 10s
retries: 10
start_period: 1m
db:
image: mysql:5.7
image: mysql:8.0
networks:
- backend
environment:
MYSQL_ROOT_PASSWORD: ghost
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/db_password
secrets:
- db_password
volumes:
- "mysql:/var/lib/mysql"
deploy:
labels:
- "backupbot.backup=true"
- "backupbot.backup.pre-hook=mysqldump -u root -pghost ghost --tab /var/lib/mysql-files/"
- "backupbot.backup.pre-hook=mysqldump -u root -p\"$$(cat /run/secrets/db_password)\" ghost --tab /var/lib/mysql-files/"
- "backupbot.backup.post-hook=rm -rf /var/lib/mysql-files/*"
- "backupbot.backup.path=/var/lib/mysql-files/"
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p\"$$(cat /run/secrets/db_password)\""]
interval: 30s
timeout: 10s
retries: 10
start_period: 1m
networks:
proxy:
external: true
@ -70,3 +91,16 @@ networks:
volumes:
mysql:
ghost_content:
secrets:
db_password:
name: ${STACK_NAME}_db_password_${SECRET_DB_PASSWORD_VERSION}
external: true
smtp_password:
external: true
name: ${STACK_NAME}_smtp_password_${SECRET_SMTP_PASSWORD_VERSION}
configs:
ghost_entrypoint:
name: ${STACK_NAME}_ghost_entrypoint_${GHOST_ENTRYPOINT_VERSION}
file: entrypoint.sh

32
entrypoint.sh Normal file
View File

@ -0,0 +1,32 @@
#!/bin/bash
set -e
file_env() {
local var="$1"
local fileVar="${var}_FILE"
local def="${2:-}"
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1
fi
local val="$def"
if [ "${!var:-}" ]; then
val="${!var}"
elif [ "${!fileVar:-}" ]; then
val="$(< "${!fileVar}")"
fi
export "$var"="$val"
unset "$fileVar"
}
file_env "database__connection__password"
file_env "mail__options__auth__pass"
# upstream entrypoint https://github.com/docker-library/ghost/blob/master/5/alpine/Dockerfile
exec /usr/local/bin/docker-entrypoint.sh "$@"

1
release/1.0.0+5-alpine Normal file
View File

@ -0,0 +1 @@
breaking change due to mysql-upgrade and secrets, checkout release-notes in release/1.0.0+5-alpine

View File

@ -0,0 +1,66 @@
# ! BREAKING CHANGE ! Attention!
There are two things you need to change manually:
1. insert secrets for mysql database and smtp
2. migrate your MySQL database from 5.7 to 8.0
## 1. insert secret
The recipe now includes two secrets: `db_password` and `smtp_password` make sure you change them.
To not break somthing, just insert `ghost` as `db_password` because this was the hard coded password before.
If desired to change the db-password, I recommend to do try it after migrating as I run in some difficult to debug problems doing this.
abra app secret insert $APP db_password v1 ghost
abra app secret insert $APP smtp_password v1 your_smtp_password
and adapt your env:
add
SECRET_DB_PASSWORD_VERSION=v1
SECRET_SMTP_PASSWORD_VERSION=v1
delete mysql and smtp-password env.
## 2. migrate your MySQL database from 5.7 to 8.0
Recipe updates MySQL version from 5.7 to 8.0 as it is the only supported version of ghost:
https://ghost.org/docs/faq/supported-databases/
This makes a manual migration necessary.
This one worked for me.
Although you create a database-backup. Better to make sure you have a full backup before.
## Follow these steps:
# set your env-var to APP_URL to not have to repeat yourself
APP_URL=queerit.org
# First make a full backup of database
abra app run "$APP_URL" db -t -- mysqldump -u root -pghost ghost > ~/.abra/backups/"$APP_URL"_pre_upgrade_to_mysql_8.sql 2>/dev/null
# undeploy
abra app undeploy "$APP_URL"
# delete database volume
abra app volume rm "$APP_URL"
# -> press "left" to deselect all, then "up"/"down" to find the volume, "space" to select "foo_bar_com_mysql, "enter" to confirm
# redeploy (with the current recipe, db version 8.0 - will recreate database volume
# attention: because the app service is restarted as well, it will reinitialize soon the database
# this can lead to errors when restoring the database. I ran into: ERROR 1050 (42S01) at line 1147: Table 'members_stripe_customers_subscriptions' already exists
# solved it be deleting the volume again and restoring the databse as soon as possible after redeploying
abra app deploy "$APP_URL"
# restore database
abra app run "$APP_URL" db -t -- mysql -u root -pghost ghost < ~/.abra/backups/"$APP_URL"_pre_upgrade_to_mysql_8.sql
# correct db by creating ALTER TABLE commands like its described here: https://ghost.org/docs/faq/supported-databases/
echo "SET foreign_key_checks=0;" > ~/.abra/backups/"$APP_URL"_alter_table.sql
abra app run ghost.dev.local-it.cloud db -t -- mysql -u root -pghost ghost -B --disable-column-names -e 'SELECT CONCAT("ALTER TABLE ",TABLE_SCHEMA,".",TABLE_NAME," CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci; ", "ALTER TABLE ",TABLE_SCHEMA,".",TABLE_NAME," CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;") AS alter_sql FROM information_schema.TABLES WHERE TABLE_SCHEMA = database();' >> ~/.abra/backups/"$APP_URL"_alter_table.sql 2>/dev/null
echo "SET foreign_key_checks=1;" >> ~/.abra/backups/"$APP_URL"_alter_table.sql
# run these alter_table.sql commands
abra app run "$APP_URL" db -t -- mysql -u root -pghost ghost < ~/.abra/backups/"$APP_URL"_alter_table.sql

1
release/1.1.0+6-alpine Normal file
View File

@ -0,0 +1 @@
when deploying, healthchecks may fail once, it seems to be caused by a database update/migration needing more time. Just wait some time and deploy again

1
release/1.1.1+6-alpine Normal file
View File

@ -0,0 +1 @@
set mysql-pooling default to 0, added option to set it via env