-
-
Notifications
You must be signed in to change notification settings - Fork 132
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 docker examples #57
Conversation
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.
Just a couple of minor comments
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.
Nice. However, I am not sure if this PR is targeted at the right example!
Building the binaries can be done in Docker instead of copying the files over to a machine compatible with the Docker image.
The Docker example isn't doing that — it has a build completely contained on the target machine, and sends only sources. So, it should be "portable" in the sense that a macOS developer can develop locally using opam or esy, push sources, and a separate build on the remote Ubuntu machine will build the Linux container using whatever setup is there.
The Heroku example does involve copying binaries, because that seems like the only sensible way to deploy to Heroku at the moment. So, that example would benefit greatly from a containerized build.
An argument could be made for an example that builds Linux containers locally for the sake of reproducing a complex app setup with Docker Compose in local testing, but I think that's a slightly different kind of example.
The Docker example is now deployed by CI (https://github.com/aantron/dream/runs/2517717269). As you can see, it consists of By contrast, the Heroku workflow (https://github.com/aantron/dream/runs/2511934235) actually builds the binary in CI, and sends that to Heroku. That's the part that is definitely not portable to Mac (although a local build will still work, you just can't deploy the output to Heroku, of course). |
@aantron I addressed the remaining reviews I think, apart from the |
I also renamed |
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.
Ok, it looks good, I just left some final trivial nits :)
I think we can merge the PR and think about this later. One option is to use Ubuntu, in hopes that it will make future |
Thank you! I'll set up some GitHub Actions deployment for this, and rename |
The Docker examples are amazing and really useful. It's rare to see libraries documenting the deployment part, so your efforts on these are really appreciated 🙂
I thought I'd propose some improvements to the example. I've been using Docker for developing and deploying Opium apps with Docker quite a lot, so hopefully, the setup here should be relatively real-world-proof.
docker-compose.yml
defaults tojson-file
to be compatible to OSX (journald
is not available there), and we read the env varLOGGING_DRIVER
to make sure we usejournald
in thedeploy.sh
script.z-docker
example for Opam: the Dockerfile is a bit different, and I figured having deployement example is something Opam users will need as well