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

Update Docker Compose Dev Environment (#580) #584

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion docker/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ DATA_DIR=/data
MEILI_ADDR=http://127.0.0.1:7700
MEILI_MASTER_KEY=[generate with <openssl rand -base64 36>]
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=[generate with <openssl rand -base64 36>]
NEXTAUTH_SECRET=[generate with <openssl rand -base64 36>]
DOCKER_DATA_DIR=[replace with the directory for persistent data]
11 changes: 4 additions & 7 deletions docker/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
build:
dockerfile: Dockerfile.dev
volumes:
- data:/data
- ${DOCKER_DATA_DIR}/data:/data
- ..:/app
ports:
- 3000:3000
Expand All @@ -30,12 +30,12 @@ services:
meilisearch:
image: getmeili/meilisearch:v1.6
volumes:
- meilisearch:/meili_data
- ${DOCKER_DATA_DIR}/meilisearch:/meili_data
workers:
build:
dockerfile: Dockerfile.dev
volumes:
- data:/data
- ${DOCKER_DATA_DIR}/data:/data
- ..:/app
working_dir: /app
environment:
Expand All @@ -56,13 +56,10 @@ services:
environment:
DATA_DIR: /data
volumes:
- data:/data
- ${DOCKER_DATA_DIR}/data:/data
- ..:/app
command:
- /bin/sh
- -c
- "pnpm install --frozen-lockfile && pnpm run db:migrate"

volumes:
meilisearch:
data:
Comment on lines -66 to -68
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why though? Sounds easier to not have to mount a manual data dir?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is mostly up to preference, I would much rather prefer having the /data directory to be persistent so that I can modify the sqlite db in case it is needed

11 changes: 10 additions & 1 deletion docs/docs/07-Development/01-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,13 @@ In dev mode, opening and closing the plugin menu should reload the code.

## Docker Dev Env

If the manual setup is too much hassle for you. You can use a docker based dev environment by running `docker compose -f docker/docker-compose.dev.yml up` in the root of the repo. This setup wasn't super reliable for me though.
If the manual setup is too much hassle for you, you can use a docker based dev environment instead by following the instructions:

- Clone the repo and navigate to the root of the repo.
- Run `cp /docker/.env.sample /docker/.env`
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think there's a need for an env file during development to be honest. Hoarder should work just fine without one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This ties back into the above comment: "Wouldn't it be a good idea to set it up anyways, just to make sure that any development does not break functionality offered by nextauth or meilisearch?"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

coming back to this: wouldnt we need it for NEXTAUTH_URL and MEILISEARCH_URL?

- Make the necessary changes to the .env file (setting the DOCKER_DATA_DIR, NEXTAUTH_SECRET, and MEILI_MASTER_KEY)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You don't really need to set nextauth_secret or even meili key during development. So I wouldn't worry too much about them

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wouldn't it be a good idea to set it up anyways, just to make sure that any development does not break functionality offered by nextauth or meilisearch?

Copy link
Contributor

Choose a reason for hiding this comment

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

I am too prefer having nextauth and meilisearch being ready while developing

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just to be clear. They will be ready and usable. The requirements of the variables being set are only when deployed to prod.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh gotcha because you want that stuff seeded with a random value

- Run `docker compose -f docker/docker-compose.dev.yml up --build` in the root of the repo.

### Notes
- The inital set up takes a while, do not be concerned for very long build times.
- The application is ready to work when the web-1 container says "Ready" on the next.js block
Loading