gitea install script; rename resolvers; fix lfs

This commit is contained in:
Keiran Snowden
2023-11-27 19:44:34 -05:00
parent 5be2a914ac
commit 1f89c93f30
8 changed files with 27 additions and 10 deletions

View File

@@ -21,8 +21,9 @@ sections:
ROOT_URL: https://localhost/
DISABLE_SSH: 'true'
LFS_START_SERVER: 'false'
LFS_CONTENT_PATH: data/lfs
OFFLINE_MODE: 'true'
lfs:
PATH: data/lfs
mailer:
ENABLED: 'false'
service:

17
gitea/files/install.sh Normal file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
{% set gitea_version = salt.pillar.get('gitea:version') %}
{% set base_path = salt.pillar.get('gitea:path') %}
URL="https://github.com/go-gitea/gitea/releases/download/v{{ gitea_version }}/gitea-{{ gitea_version }}-linux-amd64"
# We can't replace the gitea bin while it's running
systemctl stop gitea || true
wget --quiet "${URL}" -O "{{ base_path }}/bin/gitea.tmp"
if [ $? -eq 0 ]; then
chmod +x "{{ base_path }}/bin/gitea.tmp"
mv -v "{{ base_path }}/bin/gitea.tmp" "{{ base_path }}/bin/gitea"
else
rm -f "{{ base_path }}/bin/gitea.tmp"
exit 1
fi

View File

@@ -1,15 +1,13 @@
{% set ver = salt.pillar.get('gitea:version') %}
{% set url = 'https://github.com/go-gitea/gitea/releases/download/v' +
ver + '/gitea-' + ver + '-linux-amd64'
%}
{% set basepath = salt.pillar.get('gitea:path') %}
# FIXME: this could be file.managed with source_hash set
'download gitea':
cmd.run:
- name: 'wget {{ url }} -O {{ basepath }}/bin/gitea && chmod +x {{ basepath }}/bin/gitea && echo {{ ver }} > {{ basepath }}/VERSION'
- unless: grep -P '^{{ ver }}$' {{ basepath }}/VERSION
cmd.script:
- shell: /bin/bash
- source: 'salt://gitea/files/install.sh'
- runas: {{ salt.pillar.get('gitea:user') }}
- template: jinja
- unless: "{{ basepath }}/bin/gitea --version | grep 'Gitea version {{ ver }} '"
- require:
- sls: gitea.dirs

View File

@@ -14,4 +14,5 @@ gitea:
- watch:
- file: /etc/systemd/system/gitea.service
- file: {{ salt.pillar.get('gitea:path') }}/etc/app.ini
- cmd: download gitea

View File

@@ -25,7 +25,7 @@ restic-{{ name }}:
cmd.script:
- shell: /bin/bash
- source: 'salt://restic/files/install.sh'
- templates: jinja
- template: jinja
- unless: "/bin/restic version | grep 'restic 0.16.2 '"
- env:
- RESTIC_VERSION: 0.16.2

View File

@@ -8,7 +8,7 @@
{% endif %}
'*.keiran.us':
- firewall
- resolv
- resolvers
'vps47492.inmotionhosting.com':
- gitea
'kpi.keiran.us':