Skip to content

Commit 66ddcb0

Browse files
committed
Deploy multipass
1 parent 8425073 commit 66ddcb0

File tree

4 files changed

+168
-1
lines changed

4 files changed

+168
-1
lines changed
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Build and Deploy Multipass
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'multipass/**'
8+
workflow_dispatch:
9+
10+
env:
11+
REGISTRY: ghcr.io
12+
IMAGE_NAME: ${{ github.repository }}/multipass
13+
14+
jobs:
15+
build-and-push:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
packages: write
20+
outputs:
21+
image-tag: ${{ steps.meta.outputs.tags }}
22+
image-digest: ${{ steps.build.outputs.digest }}
23+
version: ${{ steps.version.outputs.version }}
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
29+
- name: Generate version
30+
id: version
31+
run: |
32+
VERSION=$(date +%Y%m%d-%H%M%S)-$(git rev-parse --short HEAD)
33+
echo "version=$VERSION" >> $GITHUB_OUTPUT
34+
echo "Generated version: $VERSION"
35+
36+
- name: Log in to Container Registry
37+
uses: docker/login-action@v3
38+
with:
39+
registry: ${{ env.REGISTRY }}
40+
username: ${{ github.actor }}
41+
password: ${{ secrets.GITHUB_TOKEN }}
42+
43+
- name: Extract metadata
44+
id: meta
45+
uses: docker/metadata-action@v5
46+
with:
47+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
48+
tags: |
49+
type=raw,value=${{ steps.version.outputs.version }}
50+
type=raw,value=latest
51+
52+
- name: Build and push Docker image
53+
id: build
54+
uses: docker/build-push-action@v5
55+
with:
56+
context: ./multipass
57+
push: true
58+
tags: ${{ steps.meta.outputs.tags }}
59+
labels: ${{ steps.meta.outputs.labels }}
60+
61+
update-deployment:
62+
needs: build-and-push
63+
runs-on: ubuntu-latest
64+
permissions:
65+
contents: write
66+
pull-requests: write
67+
68+
steps:
69+
- name: Checkout repository
70+
uses: actions/checkout@v4
71+
with:
72+
token: ${{ secrets.GITHUB_TOKEN }}
73+
74+
- name: Update multipass version in ansible variables
75+
run: |
76+
VERSION="${{ needs.build-and-push.outputs.version }}"
77+
78+
# Update the multipass container version in ansible variables
79+
sed -i "s/container_version: .*/container_version: \"$VERSION\"/" \
80+
ansible/inventory/group_vars/all.yml
81+
82+
- name: Commit and push changes
83+
run: |
84+
git config --local user.email "action@github.com"
85+
git config --local user.name "GitHub Action"
86+
87+
if git diff --quiet; then
88+
echo "No changes to commit"
89+
exit 0
90+
fi
91+
92+
git add ansible/inventory/group_vars/all.yml
93+
git commit -m "chore: update multipass container to ${{ needs.build-and-push.outputs.version }}"
94+
git push

ansible/inventory/group_vars/all.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,4 +290,21 @@ doubletake:
290290
291291
shlink:
292292
image: shlinkio/shlink:stable
293-
domain: go.sequoiafabrica.org
293+
domain: go.sequoiafabrica.org
294+
295+
multipass:
296+
container_version: "latest"
297+
port: 3005
298+
data_location: "/opt/multipass"
299+
authentik_url: "https://login.sequoia.garden"
300+
authentik_api_token: !vault |
301+
$ANSIBLE_VAULT;1.1;AES256
302+
66653566386539316330623233323430343061303664313136303065343430633566303665363465
303+
3363396362313739313761623961323037623834336132620a636639666161633936633461356533
304+
64303333346237323861313063656430636532646430656432623565616163313565366237623464
305+
6266353130363537380a643439373361633037626636623862656237616365336330346535366432
306+
37343239663432373931316238363832383737633865313463343232633963636333363564383463
307+
36373938336634363338353934643332626163303534373462323761336265653438663663313530
308+
613935363537303166636431666231366130
309+
makerspace_name: "Sequoia Fabrica"
310+
trusted_proxy_headers: true

ansible/roles/sequoia_fabrica/tasks/nursery_apps.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,3 +524,51 @@
524524
ports:
525525
- 3003:3000
526526
- 3004:8080
527+
528+
## Multipass - Digital Makerspace ID System
529+
- name: Create multipass data directory
530+
become: true
531+
ansible.builtin.file:
532+
path: "{{ multipass.data_location }}"
533+
state: directory
534+
owner: root
535+
group: root
536+
mode: ug=rwx,o=rx
537+
- name: Create multipass config directory
538+
become: true
539+
ansible.builtin.file:
540+
path: "{{ multipass.data_location }}/config"
541+
state: directory
542+
owner: root
543+
group: root
544+
mode: ug=rwx,o=rx
545+
- name: Template multipass group mapping config
546+
become: true
547+
ansible.builtin.template:
548+
src: multipass.group_mapping.yaml.j2
549+
dest: "{{ multipass.data_location }}/config/group_mapping.yaml"
550+
owner: root
551+
group: root
552+
mode: ug=rw,o=r
553+
- name: Run multipass
554+
become: true
555+
community.docker.docker_container:
556+
name: multipass
557+
image: ghcr.io/sequoia-fabrica/infrastructure/multipass:{{ multipass.container_version }}
558+
pull: always
559+
restart_policy: unless-stopped
560+
ports:
561+
- "{{ multipass.port }}:3000"
562+
env:
563+
AUTHENTIK_URL: "{{ multipass.authentik_url }}"
564+
AUTHENTIK_API_TOKEN: "{{ multipass.authentik_api_token }}"
565+
BIND_ADDRESS: "0.0.0.0:3000"
566+
MAKERSPACE_NAME: "{{ multipass.makerspace_name }}"
567+
MAKERSPACE_LOGO_URL: "/static/images/logo.png"
568+
TRUSTED_PROXY_HEADERS: "{{ multipass.trusted_proxy_headers | string | lower }}"
569+
GROUP_MAPPING_CONFIG: "/config/group_mapping.yaml"
570+
mounts:
571+
- type: bind
572+
source: "{{ multipass.data_location }}/config"
573+
target: /config
574+
read_only: true
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Group mapping configuration for Multipass
2+
# Maps Authentik groups to access levels
3+
mappings:
4+
volunteers-limited: "LimitedVolunteer"
5+
Members: "FullMember"
6+
staff: "Staff"
7+
admin: "Admin"
8+
default_level: "NoAccess"

0 commit comments

Comments
 (0)