-
Notifications
You must be signed in to change notification settings - Fork 1
add docker container #62
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
base: main
Are you sure you want to change the base?
Conversation
f165a96 to
c6b7e7c
Compare
Dockerfile
Outdated
| USER node | ||
| EXPOSE 3000/tcp | ||
| EXPOSE 4000/tcp | ||
| EXPOSE 5000/tcp |
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.
how do we handle exposing app ports? since those are dynamic?
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.
yes good question one I do not have an answer to
apps/server/src/index.ts
Outdated
| import { initDb } from "./db" | ||
|
|
||
| const appServers: Partial<Record<string, Server>> = {} | ||
| const dataDir = process.env["COATRACK_DATA_DIR"] || "_data" |
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.
please add types for the env (using a d.ts, you can probably find docs online) and also/alternatively add a Zod schema and make this a bit of a more general config thing
| @@ -0,0 +1,24 @@ | |||
| module.exports = { | |||
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.
haha are we using pm2 ? docker should be able to keep these alive on its own so this isnt necessary when containerizing is it?
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.
would maybe leave this out if we dont really need it
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.
yup pm2, we need it to serve web + sandbox and also host server. otherwise we probably need docker-compose.
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.
ah okay i see, probably also good to have for hosting outside of docker e.g as an os image
This PR does a couple things:
rootDirin our tsconfigs so that's addeddependenciestodevDependenciesin package.json, otherwise the built file doesn't run due to missing modulesCOATRACK_DATA_DIRenv var for server that specifies where the data directory should be.I decided to use PM2 to serve web + sandbox + run server. Currently web & sandbox are not responding for some reason.
Also, we have a bigger problem, since we're using server as the app "host", and it dynamically picks ports, docker wants to know what the ports are upfront... soooooo we can expose the "known" ports (i.e. 3000, 4000, 5000) but none of the apps in the catalog are exposed.
This is what I'm using to build:
And to run: