upgrade to v7.0.2; added checks to upgrade task
This commit is contained in:
parent
faf1fb5895
commit
c96de0c9f1
5 changed files with 116 additions and 43 deletions
2
Vagrantfile
vendored
2
Vagrantfile
vendored
|
@ -8,7 +8,7 @@
|
|||
Vagrant.configure("2") do |config|
|
||||
#config.ssh.insert_key = false
|
||||
config.vm.define "forgejo" do |forgejo|
|
||||
forgejo.vm.box = "generic/debian11"
|
||||
forgejo.vm.box = "generic/debian12"
|
||||
forgejo.vm.provider :libvirt do |libvirt|
|
||||
libvirt.memory = 256
|
||||
end
|
||||
|
|
|
@ -7,7 +7,8 @@ forgejo_group: 'git'
|
|||
forgejo_confdir: '/etc/forgejo/app.ini'
|
||||
|
||||
forgejo_flavor: 'forgejo'
|
||||
forgejo_version: '1.21.7-0'
|
||||
forgejo_version: '7.0.2'
|
||||
#forgejo_version: '1.21.7-0'
|
||||
forgejo_arch: 'linux-amd64'
|
||||
#forgejo_download_url: 'https://github.com/go-gitea/gitea/releases/download/v{{ forgejo_version }}/gitea-{{ forgejo_version }}-{{ forgejo_arch }}'
|
||||
|
||||
|
@ -31,8 +32,8 @@ forgejo_oauth2_config:
|
|||
- 'JWT_SECRET = ' #41 random chars
|
||||
|
||||
forgejo_ui_config:
|
||||
- 'THEMES = auto,arc-green,gitea,forgejo-auto,forgejo-light,forgejo-dark' # add only the default ones, not themes ones
|
||||
- 'DEFAULT_THEME = arc-green'
|
||||
- 'THEMES = gitea-auto,gitea-light,gitea-dark,forgejo-auto,forgejo-light,forgejo-dark' # add only the default ones, not themes ones
|
||||
- 'DEFAULT_THEME = gitea-dark'
|
||||
|
||||
forgejo_security_config:
|
||||
- 'INTERNAL_TOKEN = ' #106 random chars
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
---
|
||||
|
||||
- name: '[INSTALL] - Install dependencies'
|
||||
apt:
|
||||
name: "{{ forgejo_apt_list }}"
|
||||
update_cache: yes
|
||||
|
||||
- name: '[INSTALL] - Get forgejo download url'
|
||||
shell:
|
||||
cmd: wget -O - https://codeberg.org/forgejo/forgejo/releases | grep -B 1 forgejo-{{ forgejo_version }}-{{ forgejo_arch }}\< | sed -n 's/.*href="\(.*\)".*/\1/p'
|
||||
register: forgejo_url
|
||||
when: forgejo_flavor == 'forgejo'
|
||||
|
||||
- name: "[INSTALL] - Set forgejo download url"
|
||||
set_fact:
|
||||
forgejo_download_url: '{{ forgejo_url.stdout }}'
|
||||
when: forgejo_flavor == 'forgejo'
|
||||
|
||||
- name: '[INSTALL] - Download forgejo binary'
|
||||
get_url:
|
||||
url: '{{ forgejo_download_url }}'
|
||||
dest: '{{ forgejo_bindir }}/forgejo'
|
||||
mode: '0750'
|
||||
owner: '{{ forgejo_user }}'
|
||||
group: '{{ forgejo_group }}'
|
||||
force: 'yes'
|
||||
notify: 'Restart forgejo'
|
||||
|
||||
- name: '[INSTALL] - Set /etc/forgejo rights to read-only'
|
||||
file:
|
||||
path: '/etc/forgejo'
|
||||
mode: '0750'
|
||||
|
||||
- name: '[INSTALL] - Set app.ini rights to read-only'
|
||||
file:
|
||||
path: '/etc/forgejo/app.ini'
|
||||
mode: '0640'
|
109
tasks/install_upgrade.yml
Normal file
109
tasks/install_upgrade.yml
Normal file
|
@ -0,0 +1,109 @@
|
|||
---
|
||||
|
||||
- name: '[INSTALL] - Install dependencies'
|
||||
apt:
|
||||
name: "{{ forgejo_apt_list }}"
|
||||
update_cache: yes
|
||||
|
||||
- name: '[INSTALL] - Get forgejo download url'
|
||||
shell:
|
||||
cmd: wget -O - https://codeberg.org/forgejo/forgejo/releases | grep -B 1 forgejo-{{ forgejo_version }}-{{ forgejo_arch }}\< | sed -n 's/.*href="\(.*\)".*/\1/p'
|
||||
register: forgejo_url
|
||||
when: forgejo_flavor == 'forgejo'
|
||||
|
||||
- name: "[INSTALL] - Set forgejo download url"
|
||||
set_fact:
|
||||
forgejo_download_url: '{{ forgejo_url.stdout }}'
|
||||
when: forgejo_flavor == 'forgejo'
|
||||
|
||||
- name: '[INSTALL] - Check if forgejo is installed'
|
||||
shell:
|
||||
cmd: '{{ forgejo_bindir }}/forgejo --version -c {{ forgejo_confdir }}'
|
||||
register: forgejo_is_installed
|
||||
|
||||
- name: '[UPGRADE] - Check forgejo health'
|
||||
shell:
|
||||
cmd: '{{ forgejo_bindir }}/forgejo doctor check --all -c {{ forgejo_confdir }}'
|
||||
become: 'yes'
|
||||
become_user: '{{ forgejo_user }}'
|
||||
register: forgejo_health
|
||||
|
||||
- name: '[UPGRADE] - Restart forgejo'
|
||||
systemd:
|
||||
name: forgejo
|
||||
state: restarted
|
||||
when:
|
||||
- forgejo_is_installed.rc == 0
|
||||
- forgejo_health.rc == 0
|
||||
|
||||
- name: '[UPGRADE] - Wait for forgejo to be back online'
|
||||
pause:
|
||||
seconds: 10
|
||||
|
||||
- name: '[UPGRADE] - Flush all queues'
|
||||
shell:
|
||||
cmd: '{{ forgejo_bindir }}/forgejo manager flush-queues -c {{ forgejo_confdir }}'
|
||||
become: 'yes'
|
||||
become_user: '{{ forgejo_user }}'
|
||||
when:
|
||||
- forgejo_is_installed.rc == 0
|
||||
- forgejo_health.rc == 0
|
||||
|
||||
- name: '[UPGRADE] - Stop forgejo'
|
||||
systemd:
|
||||
name: forgejo
|
||||
state: stopped
|
||||
when:
|
||||
- forgejo_is_installed.rc == 0
|
||||
- forgejo_health.rc == 0
|
||||
|
||||
|
||||
- name: '[INSTALL] - Download forgejo binary'
|
||||
get_url:
|
||||
url: '{{ forgejo_download_url }}'
|
||||
dest: '{{ forgejo_bindir }}/forgejo'
|
||||
mode: '0750'
|
||||
owner: '{{ forgejo_user }}'
|
||||
group: '{{ forgejo_group }}'
|
||||
force: 'yes'
|
||||
notify: 'Restart forgejo'
|
||||
|
||||
|
||||
- name: '[INSTALL] - Set /etc/forgejo rights to read-only'
|
||||
file:
|
||||
path: '/etc/forgejo'
|
||||
mode: '0750'
|
||||
|
||||
- name: '[INSTALL] - Set app.ini rights to read-only'
|
||||
file:
|
||||
path: '/etc/forgejo/app.ini'
|
||||
mode: '0640'
|
||||
|
||||
- name: '[UPGRADE] - Start forgejo'
|
||||
systemd:
|
||||
name: forgejo
|
||||
state: started
|
||||
when:
|
||||
- forgejo_is_installed.rc == 0
|
||||
- forgejo_health.rc == 0
|
||||
|
||||
- name: '[UPGRADE] - Check forgejo health'
|
||||
shell:
|
||||
cmd: '{{ forgejo_bindir }}/forgejo doctor check --all -c {{ forgejo_confdir }}'
|
||||
become: 'yes'
|
||||
become_user: '{{ forgejo_user }}'
|
||||
register: forgejo_health
|
||||
|
||||
- name: '[UPGRADE] - Stop forgejo. Something is wrong'
|
||||
systemd:
|
||||
name: forgejo
|
||||
state: started
|
||||
when:
|
||||
- forgejo_health.rc != 0
|
||||
|
||||
- name: '[UPGRADE] - Display problem message'
|
||||
fail:
|
||||
msg: 'Forgejo doctor detected issues after upgrade task. Please check the instance manually and fix issues before continuing'
|
||||
when:
|
||||
- forgejo_health.rc != 0
|
||||
|
|
@ -7,8 +7,8 @@
|
|||
include_tasks: configure.yml
|
||||
tags: config
|
||||
|
||||
- name: "[FORGEJO] - install"
|
||||
include_tasks: install.yml
|
||||
- name: "[FORGEJO] - install or upgrade"
|
||||
include_tasks: install_upgrade.yml
|
||||
|
||||
- name: "[FORGEJO] - theme"
|
||||
include_tasks: custom_themes.yml
|
||||
|
|
Loading…
Reference in a new issue