Add initial working state

This commit is contained in:
h 2025-03-12 16:27:36 -07:00
commit 99b1b78cfc
Signed by: 9pfs
SSH key fingerprint: SHA256:jgJ8oy3dFgbNXEiRdZlbUhItY8fbh4UvvJ2qhxoOC88
3 changed files with 80 additions and 0 deletions

62
deploy.yml Normal file
View file

@ -0,0 +1,62 @@
- name: Deploy vencloud
hosts: all
remote_user: root
tasks:
- name: Set architecture specific variables
set_fact:
arch: "{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}"
- name: Create vencloud user
ansible.builtin.user:
name: vencloud
system: true
comment: vencloud service user
shell: /usr/bin/bash
- name: Install dependencies
ansible.builtin.package:
name: sudo,git
state: present
- name: Clone vencloud repository
ansible.builtin.git:
repo: 'https://github.com/vencord/vencloud'
dest: /home/vencloud/vencloud
become: true
become_user: vencloud
- name: Download golang
ansible.builtin.get_url:
url: https://go.dev/dl/go1.24.1.linux-{{arch}}.tar.gz
dest: /home/vencloud/golang.tar.gz
checksum: sha256:cb2396bae64183cdccf81a9a6df0aea3bce9511fc21469fb89a0c00470088073
become: true
become_user: vencloud
register: golang_download
- name: Delete old golang
ansible.builtin.file:
path: /home/vencloud/go
state: absent
when: golang_download.changed
become: true
become_user: vencloud
- name: Extract golang
ansible.builtin.unarchive:
src: /tmp/golang.tar.gz
dest: /home/vencloud
remote_src: true
when: golang_download.changed
become: true
become_user: vencloud
- name: Build vencloud
ansible.builtin.command:
cmd: /home/vencloud/go/bin/go build -o backend
chdir: /home/vencloud/vencloud
become: true
become_user: vencloud
- name: Upload systemd service file
ansible.builtin.copy:
src: vencloud.service
dest: /etc/systemd/system/vencloud.service
- name: Restart vencloud
ansible.builtin.systemd:
name: vencloud
state: restarted
enabled: true
daemon_reload: true

3
inventory.yml Normal file
View file

@ -0,0 +1,3 @@
all:
hosts:
vencloud:

15
vencloud.service Normal file
View file

@ -0,0 +1,15 @@
[Unit]
Description=Vencord cloud settings server
After=network-online.target
ConditionPathExists=/home/vencloud/vencloud/.env
[Service]
ExecStart=/home/vencloud/vencloud/backend
User=vencloud
ProtectHome=read-only
ProtectSystem=strict
NoNewPrivileges=true
EnvironmentFile=/home/vencloud/vencloud/.env
[Install]
WantedBy=multi-user.target