Closed michiels closed 4 years ago
@michiels Interesting! Thanks for taking a stab at this. How would this deal with the configuration that we currently do in the app.yml
from the intercity-docker package? For example setting up Let's Encrypt etc?
@jvanbaarsen As far as I can see now, all the configuration that happens in app.yml
(looking at https://github.com/intercity/intercity-docker/blob/master/samples/app.yml) can (or should) be done in docker-compose.yml
, most importantly setting the ENV vars.
Ah! Maybe one discussion comment regarding nginx/letsencrypt setup. I think the Intercity Docker image in itself should stay clear of what's running in front of it. We can offer the the installation CLI to install nginx or configure nginx and/or letsencrypt. So not by configuring those inside the container itself, but by allowing the host to manage this itself.
That way an Intercity instance can be easily ran alongside Dokku for example.
I've added to the docker-compose.yml
a setup that should be fully production-worthy, including persistent storage for PostgreSQL and Redis.
@michiels One of the design criteria for me with intercity-docker (The current one) was that no dependencies outside of Docker should be installed on the server. For me the preference would remain to keep that in place.
@jvanbaarsen Allright, we can discover that direction too by adding multiple dependencies to the same container. But you're going to have an nginx on the host system always if you want to allow multiple apps to be hosted on a server. So this new docker-compose thing takes the Docker philosophy into account that can also be launched on Docker Swarm setups. In the current intercity-docker
it uses Docker more as a package manager instead of using Docker's fundamentals.
I would say we can just prototype various directions and see which one works best. We can also have two flavors run side-by-side.
@michiels Yep sounds good. If it's ok with you I want to keep this PR open so I can test run this locally also. I probably have time for this next week.
@jvanbaarsen Yes that's fine. This PR is not meant to be quickly reviewed and closed, but to propose a direction we can test over time.
@michiels Ok cool :-) Let's see how we can iterate over this :-) I would love to get rid of intercity-docker at some point.
@jvanbaarsen I think with this way, upgrading and installing Intercity is very easy. What I imagine a CLI to do:
We can still debate wether nginx should be run from inside the Intercity container or from a different container or on the host. That last option would be the ideal Dockerized way of working.
For the end user there would be no difference, other than perhaps the bonus to run Intercity alongside of other applications on the server.
@jvanbaarsen One thing that's quite cool to already try out is local development. I'll push a commit to a seperate branch in a bit where you can use this Docker Compose file for local development.
That means that someone only has to have Docker installed on their local machine, and have the Git repo checked oud. No need to install Redis, Postgres or even run bundler. You can just do docker-compose run -P 3000:3000 web
and you will have an instant fully-fledged dev environment with Redis and PG setup.
This PR contains an initial prototype to package Intercity as a Docker stack. A simple Dockerfile has been added for hosting regular Rails apps with asset compilation. A docker-compose.yml file is added so that you can set up a full Intercity + Redis + Postgres stack while developing, but this can also be used while deploying.
The deployment direction this PR introduces in the future would be as follows:
How you can already use this PR:
Install Docker for your platform. The official Docker Mac client is great.
Start a local development Stack via:
Profit and view your local Intercity instance on http://localhost:3000
Happy to further discuss how we could take this further and what additional tooling/scripts/CLIs we might want to offer for easy installation and upgrading. I can imagine that:
can just use docker-compose under the hood to get an Intercity environment up&running on a server.