From 7f332ff9aca58f4b6bca54d04927732bad9781da Mon Sep 17 00:00:00 2001 From: James Loh Date: Wed, 9 Jul 2025 14:35:39 +1000 Subject: [PATCH] Start exposing Ghost on localhost and template port no ref - The thinking here is this allows users to more easily run multiple Ghost instances on the same server by templating the Ghost port - Majority wont need this but it also simplifies the message around having to forward traffic if you don't start Caddy --- .env.example | 5 +++++ compose.yml | 2 +- scripts/migrate.sh | 6 ++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index 67cad11..6931f9f 100644 --- a/.env.example +++ b/.env.example @@ -13,6 +13,11 @@ DATABASE_ROOT_PASSWORD=reallysecurerootpassword DATABASE_USER=optionalusername DATABASE_PASSWORD=ghostpassword +# Port Ghost should listen on +# You should only need to edit this if you want to host +# multiple sites on the same server +# GHOST_PORT=2368 + # Developer Experiences must be enabled for # both Traffic Analytics and ActivityPub ENABLE_DEVELOPER_EXPERIMENTS=false diff --git a/compose.yml b/compose.yml index 030c51d..4319bae 100644 --- a/compose.yml +++ b/compose.yml @@ -23,7 +23,7 @@ services: image: ghost:${GHOST_VERSION:-5-alpine} restart: always expose: - - "2368" + - "127.0.0.1:${GHOST_PORT:-2368}:2368" # This is required to import current config when migrating env_file: - .env diff --git a/scripts/migrate.sh b/scripts/migrate.sh index 86e0896..965d94a 100644 --- a/scripts/migrate.sh +++ b/scripts/migrate.sh @@ -509,9 +509,11 @@ main() { echo "✓ Caddy Webserver is running!" echo "✓ Your site is available at: https://${domain}" else + local ghost_port + ghost_port=$(grep 'GHOST_PORT' "${PWD}/.env" | cut -d '=' -f 2) echo "" - echo "✓ Ghost is running on port 2368" - echo " Configure your reverse proxy to forward traffic to it" + echo "✓ Ghost is now running" + echo " To finish migration, configure your webserver to forward traffic to 127.0.0.1:${ghost_port}" fi # Success! Remove recovery script