The docker-compose files used in making the cluster, with documentation on how to create your own.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Whitman Huntley ca12ef9e99 made gitea use postgresql 8 months ago
composers made gitea use postgresql 8 months ago
LICENSE Initial commit 9 months ago
README.md Added the everything 9 months ago
first_start.sh Added the everything 9 months ago
portainer.sh Added the everything 9 months ago
traefik.sh Added the everything 9 months ago

README.md

docker-composers

The docker-compose files used in making the cluster, with documentation on how to create your own.

Design

These set of compose files are designed around the idea of portability. The stacks all volumize their data, and thus are not bounded to hardware. This also means that its less confusing as to where things go, as they should all run through portainer.

Installing

This guide will take you through the installation of the same services.

Requirements

  1. at least one Linuxbox with docker installed. Make sure to place the server in the DMZ if self-hosting (the one you choose will become the master node)

  2. A domain, with wildcard records pointing to your IP (which must be static)

  3. Take all the yaml files and modify the domain host bits and replace it with your domain (usually called domain.tld).

  4. Make sure your user is in the docker group (create it if it doesn’t exist) or are root (not recommended but who am I? a cop?)

Configuring the Essential Services

The docker-compose files require a few underlying services, such as a traefik reverse proxy and portainer web ui. Run these scripts on the master node (the one in the DMZ)

  1. run first_start.sh this will initialize docker swarm and create the web network, which is the logical network this setup uses for broadcasting HTTP/S. It will also generate a docker-swarm-info.txt containing information on how to add workers and other managers to the swarm.

  2. Run ./traefik.sh, enter your domain, your email (this is for LetsEncrypt certifications), and a password to access the web ui with.

  3. After making sure to substitute in your domains in the composers/portainer-stack.yml file, run ./portainer.sh

Congrats! You have successfully configured docker! go to portainer.domain.tld and sign up to begin!

Adding Stuff

With portainer up and running, you no longer need the comnand line. So feel free to log out (mind you download the other composers, should you wish to use them later) and log into portainer. Portainer is just a graphical interface to docker, but its a lot more fluent as the command line can only do so much. Select your “primary” endpoint

All services in this system are stacks, meaning the rest of the tabs are interesting but not necessary to modify for these services to work. Go to the stacks tab, and create a new stack. Then simply paste in any docker compose, see the changes below to make sure its alright, then run. The stacks create services, which themselves create containers. This means that the system can revive itself easily in the event of an accident without manually restarting. The stacks also create volumes, pull images, and configure networks without user interaction.

Name the stack, whatever. The stack name will be used as a prefix, so make sure its unique. I.E. contaiers will be called ${STACK-NAME}_${SERVICE-NAME}_${CONTAINER-UUID}, the volumes will be ${STACK-NAME}_${VOLUME-NAME}, and so on.

Deploying: Gitea

Gitea is a self-hosted git instance written in go. Its the easiest thing I’ve ever worked with and I love the devs for it. However its not without its hiccups:

  • You will need to expose ports for SSH. Traefik only does HTTPS.

  • There’s an environment variable called APP_NAME, which takes a string. This is used for the <title> of the webpage, and is scattered a few other places. Set this to your company name or something (we use Git@Dotfile)

  • There’s an issue where it thinks its just localhost? ish? This is only a minor visual issue (from what I can see) and it is easily resolved once the service is spun up by logging into the service via the command line utility for the container (must be live) and going to /data/gitea/conf/app.ini and futzing with the [sever] config. Then save, disconnect, and delete the container. A new one should spawn up after a second with the correct config.

    • You can also add a neat dark mode by adding this to the app.ini too:
    [ui]
    DEFAULT_THEME = arc-green
    
    • If you have issues with the command line, then you can also download, edit locally, and reupload via portainer’s volume tab.

Deploying: Nextcloud

Nextcloud is a self-hosted cloud service based off the older OwnCloud service (with a bit more focus on security). It spawns off an apache webserver, a database, and a cron manager service. You will have to futz with the stack file a bit to get it working however:

  • The database is postgres, so in the services/db/enviornment and /services/app/enviornment, set the field POSTGRES_PASSWORD to a unique (preferably random) password. The database will not be exposed and will only be viewable on the nextcloud_internal network (for which all services communicate on).

Deploying: Nginx

The nginx configuration file is pretty much ready to go. Just edit in the domain as needed. Note that https://domain.tld does not auto redirect to https://www.domain.tld (this will be fixed later, if you can find a solution get in touch).

Deploying: Minecraft

This also is just plug-n-play. The image is of a spigot server and the standard port is exposed. Note the image tag is set to :1.9.4, this can be changed for whatever version you see fit.

Adding Other Systems:

This section hasn’t been done yet as I don’t have any hardware. However adding remote servers that aren’t port forwarded seem to muck everything up, and all the volumes use the default local driver which probably can’t mean anything good.

EOF