Skip to content

Repository files navigation

Deployment Service

Service to manage the CI/CD of ansonallard.com self hosted services.

Start Service

  1. Copy .env.sample to .env
  2. Fill out all required values
  3. Run go build .
  4. Execute the binary file, ./deployment-service

Update service version

  1. Commit all changes
  2. Run update_service_version.sh -v <semverVersion>

Running in Production

Linux Firewall rules

Ensure that the linux host running the binary allows traffic from external hosts on the port.

Check this using:

sudo ufw status verbose

Add firewall rule using:

sudo ufw allow <port>>/tcp
sudo ufw reload

Docker Configuration

See instructions for communicating with Gitea here: https://github.com/ansonallard/gitea_config

Pulling Autogenerated Typescript Clients

Configure your ~/.npmrc with the following:

registry=https://registry.npmjs.org/

@ansonallard:registry=https://artifacts.ansonallard.com/api/packages/ansonallard/npm/
//artifacts.ansonallard.com/api/packages/ansonallard/npm/:_authToken=<PAT>

Where the <PAT> is your gitea PAT.

Pulling Autogenerated Go Clients

Configure the following Go Env Vars:

GONOSUMDB=artifacts.ansonallard.com \
GOPROXY=https://<USER>:<PAT>@artifacts.ansonallard.com/api/packages/ansonallard/go,https://proxy.golang.org,direct \
go get -x artifacts.ansonallard.com/ansonallard/<Package>@<Version>

Where <USER> is your gitea user and <PAT> is your gitea user's PAT.

Configure separate docker daemon

The build and deployment mechanisms must use separate docker daemons to avoid races.

Here's how to set it up.

  1. Create a separate data dir, like sudo mkdir -p /var/lib/<new-docker-socket>
  2. Configure the following in /etc/docker/<new-docker-socket>.json
{
  "data-root": "/mnt/Storage1/<new-docker-socket>/data_root",
  "insecure-registries": [], // Applicable only to route around cloudflare bandwidth limits on free tier
  "hosts": ["unix:///var/run/<new-docker-socket>sock"],
  "pidfile": "/var/run/<new-docker-socket>.pid"
}
  1. Under /lib/systemd/system, run sudo cp docker.service <new-docker-socket>.service
  2. Edit the new service file, exit ExecStart=/usr/bin/dockerd --config-file=/etc/docker/<new-docker-socket>.json
  3. Run the following
sudo systemctl daemon-reload
sudo systemctl enable <new-docker-socket>
sudo systemctl start <new-docker-socket>
  1. Access CLI via: DOCKER_HOST=unix:///var/run/<new-docker-socket>.sock docker ps

About

Service for managing self hosted based deployments

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages