Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make docker-compose.yml configurable #1504

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@

# Docker environment (production)
docker/env
# mount mysql volume so that its easy to interact with the database outside of the container.
# This also allows persistent database storage
docker/mysql
# allow custom docker-compose files as users might have different needs
docker-compose*.yml
!docker-compose.yml

# Don't track changes to the docker-compose .env file only in project root
/.env

# mount mysql volume so that its easy to interact with the database outside of the container. This also allows persistent database storage
docker/mysql

# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal
Expand Down
11 changes: 6 additions & 5 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
# Docker Installation

A [docker-compose.yml](../docker-compose.yml) file is provided for deployment with Docker compose, if you choose.
A [docker-compose.yml](../docker-compose.yml) file is provided for deployment with Docker Compose. If you want to use a custom one, simply override the `COMPOSE_FILE` predefined environment variable in the `.env` file in project root ([local-setup.sh](./local-setup.sh) script creates one automatically from [compose-env](./compose-env). By default, `COMPOSE_FILE` is set to [docker-compose.yml](../docker-compose.yml)).

To use docker compose, you need to install the docker-compose-plugin. You can check whether it is already installed by running the following command.
To use Docker Compose, you need to install the docker-compose-plugin.
You can check if it's already installed via the following command:

```bash
sudo docker compose version
```

If your version is 2.x or higher, then you are good. Otherwise, you should install the docker compose plugin. For a system like debian or ubuntu, you can use the following command.
If the version is 2.x or higher, you are all set. If not, you should install the plugin. On a Debian-based Linux distro, you can run the following:

```bash
sudo apt-get install docker-compose-plugin
```

For Mac OS, you can install docker desktop by downloading it from the docker website. After starting the application, the docker compose command becomes available in your terminal.
For Mac OS, you can install Docker Desktop by downloading it from the Docker website. After starting the application, the docker compose command becomes available in your terminal.

Depending on your setup, you may need to prefix every docker command with sudo.

Expand Down Expand Up @@ -71,7 +72,7 @@ NOTE: If you get an error like "Cannot connect to the Docker daemon at ...", you
Then start your containers:

```bash
docker compose up # append -d (--detach) if you want, although it can be useful to see output in the terminal
docker compose up # append -d (--detach) if you don't want to see output in the terminal
```

After about 20 seconds, check to make sure the server is running (and verify port 3000, note that you can change this mapping in the `.env` file)
Expand Down
1 change: 1 addition & 0 deletions docker/compose-env
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
COMPOSE_FILE=./docker-compose.yml
LOCAL_DEV_PORT=3000
COMMUNITY_NAME=Dev Community
MAILER_PROTOCOL=https
Expand Down
2 changes: 1 addition & 1 deletion docker/local-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ cp ./docker/dummy.env ./docker/env
cp ./docker/compose-env .env
cp config/database.docker.yml config/database.yml
cp config/storage.docker.yml config/storage.yml
cp ./.sample.irbrc ./.irbrc
cp ./.sample.irbrc ./.irbrc
Loading