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

containerize things for shadow move #175

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/pkg-mdbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: mdbook Service Container
on:
workflow_dispatch:
pull_request:
branches:
- master
paths:
- services/pkg/mdbook/**
push:
branches:
- master
paths:
- services/pkg/mdbook/**

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
main:
uses: ./.github/workflows/build-pkg.yml
with:
service_name: mdbook
23 changes: 23 additions & 0 deletions .github/workflows/pkg-xlocate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: xlocate Service Container
on:
workflow_dispatch:
pull_request:
branches:
- master
paths:
- services/pkg/xlocate/**
push:
branches:
- master
paths:
- services/pkg/xlocate/**

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
main:
uses: ./.github/workflows/build-pkg.yml
with:
service_name: xlocate
23 changes: 23 additions & 0 deletions .github/workflows/pkg-xq-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: xq-api Service Container
on:
workflow_dispatch:
pull_request:
branches:
- master
paths:
- services/pkg/xq-api/**
push:
branches:
- master
paths:
- services/pkg/xq-api/**

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
main:
uses: ./.github/workflows/build-pkg.yml
with:
service_name: xq-api
38 changes: 38 additions & 0 deletions services/nomad/apps/void-docs.nomad
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
job "void-docs" {
datacenters = ["VOID"]
namespace = "apps"
type = "batch"

periodic {
crons = ["@hourly"]
prohibit_overlap = true
}

group "app" {
count = 1

volume "root-mirror" {
type = "host"
source = "root_mirror"
read_only = false
}

task "void-docs" {
driver = "docker"

config {
image = "ghcr.io/void-linux/infra-mdbook:20231023R1"
}

env {
OUTDIR = "/mirror/docs"
REPO_URL = "https://github.com/void-linux/void-docs.git"
}

volume_mount {
volume = "root-mirror"
destination = "/mirror"
}
}
}
}
37 changes: 37 additions & 0 deletions services/nomad/apps/void-updates.nomad
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
job "void-updates" {
datacenters = ["VOID"]
namespace = "apps"
type = "batch"

periodic {
crons = ["0 4 * * *"]
prohibit_overlap = true
}

group "app" {
count = 1

volume "root-mirror" {
type = "host"
source = "root_mirror"
read_only = false
}

task "void-updates" {
driver = "docker"

config {
image = "ghcr.io/void-linux/void-updates:20231023R1"
}

env {
OUTDIR = "/mirror/void-updates"
}

volume_mount {
volume = "root-mirror"
destination = "/mirror"
}
}
}
}
48 changes: 48 additions & 0 deletions services/nomad/apps/xlocate.nomad
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
job "xlocate" {
datacenters = ["VOID"]
namespace = "apps"
type = "batch"

periodic {
crons = ["0 6 * * *"]
prohibit_overlap = true
}

group "app" {
count = 1

volume "root-mirror" {
type = "host"
source = "root_mirror"
read_only = false
}

task "xlocate" {
driver = "docker"

config {
image = "ghcr.io/void-linux/infra-xlocate:20231023R1"
volumes = [ "local/xbps.conf:/etc/xbps.d/00-repository-main.conf" ]
}

env {
XLOCATE_GIT = "/mirror/xlocate/xlocate.git"
}

volume_mount {
volume = "root-mirror"
destination = "/mirror"
}

template {
data = <<EOF
repository=/mirror/current
repository=/mirror/current/nonfree
repository=/mirror/current/multilib
repository=/mirror/current/multilib/nonfree
EOF
destination = "local/xbps.conf"
}
}
}
}
42 changes: 42 additions & 0 deletions services/nomad/apps/xq-api.nomad
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
job "xq-api" {
datacenters = ["VOID-MIRROR"]
namespace = "apps"
type = "system"
Copy link
Member Author

@classabbyamp classabbyamp Oct 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might need to investigate whether system or service is best for this. nilium says it shouldn't really be an issue to be system.


group "xq-api" {
count = 1

volume "dist_mirror" {
type = "host"
source = "dist_mirror"
read_only = true
}

network {
mode = "bridge"
port "http" { to = 8197 }
}

service {
name = "xq-api"
port = "http"
meta {
nginx_enable = "true"
nginx_names = "xq-api.voidlinux.org"
}
}

task "man-cgi" {
driver = "docker"

config {
image = "ghcr.io/void-linux/infra-xq-api:20231023R1"
}

volume_mount {
volume = "dist_mirror"
destination = "/mirror"
}
}
}
}
15 changes: 15 additions & 0 deletions services/pkg/docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ target "infra-man-cgi" {
context = "services/pkg/man-cgi/"
}

target "infra-mdbook" {
inherits = ["_common-glibc"]
context = "services/pkg/mdbook/"
}

target "infra-nginx" {
inherits = ["_common-glibc"]
context = "services/pkg/nginx/"
Expand All @@ -65,7 +70,17 @@ target "infra-sftpgo" {
context = "services/pkg/sftpgo/"
}

target "infra-xlocate" {
inherits = ["_common-glibc"]
context = "services/pkg/xlocate/"
}

target "infra-xmandump" {
inherits = ["_common-glibc"]
context = "services/pkg/xmandump/"
}

target "infra-xq-api" {
inherits = ["_common-glibc"]
context = "services/pkg/xq-api/"
}
10 changes: 10 additions & 0 deletions services/pkg/mdbook/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM ghcr.io/void-linux/void-glibc-full:latest

RUN xbps-install -Suy xbps && xbps-install -y tini mdBook rsync git && \
rm -rf /var/cache/xbps

WORKDIR /mdbook
COPY build.sh build

ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["/mdbook/build"]
5 changes: 5 additions & 0 deletions services/pkg/mdbook/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
set -eu
git clone --filter=tree:0 "${REPO_URL}" /mdbook/repo
mdbook build -d /mdbook/book/ /mdbook/repo/
rsync -a --delete /mdbook/book/html/* "${OUTDIR:-/out}"
7 changes: 7 additions & 0 deletions services/pkg/xlocate/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM ghcr.io/void-linux/void-glibc-full:latest

RUN xbps-install -Suy xbps && xbps-install -y xtools tini && \
rm -rf /var/cache/xbps

ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["/usr/bin/xlocate", "-g"]
7 changes: 7 additions & 0 deletions services/pkg/xq-api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM ghcr.io/void-linux/void-glibc:latest

RUN xbps-install -Suy xbps && xbps-install -y xq-api tini && \
rm -rf /var/cache/xbps

ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["/usr/bin/xq-api", "-listen", "0.0.0.0:8197", "-reload-every", "5m", "/mirror"]
7 changes: 0 additions & 7 deletions terraform/do/dns.tf
Original file line number Diff line number Diff line change
Expand Up @@ -366,13 +366,6 @@ resource "digitalocean_record" "xmirror" {
value = "void-linux.github.io."
}

resource "digitalocean_record" "xqapi" {
domain = digitalocean_domain.voidlinux_org.name
type = "CNAME"
name = "xq-api"
value = "a-hel-fi.m.${digitalocean_domain.voidlinux_org.name}."
}

################################################################
# Mirrors #
# #
Expand Down