Skip to content

πŸ‘‰ Starting point / instructions for creating a Docker Compose / Stack repository

License

Notifications You must be signed in to change notification settings

ProfessorManhattan/template-docker-compose

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

{{ load:.config/docs/readme/header.md }}


Starting point / instructions for creating a Docker Compose / Stack repository


Table of Contents

Docker-Compose Project

This is a Docker Compose / Swarm project.

Requirements

Development Requirements

  • DockerSlim - Used for generating compact, secure images
  • jq - Used for interacting with JSON
  • Node.js (>=14.18) - Utilized to add development features like a pre-commit hook and maintenance tasks
  • Many more requirements that are dynamically installed as they are needed by our Taskfile.yml via our custom go-task/task fork named Bodega

If you choose to utilize the development tools provided by this project then at some point you will have to run bash start.sh (or npm i which calls bash start.sh after it is done). The start.sh script will attempt to automatically install any requirements (without sudo) that are not already present on your build system to the user's ~/.local/bin folder. The start.sh script also takes care of other tasks such as generating the documentation by calling tasks defined in the Taskfile.yml. For more details on how the optional requirements are used and set up, check out the CONTRIBUTING.md guide.

When you are ready to start development, run task --menu to open an interactive dialog that will help you understand what build commands we have already engineered for you.

Docker Compose / Stack Project

We house most of our Docker Compose / Stack configurations in our Ansible Docker Swarm role. However, when a stack is more complicated and might need to include other files (i.e. Terraform files, or special configuration files) then we dedicate a repository to the project.

Unlike our Dockerfile repository projects, we do not have a strict repository style guide. There are, however, a few things to keep in mind.

Docker Compose / Stack configurations are supposed to be easy to use, one-liner ways of launching otherwise somewhat complicated networks. So if the repository is not launchable by just running docker up -d docker-compose.yml then a file called launch.sh should be included in the repository. The launch.sh file should make setting up the stack a one-liner process.

Docker Containers

If the stack requires containers that are not from reputible sources or if the stack would benefit from having custom Dockerfile container builds then each Dockerfile should have its own repository in the appropriate sub-group in the Docker group. Please also look over the README of our Dockerfile boilerplate.

Configuration Management

In order to make the experience truly simple and adhere to the one-liner principle, it may be required to incorporate some sort of configuration management strategy. This should be done by either using Ansible or Terraform. In cases where performance is vital, Saltstack can be used as well.

The configuration choices should be thorough and automatically apply the settings that would satisfy the needs of most users. The configurations should make a best-effort at integrating with the other software we include in Gas Station, JumpUSB, and any platform/service that a typical GitHub power-user would have in their stack.

That all said, the most important part of the project is to understand and have an intuitive feel for the stack's requirements.

Re-Building the Repository

You can begin the project using this repository as a boilerplate. It might also be helpful to check out some of the other Docker Compose / Stack repositories. When you are done creating the stack, be sure to update the repository's metadata and documentation. You can do this by editting the fields in the blueprint section of the package.json file. After that, edit the documentation by adding your project-specific documentation written in markdown to the docs/partials/guide.md file. With the blueprint section and the documentation partial populated, you can re-compile the repository by running bash start.sh && task update. Be sure to add a custom transparent square logo.png to the root of this repository for good measure.

And that is all, you are ready to polish this Docker stack and open a pull request.

Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page. If you would like to contribute, please take a look at the contributing guide.

Sponsorship

Dear Awesome Person,

I create open source projects out of love. Although I have a job, shelter, and as much fast food as I can handle, it would still be pretty cool to be appreciated by the community for something I have spent a lot of time and money on. Please consider sponsoring me! Who knows? Maybe I will be able to quit my job and publish open source full time.

Sincerely,

Brian Zalewski

Open Collective sponsors GitHub sponsors Patreon

Affiliates

Below you will find a list of services we leverage that offer special incentives for signing up for their services through our special links:

MailChimp DigitalOcean Referral Badge

License

Copyright Β© 2020-2021 Megabyte LLC. This project is MIT licensed.