-
Notifications
You must be signed in to change notification settings - Fork 5
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
Improve local development and startup via docker #38
base: main
Are you sure you want to change the base?
Conversation
Development in Docker is already working. But this is not yet documented in the |
Basically this is the finished stage. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some comments. Thank you for interest in the project. I appreciate it.
compose.dev.yaml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better if we don't change current compose filenames. Also for local TS development it's not necessary to have the whole application inside a container. I suggest delete app part or create new compose file specifically for dev containers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better if we don't change current compose filenames.
I think otherwise, it's worth changing for these reasons:
- Shorter name is easier to type
- Follows modern Docker Compose naming conventions
- Reduces potential for typos
Also for local TS development it's not necessary to have the whole application inside a container. I suggest delete app part or create new compose file specifically for dev containers.
My interpretation of what you are suggesting:
.devcontainer/compose.app.yaml
- сontains the projectcompose.db.yaml
- сontains only postgres
I also want to add nginx
to the development environment so that I can test things like 7tv emotes that require a proxy.
It also brings you closer to the production environment, which helps identify potential problems early on.
This will add one more file:
compose.nginx.yaml
- сontains only nginx
I can do that. Is that okay with you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think otherwise, it's worth changing for these reasons:
Shorter name is easier to type
Follows modern Docker Compose naming conventions
Reduces potential for typos
It makes sense, but if we want to rename compose files we should also rename docker-compose.production.yml
. I would like to avoid inconsistency. Either we rename all files or leave it as is and rename them in separate branch.
My interpretation of what you are suggesting:
.devcontainer/compose.app.yaml - сontains the project
Looks good.
compose.db.yaml - сontains only postgres
Let's leave dev
or development
. Potentially it can contain other services for dev environment.
I also want to add nginx to the development environment so that I can test things like 7tv emotes that require a proxy.
My suggestion is place nginx config for 7tv proxy to the dev compose file. But only proxy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes sense, but if we want to rename compose files we should also rename docker-compose.production.yml. I would like to avoid inconsistency.
I want to rename docker-compose.production.yaml
to compose.prod.yaml
, but this PR should not affect the production environment.
Either we rename all files or leave it as is and rename them in separate branch.
So yes, it's worth doing this in a separate PR in which to rename all the files.
Let's leave dev or development. Potentially it can contain other services for dev environment.
My suggestion is place nginx config for 7tv proxy to the dev compose file. But only proxy.
I thought about that, but would you be happy with posgres
and nginx
running in the same file?
Changed structure:
.
├── .devcontainer/
│ └── compose.app.yaml ─ project
├── compose.dev.yaml ─ posgres and nginx
└── compose.prod.yaml ─ no changes :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's leave dev or development. Potentially it can contain other services for dev environment.
My suggestion is place nginx config for 7tv proxy to the dev compose file. But only proxy.I thought about that, but would you be happy with
posgres
andnginx
running in the same file?
If I could serve app locally with pnpm run dev
I would be happy :D
So yes, it's ok
|
df0e6e5
to
4c691dd
Compare
Added
|
This PR is getting more complicated than I expected. It takes time to find out what happens. Again, for me it's not convenient to have the whole app in dev container. |
I'm still working on it. It's the next thing I intend to do. I'm turning PR back into draft until it's in the final stages. As soon as it works as intended and satisfies everyone and is fully documented in the README, I will reopen it for merging. |
|
Add `nginx` service to compose. Nginx proxies all incoming requests to host machine ports, this allows proxying even if the project was run locally and not in docker. Since we need to change addresses and ports in the configuration add the `dev-entrypoint.sh` script. Add also `website` service that would be the main page.
Motivation
Purposes
Known bugs
An error may occur when launching an
app
container if the database was not ready to accept requests.This often happens if the volume does not exist, in which case the container needs additional time to create the volume.
Solution: add a health check for the database container.
Dev container fails at build.
Cause: dev container tries to override the configuration and fails.
Logs
When opening
http://localhost:4300/client
on the server, you can’t find the user.Not sure if this error is related to deployment.
Maybe you need to runpnpm run db:generate
.Update: This is not a deployment issue.
Logs
client_prisma_error.log
There is no mounting of the volume with project files in the
app
container.Currently, the project is copied during the creation of the image container.
Addition
At the moment, I can't ensure that the project works correctly in docker compose because the Twitch console refuses to register a new application due to the link not corresponding to the
https
protocol, even for links that have thehttps
protocol.It may be worth adding
nginx
to docker compose for development, which will allow testing some things locally.