Docker compose and container settings.
 
 
Go to file
Danila Fominykh 8c977440f6
corrected rotated element elignment in mobile view
2023-09-26 11:10:06 -03:00
gitea corrected rotated element elignment in mobile view 2023-09-26 11:10:06 -03:00
icons removed link to help page from extra links in footer 2023-09-24 12:33:43 -03:00
local theme fix 2023-07-25 19:52:58 +03:00
mail made 2 versions of single-node setup. for local and public usage 2023-07-06 17:46:29 +03:00
minio added time sync to minio 2023-07-03 00:16:19 +03:00
postgres added time sync to minio 2023-07-03 00:16:19 +03:00
.gitignore migr to another server fixes 2023-07-30 19:57:44 +03:00
LICENSE license file 2023-07-17 23:42:45 +03:00
Makefile corrections for local single node setup and compose file 2023-07-06 20:52:23 +03:00
README.md migr to another server fixes 2023-07-30 19:57:44 +03:00
docker-compose.yml migr to another server fixes 2023-07-30 19:57:44 +03:00
logo.png updated logo and references 2023-06-27 11:15:14 +03:00

README.md

Infr - open infrastructure

Generic badge Generic badge Generic badge Generic badge Generic badge

This repository contains docker-compose files for fmnx insfrastructure, which consists of following elements:

  • Gitea with customized theme and parameters and API.
  • Postgres for user data.
  • Minio for blobs, files, packages and LFS.
  • Docker mail as gitea's mailer service.

Instructions for single-node local environment and multi-node public environment are provided below.

Certbot-docker and go-lego are used to obtain TLS certificates.

Local setup

Local version has all containers in a single docker-compose. It can be used for local tests and UI adjustments.

  1. Clone the repository.
git clone https://fmnx.su/core/infr
  1. Run containers with docker-compose.
cd infr/local && docker compose up

Single-node setup

If you are planning to setup gitea for your organization, team or household, you can route the domain name to your static IP adress, obtain certificates and run it, by following instructions:

  1. Clone the repository.
git clone https://fmnx.su/core/infr && cd infr
  1. Obtain certificates for gitea with lego docker.
docker run --rm -it -p 80:80 -p 443:443 -w /wd -v $(pwd):/wd docker.io/goacme/lego --email="name@example.com" --domains="example.com" --http run
sudo chmod a+rwx -R .lego
  1. Obtain certificates for email, add new user email accounts.
docker run --rm -it -v "$(pwd)/data/certbot/certs/:/etc/letsencrypt/" -v "$(pwd)/data/certbot/logs/:/var/log/letsencrypt/" -p 80:80 docker.io/certbot/certbot certonly --standalone -d mail.example.com
  1. Create .env file with parameters for your project. Adjust them for your project.
echo APP_NAME=Awesome project >> .env
echo DOMAIN=example.com >> .env
echo MAIL_ADDR=help@example.com >> .env
echo MAIL_PASS=password >> .env
echo MINIO_ACCESS_KEY_ID=654321 >> .env
echo MINIO_SECRET_ACCESS_KEY=123456789 >> .env
echo POSTGRES_DB=db >> .env
echo POSTGRES_USER=user >> .env
echo POSTGRES_PASSWORD=password >> .env
  1. Attach shell to docker-email container, add new users and obtain DKIM.
docker exec -it mail setup email add help@example.com password
docker exec -ti mail setup config dkim example.com
  1. Restart setup with docker-compose for DKIM and email to start working properly.
docker compose down
docker compose up

Multi-node setup

If you are planning to set up gitea for large collective or organization, it is reasonable to have multiple nodes. In this instruction, we assume that all nodes are located in the same network. Instruction consists of 5 parts: postgres, minio, mail, gitea and gitea-runner.

1. Postgres

  1. SSH into postgres vm.
ssh user@vm
  1. Clone infrastructure repo.
git clone https://fmnx.su/core/infr
  1. Cd into postgres folder.
cd infr/postgres
  1. Add postgres credentials to .env file. Save credentials to apply to gitea lates.
echo POSTGRES_USER=user >> .env
echo POSTGRES_PASSWORD=password >> .env
echo POSTGRES_DB=db >> .env
  1. Start postgres with docker-compose and disconnect.
docker compose up

Verify, that postgres is up and running, by connecting with your client, i prefer sqltools vscodium extension with postgres driver. Alternatively you can use pgadmin or another postgres UI of your preference.

2. Minio

  1. SSH into minio vm.
ssh user@vm
  1. Clone infrastructure repository.
git clone https://fmnx.su/core/infr
  1. Cd into minio folder.
cd infr/minio
  1. Add minio credentials to .env file. Save credentials to apply to gitea lates.
echo MINIO_ACCESS_KEY=123456 >> .env
echo MINIO_SECRET_KEY=987654321 >> .env
  1. Start minio with docker-compose.
docker compose up

3. Docker-email

  1. SSH into email vm.
ssh user@vm
  1. Clone infrastructure repository.
git clone https://fmnx.su/core/infr
  1. Cd into email-server folder.
cd infr/mail
  1. Obtain sertificates from letsencrypt. Before that you should ensure, that you have proper routing adjusted in your DNS server, and traffic from domain can reach the email VM. Script uses letsencrypt for obtaining TLS sertificates.
docker run --rm -it -v "$(pwd)/data/certbot/certs/:/etc/letsencrypt/" -v "$(pwd)/data/certbot/logs/:/var/log/letsencrypt/" -p 80:80 docker.io/certbot/certbot certonly --standalone -d mail.example.com
  1. Attach shell to docker-email container, add new users and obtain DKIM.
docker exec -it mail setup email add help@example.com password
docker exec -ti mail setup config dkim example.com
  1. Restart setup with docker-compose for DKIM and email to start working properly.
docker compose down
docker compose up

4. Gitea

  1. SSH into gitea vm.
ssh user@vm
  1. Clone infrastructure repository.
git clone https://fmnx.su/core/infr
  1. Cd into gitea folder.
cd infr/gitea
  1. Obtain certificates secure connection with lego docker.
docker run --rm -it -p 80:80 -p 443:443 -w /wd -v $PWD:/wd docker.io/goacme/lego --email="name@example.com" --domains="example.com" --http run
sudo chmod a+rwx -R .lego
  1. Add parameters for gitea, postgres, minio and mailer.
echo POSTGRES_HOST=postgres:5432 >> .env
echo POSTGRES_DB=db >> .env
echo POSTGRES_USER=user >> .env
echo POSTGRES_PASSWORD=password >> .env

echo DOMAIN=example.com >> .env

echo MAIL_ADDR=help@example.com >> .env
echo MAIL_PASS=12345 >> .env

echo MINIO_ENDPOINT=minio:9000 >> .env
echo MINIO_ACCESS_KEY_ID=123456 >> .env
echo MINIO_SECRET_ACCESS_KEY=987654321 >> .env
  1. Run gitea with docker.
docker compose up