ref https://linear.app/ghost/issue/ENG-1782/move-docker-related-files-to-a-better-location-that-githubscripts
- The docker files are currently located in `.github/scripts`. This location doesn't make a lot of sense — you wouldn't think to look there unless you already knew they were there. This also requires you to specify the path to the `compose.yml` file whenever running a `docker compose ...` command.
- This commit moves the `compose.yml` file to the root of the repo, so you can simply run `docker compose up` and it will automatically find the file in the root, without having to specify `-f .github/scripts/docker-compose.yml`. This is a major win for convenience over the current setup.
- It also moves all the related files, including the `Dockerfile` used by the Dev Container setup and configuration files for supporting services into a new `.docker` directory, which is a more logical location, and should be easier to find.
- Also updated the current convenience commands in the `package.json` scripts block (`yarn docker:reset` and `yarn docker:down`
no issue
- The current devcontainer setup was built with the intention of using
it as the _primary_ way of running Ghost in Docker locally. As such, it
was designed to be extensible — there was a `base.compose.yml` file with
the default configuration, and multiple other `compose.yml` files that
could be added to extend the base setup to cover different use-cases.
- We've run into some problems with using the devcontainer for regular
day to day usage, so we're moving toward using a more conventional
`compose` based setup for more advanced configurations.
- We're going to keep the devcontainer around as it's still nice for a
quick and easy setup, but it no longer needs to support multiple
configurations — as such, we can simplify the setup to a single
`compose.yml` file to make it easier to reason about and troubleshoot if
anything goes wrong.
- This commit removes the `.devcontainer/.docker` directory, and many of
the files that were in it. The main `compose.yml` file and the
Dockerfile were moved to the root of `.devcontainer` which should make
the setup a bit easier to follow and modify as needed.
no issue
- When stopping `yarn dev` with ctrl+c in the dev container, you'd get
an error because the container doens't have `ps` installed, which is
used by node under the hood. Adding this dependency fixed the error so
`yarn dev` (and other commands) exit cleanly
no issue
- The Dev Container didn't have the Github CLI installed, so this adds
that using Dev Container
"[features](https://containers.dev/implementors/features/)"
- It also adds oh-my-zsh and a few plugins that are nice to have when
developing.
no issue
- When creating a dev container, the onCreateCommand script will try to
setup the git remotes according to the environment variables defined for
e.g. `$GHOST_UPSTREAM`. There was a bug that caused the `origin` remote
to successfully be renamed to `$GHOST_UPSTREAM`, but the `origin` remote
was not being created successfully on the first try. This commit fixes
that bug.
no issue
- Added function to Dev Container onCreateCommand to setup git remotes
when creating the Dev Container
- If `$GHOST_UPSTREAM` is set, it will rename the default `origin`
remote to its value
- It will also update the remotes for the submodules, otherwise `yarn
main` will fail
- If `$GHOST_FORK_REMOTE_URL` is set, it will add it as `origin`, or the
value of `$GHOST_FORK_REMOTE_NAME` if set.
- If `$GHOST_FORCE_SSH` is set to `true`, it will change all remotes
URL's to use ssh instead of https
no issue
- The onCreateCommand was previously a bash script, which made it a bit
more challenging to read and make changes to it. This commit converts it
to JavaScript so it will be easier to make updates to it.
refs
https://linear.app/ghost/issue/ENG-1686/mail-auto-configuration-doesnt-work
- Previously the `mail` configuration that is auto-generated didn't work
because the `from` address wasn't being set, and requests were
consequently failing due to some Mailgun internal validation.
- This change requires the `MAILGUN_FROM_ADDRESS` environment variable
to be set for it to automatically configure the `mail` block, and if it
is, it adds it as `mail.from`. Now with all three of
`MAILGUN_SMTP_AUTH`, `MAILGUN_SMTP_PASS` and `MAILGUN_FROM_ADDRESS`
setup, transactional emails work out of the box in the Dev Container.
no issue
- Dev Containers let you work on Ghost in a consistent, isolated
environment with all the necessary development dependencies
pre-installed. VSCode (or Cursor) can effectively run _inside_ the
container, providing a local quality development environment while
working in a well-defined, isolated environment.
- For now the default setup only works with "Clone repository in
Container Volume" or "Clone PR in Container Volume" — this allows for a
super quick and simple setup. We can also introduce another
configuration to allow opening an existing local checkout in a Dev
Container, but that's not quite ready yet.
- This PR also added the `yarn clean:hard` command which: deletes all
node_modules, cleans the yarn cache, and cleans the NX cache. This will
be necessary for opening a local checkout in a Dev Container.
- To learn more about Dev Containers, read this guide from VSCode:
https://code.visualstudio.com/docs/devcontainers/containers#_personalizing-with-dotfile-repositories
---------
Co-authored-by: Joe Grigg <joe@ghost.org>
Co-authored-by: Steve Larson <9larsons@gmail.com>