Skip to content

Conversation

ajfriesen
Copy link
Contributor

Add Ghost 5 support.

Simply copy-pasting the folder for Ghost 4 and then bump versions for Ghost itself and the base node images.

Since Ghost will support patches for Ghost 4 until Jan 2023 I thought this might be an easy solution to keep both images.

@ajfriesen
Copy link
Contributor Author

ajfriesen commented May 23, 2022

I did test locally with this docker-compose.yaml on a ubuntu 20.04 with docker.
Started with ghost:4, build ghost:5 locally, started with ghost:5 and checked the migration.
Looked at the logs and the interface. Looks good at the first glance.

version: '3'

services:

  caddy:
    image: caddy:2
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - $PWD/Caddyfile:/etc/caddy/Caddyfile
      - caddy-data:/data


  ghost:
    image: ghost:5
#    image: ghost:4
    restart: always
    environment:
      # see https://ghost.org/docs/config/#configuration-options
      database__client: mysql
      database__connection__host: db
      database__connection__database: ghost
      database__connection__user: ghost
      database__connection__password: ghost
      # this url value is just an example, and is likely wrong for your environment!
      url: http://localhost

      
      # 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
    volumes:
      - ghost-data:/var/lib/ghost/content
    links:
      - db

  db:
    image: mysql:8.0
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: ghost
      MYSQL_DATABASE: ghost
      MYSQL_USER: ghost
      MYSQL_PASSWORD: ghost
    cap_add:
      - SYS_NICE
    volumes:
      - ghost-db:/var/lib/mysql

volumes: 
  ghost-data:
  ghost-db:
  caddy-data:


Caddyfile:

{
    # Global options block. Entirely optional, https is on by default
    # Optional email key for lets encrypt
    # Optional staging lets encrypt for testing. Comment out for production.
    acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
}

######

localhost {
    reverse_proxy ghost:2368 {
        lb_try_duration 30s
    }
}

@Themimitoof
Copy link

I just tested the Alpine version with a backup of my personal blog and everything work as expected.

👍

Copy link
Member

@yosifkit yosifkit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small change and then we also need to update generate-stackbrew-library.sh so that the latest tag will move:

@CKarper
Copy link

CKarper commented May 23, 2022

With Ghost5 removing sqlite from official support, will this need to migrate to use mysql as a default?

Co-authored-by: yosifkit <yosifkit@gmail.com>
@ajfriesen
Copy link
Contributor Author

ajfriesen commented May 23, 2022

With Ghost5 removing sqlite from official support, will this need to migrate to use mysql as a default?

@CKarper

It looks like it:

  • MySQL 8 is the only supported database for both development and production environments.

  • SQLite3 is supported only in development environments where scalability and data consistency across updates is not critical (during local theme development, for example)
    MySQL 5 is no longer supported in any environment

Note: MariaDB is not an officially supported database for Ghost.

https://ghost.org/docs/changes/#ghost-50

@ajfriesen
Copy link
Contributor Author

One small change and then we also need to update generate-stackbrew-library.sh so that the latest tag will move:

@yosifkit
Thanks have just changed to version 5 for latest tag.

@tianon
Copy link
Member

tianon commented May 23, 2022

Looks like we need to update https://github.com/docker-library/official-images/blob/af804b40f14198cc6fb3b134cbb7311c5fdb260b/test/tests/ghost-basics/run.sh#L35-L42 🙈

(Probably switching that fallback to echo >&2 '...' so we actually get the error, but also a 5.* entry 😅)

@ajfriesen
Copy link
Contributor Author

ajfriesen commented May 23, 2022

Also ghost does not specify api versions anymore:

API versioning
Ghost 5.0 no longer includes multiple API versions for backwards compatibility with previous versions. The URLs for the APIs are now ghost/api/content and ghost/api/admin. Breaking changes will continue to be made only in major versions; new features and additions may be added in minor version updates.

https://ghost.org/docs/changes/#ghost-50

@tianon
Copy link
Member

tianon commented May 23, 2022

Ah! So we could update that to something like this?

# Check that /ghost/ redirects to setup (the image is unconfigured by default)
ghostVersion="$(docker inspect --format '{{range .Config.Env}}{{ . }}{{"\n"}}{{end}}' "$serverImage" | awk -F= '$1 == "GHOST_VERSION" { print $2 }')"
case "$ghostVersion" in
	4.*) _request GET '/ghost/api/v4/admin/authentication/setup/' | grep 'status":false' > /dev/null ;;
	*) _request GET '/ghost/api/admin/authentication/setup/' | grep 'status":false' > /dev/null ;;
esac

@ajfriesen
Copy link
Contributor Author

Did not see your comment and already did the change for version 5 here:
docker-library/official-images#12481

I did this just analog to what was done before.

@ajfriesen
Copy link
Contributor Author

Nice, pipeline without errors and no need for ci wip commits 😅

Anything left to do in order to publish the new version?

@tianon tianon merged commit 62e6411 into docker-library:master May 23, 2022
docker-library-bot added a commit to docker-library-bot/official-images that referenced this pull request May 23, 2022
Changes:

- docker-library/ghost@62e6411: Add Ghost 5 support (docker-library/ghost#306)
- docker-library/ghost@054059f: Update to 4.48.0, ghost-cli 1.21.0
@ajfriesen ajfriesen deleted the ghost5-support branch May 23, 2022 22:09
@ZilvinasKucinskas
Copy link

Experiencing some issues on Apple with the M1 chip (not sure if that is related):

docker-compose build
mysql uses an image, skipping
Building web
[+] Building 1.3s (3/3) FINISHED                                                                                                
 => [internal] load build definition from Dockerfile                                                                       0.0s
 => => transferring dockerfile: 37B                                                                                        0.0s
 => [internal] load .dockerignore                                                                                          0.0s
 => => transferring context: 2B                                                                                            0.0s
 => ERROR [internal] load metadata for docker.io/library/ghost:5.0-alpine                                                  1.2s
------
 > [internal] load metadata for docker.io/library/ghost:5.0-alpine:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: no match for platform in manifest sha256:dc6ce9363c6dcd0db732f130d7dc353175f63013fcfa0fe6458ee6fabd564c73: not found

Docker version: Docker version 20.10.14, build a224086
Related GH issue: #307

P.S. ghost:4.44 worked fine

Any ideas?

@tianon
Copy link
Member

tianon commented May 24, 2022

I'm guessing it wasn't quite built and available yet -- if you try again, it'll probably work now. 👍

@ZilvinasKucinskas
Copy link

It still does not work.

@tianon The build failed for arm64v8 as per #307 (comment) comment.

BaurzhanSakhariev pushed a commit to crate/official-images that referenced this pull request Jul 18, 2022
Changes:

- docker-library/ghost@62e6411: Add Ghost 5 support (docker-library/ghost#306)
- docker-library/ghost@054059f: Update to 4.48.0, ghost-cli 1.21.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants