Skip to content
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

Offer deployment via Docker #553

Closed
stefandesu opened this issue May 12, 2020 · 8 comments · Fixed by #574
Closed

Offer deployment via Docker #553

stefandesu opened this issue May 12, 2020 · 8 comments · Fixed by #574
Milestone

Comments

@stefandesu
Copy link
Member

I had this suggestion before, but apparently never created an issue for it. I think it would make a lot of sense to offer deployment via Docker. I would suggest offering separate Docker container for Cocoda, jskos-server, and login-server, and then offer an example docker-compose file that includes all of these (including a MongoDB for jskos-server and login-server).

It shouldn't be too difficult to offer this. It would probably make sense to create a separate repository though (maybe one repository which includes all Docker containers and the docker-compose example).

(I thought of this due to #550 because setting up your own instance will become even easier when Docker is available.)

@stefandesu
Copy link
Member Author

stefandesu commented May 19, 2020

I have added a Docker branch where I added necessary files to create a Docker container for Cocoda.

Further steps needed:

  • Create a Docker Hub organization where our Docker containers will be hosted (free for up to 3 members, but one issue: names have to have at least 4 characters, so we can't use "gbv" Edit: We could call it "coli-conc".)
  • Add automatic Docker deployment (I would suggest via GitHub Actions because I have tried it out successfully and we don't need to make our Travis workflow even more complex)
  • Add documentation

This is only for Cocoda itself. Of course we would have to repeat the same things for jskos-server and login-server, and then somewhere offer the example docker-compose file on how to integrate them all.

@stefandesu stefandesu added this to the 1.3.2 milestone May 19, 2020
@stefandesu
Copy link
Member Author

Some certain changes to the file structure (especially regarding configuration files) might make sense, but that would cause old versions to break, so I'll have to see whether it makes sense. It might be better to solve it inside the Docker image.

@stefandesu
Copy link
Member Author

The issue I mentioned in the previous comment is that the configuration file (cocoda.json) is not in a separate directory which makes mounting it for persistence more difficult. The way I solved it currently is to create a new folder /config inside the container which only includes the cocoda.json, and let the user mount that folder. Currently, in the command (CMD) it is checked if the file exists and if not, copy the configuration file from inside the container there. This is a solution I'd like to keep, but make it a bit better. A good example to look at, I think, is the Wordpress docker. I also learned that it's better to use ENTRYPOINT if you want the command to be executed every time.

Also it would be good to move all docker-related files into a separate directory. During testing a while back I had some issues with creating and publishing the image from GitHub Actions, but that should be solvable.

@stefandesu
Copy link
Member Author

I created an organization and repository on Docker Hub: https://hub.docker.com/repository/docker/coliconc/cocoda

I will now make deployment work in the docker branch.

@stefandesu
Copy link
Member Author

Deployment works. Branches are now deployed via their branch names (currently only docker); additionally master will be published as latest (that means that latest will always be the latest released version)*, and additional version tags will be published according to SemVer (1 will be the latest release of major version 1, e.g. 1.3.2, 1.2 will be the latest minor version 1.2, e.g. 1.2.4, and each patch version will have its own tag as well).

*To be honest, I'm not 100% confident that this will work because we changed the default branch. I might do some testing on my test repo before we merge into dev.

Now, it's mostly a matter of documentation. I would suggest to add Docker deployment information to README.md, and information about local Docker building to docker/README.md. Alternatively, that could be in the developer documentation and docker/README.md could contain the README for Docker Hub. Currently, it is not possible to set that via the API, so we will need to copy-paste it manually.

@stefandesu
Copy link
Member Author

stefandesu commented Jun 25, 2020

Update: The current deployment will work as long as we keep using master, but it'll stop pushing the "latest" tag if we rename master to, say, main. That is because the Action I'm using (https://github.com/elgohr/Publish-Docker-Github-Action) has the master hardcoded. I already opened an issue to allow changing that with an argument to the Action. And even if that is not implemented, it would be possible to modify the deployment to make it work nevertheless.

It's okay. If we rename master, we just need to make a small change inside .github/workflows/docker.yml. 👍

I'll improve documentation tomorrow, then I'll merge and close this issue.

stefandesu added a commit that referenced this issue Jun 26, 2020
Add deployment via Docker (#553)
@stefandesu stefandesu linked a pull request Jun 26, 2020 that will close this issue
@stefandesu
Copy link
Member Author

The latest tag as well as the the version tags will be available once we release a new version.

@stefandesu
Copy link
Member Author

Docker deployment worked perfectly with the just-released version 1.4.0: https://hub.docker.com/repository/docker/coliconc/cocoda

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant