maybe icon indicating copy to clipboard operation
maybe copied to clipboard

Production Dockerfile for Self Hosting

Open DomiiBunn opened this issue 1 year ago • 19 comments

Planned Work

See https://github.com/maybe-finance/maybe/issues/295#issuecomment-1959490796

  • [ ] Build an "all in one" Dockerfile that can run the app on a single VPS
  • [ ] Build a Github action that pushes the Dockerfile to ghcr as scaffolded out in both #416 and in #327
  • [ ] Implement SSL config change from discussion in #308

An update will be posted directly to this issue when it is ready to be worked on!

Original Issue

Issue Description:

Background: Currently, it seems that the development is in its early stages. While acknowledging this, I believe that having a public Docker image along with a Docker Compose example could be beneficial for the community.

Proposal: I suggest creating and sharing a public Docker image for easier deployment. Additionally, including a Docker Compose example would facilitate users in setting up the environment seamlessly, potentially reducing future dependency-related issues.

Benefits:

  1. Simplifies deployment process.
  2. Mitigates potential dependency issues.
  3. Enhances user experience and accessibility.

Considerations:

  • Ensure documentation is comprehensive for both the Docker image and Docker Compose setup.
  • Set up a CI to deply the Docker image as updates are made.

Note: I understand that this might be premature in the development phase, but planning for this inclusion could prove valuable in the long run.

DomiiBunn avatar Feb 04 '24 20:02 DomiiBunn

Hey! You can use devcontainer for that!

yeskiy avatar Feb 05 '24 13:02 yeskiy

Would you consider eventually uploading & releasing images for those less-savvy Githubers? As @DomiiBunn said, it would simplify deployment & increase accessibility

e.g., ghcr.io/maybe-finance/maybe:latest

K-J-VV avatar Feb 05 '24 14:02 K-J-VV

My exact point ^

I spun it up with devcontainer but I think people would rather coppy a docker-compose file. change some env vars and do docker compose up rather than clonning a reppo and seting up with dev containers.

^.^

DomiiBunn avatar Feb 05 '24 14:02 DomiiBunn

My exact point ^

I spun it up with devcontainer but I think people would rather coppy a docker-compose file. change some env vars and do docker compose up rather than clonning a reppo and seting up with dev containers.

^.^

I can absolutely vouch as being a person who would rather use a docker-compose file. I consider myself a creative homelaber, not at all a developer/coder. I'm sure I can figure out how to clone a reppo but am entirely dependent on trying out new projects from available images, customizing env variables, & then updating my tags as new releases are published

K-J-VV avatar Feb 05 '24 14:02 K-J-VV

@DomiiBunn, @K-J-VV please follow #306. This Issue (and pr) contains some changes that you requested.

yeskiy avatar Feb 05 '24 14:02 yeskiy

~The point beeing made is not for development but for deployment.~

(Also windows isn't related for this issue afaik)

Edit:

I didn't notice the docker-compose included. It still does not deploy the aplication in producction. Maybe rename it to docker-compose-develop instead? As it only provides the postgres and redis service.

DomiiBunn avatar Feb 05 '24 14:02 DomiiBunn

I can take up creation of the compose, guide etc but did not want to claim your namespace on dockerhub

DomiiBunn avatar Feb 05 '24 14:02 DomiiBunn

@DomiiBunn just to clarify, this proposal is to bundle up all the required services into a single Dockerfile that could be deployed to a VPS for the purpose of self-hosting (rather than development)?

zachgoll avatar Feb 06 '24 17:02 zachgoll

@zachgoll Yes, That was the idea.

DomiiBunn avatar Feb 06 '24 17:02 DomiiBunn

Would you be interested if I open a PR following the configuration in https://guillaumebriday.fr/how-to-deploy-rails-with-kamal-postgresql-sidekiq-and-backups-on-a-single-host?

That would avoid the need to publish and maintain a public image in the mean time 👍 and allow developer to deploy their own version of Maybe.

guillaumebriday avatar Feb 06 '24 18:02 guillaumebriday

More of a question to the devs with the above ^.^

DomiiBunn avatar Feb 06 '24 19:02 DomiiBunn

#327 should help with the public image part

indykoning avatar Feb 06 '24 19:02 indykoning

@guillaumebriday appreciate the guide; I think we'll want to hold off on this for the moment since we're still so early with development and want to keep the focus there.

Definitely a future priority though. Kamal is likely what we'll go with eventually, but for now, we're trying to keep things as simple as possible.

Keep an eye on this guide for now—https://github.com/maybe-finance/maybe/wiki/Self-Hosting-Setup-Guide

We will be sure to update it along with adding scoped issues for making it happen once we get closer to a first release!

zachgoll avatar Feb 06 '24 22:02 zachgoll

@DomiiBunn just to clarify, this proposal is to bundle up all the required services into a single Dockerfile that could be deployed to a VPS for the purpose of self-hosting (rather than development)?

While I appreciate the first part I think the second one (single Dockerfile) is a misconception. A Dockerfile should consist of only one service. And a combination (e.g. with a database) is then realized by Docker Compose (as you already do for the dev setup).

thomas-mc-work avatar Feb 08 '24 12:02 thomas-mc-work

@thomas-mc-work

I mistread their comment, In the initial issue though...

Ensure documentation is comprehensive for both the Docker image and Docker Compose setup.

DomiiBunn avatar Feb 08 '24 12:02 DomiiBunn

Create the docker compose with maybe docker image and postgres container https://github.com/maybe-finance/maybe/pull/416

We still need to solve the problem of pushing the docker image to gcr.

jinnabaalu avatar Feb 09 '24 22:02 jinnabaalu

Created the github action to push the docker image to ghcr, now the image will be available ghcr.io/maybe-finance/maybe:latest Here is the PR https://github.com/maybe-finance/maybe/pull/416

jinnabaalu avatar Feb 09 '24 22:02 jinnabaalu

While we're still a bit early for a production-ready Dockerfile, this issue is definitely in line with our priorities so I will mark it as planned. The tasks that this issue will cover addresses several comments made here, in #308, and across various PRs:

  • [ ] Build an "all in one" Dockerfile that can run the app on a single VPS
  • [ ] Build a Github action that pushes the Dockerfile to ghcr as scaffolded out in both #416 and in #327
  • [ ] Implement SSL config change from discussion in #308

I will post an update directly to this issue when it is ready to be worked on!

zachgoll avatar Feb 22 '24 13:02 zachgoll

Re: #308 - I would consider splitting into two variables, FORCE_SSL and ASSUME_SSL, instead of a single variable that affects both configuration options.

haydenk avatar Feb 22 '24 15:02 haydenk

Recommending we may want to move to the "most official" Ruby images. Looks like we picked up slim from the Rails default dockerfile. Here's what Dockerhub has to say about this line of images:

That means, using ruby:<version> rather than ruby:<version>-slim

ruby:-slim This image does not contain the common packages contained in the default tag and only contains the minimal packages needed to run ruby. Unless you are working in an environment where only the ruby image will be deployed and you have space constraints, we highly recommend using the default image of this repository.

https://hub.docker.com/_/ruby

corsonknowles avatar Mar 13 '24 21:03 corsonknowles

Detailed requirements have been written for this. Closing this issue out as it has been superseded by #627

zachgoll avatar Apr 15 '24 17:04 zachgoll