change from gitea to forgejo (#31)

I just haven't changed the path

Co-authored-by: meaz <meaz@disroot.org>
Reviewed-on: #31
Reviewed-by: muppeth <muppeth@no-reply@disroot.org>
This commit is contained in:
meaz 2023-05-16 12:32:34 +00:00
parent 35bdc8f062
commit 53e11a8b98
13 changed files with 159 additions and 160 deletions

View File

@ -1,9 +1,9 @@
--- ---
- hosts: gitea - hosts: forgejo
roles: roles:
- postgresql - postgresql
- gitea - forgejo
vars_files: vars_files:
- ../defaults/main.yml - ../defaults/main.yml

View File

@ -1,13 +1,13 @@
# Gitea - Ansible Role # Forgejo - Ansible Role
This role covers deployment, configuration and software updates of Gitea/Forgejo. This role is released under MIT Licence and we give no warranty for this piece of software. Currently supported OS - Debian. This role covers deployment, configuration and software updates of Forgejo. This role is released under MIT Licence and we give no warranty for this piece of software. Currently supported OS - Debian.
You can deploy test instance using `Vagrantfile` attached to the role. You can deploy test instance using `Vagrantfile` attached to the role.
`vagrant up` `vagrant up`
`ansible-playbook -b Playbooks/gitea.yml` `ansible-playbook -b Playbooks/forgejo.yml`
Then you can then access gitea from your computer on `http://192.168.33.14:3000` Then you can then access forgejo from your computer on `http://192.168.33.14:3000`
# Gitea or Forgejo # Gitea or Forgejo
This role allows for deployment of gitea and forgejo. By default the role deploys forgejo and this is the flavor that is supported and maintained. Installing Gitea using the role is possible however starting from version 1.18.2 is no longer maintained by Disroot team. This role allows for deployment of gitea and forgejo. By default the role deploys forgejo and this is the flavor that is supported and maintained. Installing Gitea using the role is possible however starting from version 1.18.2 is no longer maintained by Disroot team.
@ -15,19 +15,19 @@ To switch to gitea, update following variables in your Playbook/host_vars:
``` ```
gitea_flavour: 'gitea' forgejo_flavour: 'gitea'
gitea_version: '1.18.2' forgejo_version: '1.18.2'
gitea_arch: 'linux-amd64' forgejo_arch: 'linux-amd64'
gitea_download_url: 'https://github.com/go-gitea/gitea/releases/download/v{{ gitea_version }}/gitea-{{ gitea_version }}-{{ gitea_arch }}' forgejo_download_url: 'https://github.com/go-gitea/gitea/releases/download/v{{ forgejo_version }}/gitea-{{ forgejo_version }}-{{ forgejo_arch }}'
``` ```
## Playbook ## Playbook
The playbook includes postgresql role and deploys entire stack needed to run Gitea. Additional roles are also available in the Ansible roles repos in git. The playbook includes postgresql role and deploys entire stack needed to run Forgejo. Additional roles are also available in the Ansible roles repos in git.
## Customization ## Customization
You can deploy custom themes with this role. To do so, uncomment `gitea_theme_dir` and `gitea_custom_themes` from `defaults/main.yml`. Add the theme repos' address and name there, enable them and then deploy with `ansible-playbook -b Playbooks/gitea.yml --tags theme`. You can deploy custom themes with this role. To do so, uncomment `forgejo_theme_dir` and `forgejo_custom_themes` from `defaults/main.yml`. Add the theme repos' address and name there, enable them and then deploy with `ansible-playbook -b Playbooks/forgejo.yml --tags theme`.
You can also add you own images like favicon, icons, etc. See https://docs.gitea.io/en-us/customizing-gitea/ to see how to prepare your images. You can also add you own images like favicon, icons, etc. See https://docs.gitea.io/en-us/customizing-gitea/ to see how to prepare your images.
Then, copy them in the `img` folder of this role and uncomment `gitea_extra_files_path` and `gitea_theme_dir` from `defaults/main.yml`. You can then deploy with `ansible-playbook -b Playbooks/gitea.yml --tags config`. Then, copy them in the `img` folder of this role and uncomment `forgejo_extra_files_path` and `forgejo_theme_dir` from `defaults/main.yml`. You can then deploy with `ansible-playbook -b Playbooks/forgejo.yml --tags config`.
For more information about customizaton, check https://docs.gitea.io/en-us/customizing-gitea/. For more information about customizaton, check https://docs.gitea.io/en-us/customizing-gitea/.

12
Vagrantfile vendored
View File

@ -7,14 +7,14 @@
# you're doing. # you're doing.
Vagrant.configure("2") do |config| Vagrant.configure("2") do |config|
#config.ssh.insert_key = false #config.ssh.insert_key = false
config.vm.define "gitea" do |gitea| config.vm.define "forgejo" do |forgejo|
gitea.vm.box = "generic/debian11" forgejo.vm.box = "generic/debian11"
gitea.vm.provider :libvirt do |libvirt| forgejo.vm.provider :libvirt do |libvirt|
libvirt.memory = 256 libvirt.memory = 256
end end
gitea.vm.network "forwarded_port", guest: 80, host: 8888, host_ip: "192.168.33.14" forgejo.vm.network "forwarded_port", guest: 80, host: 8888, host_ip: "192.168.33.14"
gitea.vm.network "forwarded_port", guest: 443, host: 4443, host_ip: "192.168.33.14" forgejo.vm.network "forwarded_port", guest: 443, host: 4443, host_ip: "192.168.33.14"
gitea.vm.network "private_network", ip: "192.168.33.14" forgejo.vm.network "private_network", ip: "192.168.33.14"
config.vm.provision "shell", inline: "apt install acl" config.vm.provision "shell", inline: "apt install acl"
end end
end end

View File

@ -1,55 +1,55 @@
--- ---
gitea_bindir: "/usr/local/bin/gitea" forgejo_bindir: "/usr/local/bin/forgejo"
gitea_lib_dir: "/var/lib/gitea" forgejo_lib_dir: "/var/lib/forgejo"
gitea_user: 'git' forgejo_user: 'git'
gitea_group: 'git' forgejo_group: 'git'
gitea_confdir: '/etc/gitea/app.ini' forgejo_confdir: '/etc/forgejo/app.ini'
gitea_flavor: 'forgejo' forgejo_flavor: 'forgejo'
gitea_version: '1.19.0-2' forgejo_version: '1.19.3-0'
gitea_arch: 'linux-amd64' forgejo_arch: 'linux-amd64'
#gitea_download_url: 'https://github.com/go-gitea/gitea/releases/download/v{{ gitea_version }}/gitea-{{ gitea_version }}-{{ gitea_arch }}' #forgejo_download_url: 'https://github.com/go-gitea/gitea/releases/download/v{{ forgejo_version }}/gitea-{{ forgejo_version }}-{{ forgejo_arch }}'
# Uncomment below if you want to add custom themes or images # Uncomment below if you want to add custom themes or images
#gitea_extra_files_path: '../img' # the folder name where you have the images you want to deploy #forgejo_extra_files_path: '../img' # the folder name where you have the images you want to deploy
#gitea_theme_dir: '{{ gitea_lib_dir }}/custom' #forgejo_theme_dir: '{{ forgejo_lib_dir }}/custom'
#gitea_custom_themes: #forgejo_custom_themes:
# - name: '' #add name of the theme # - name: '' #add name of the theme
# repo: '' #add git repository of the theme # repo: '' #add git repository of the theme
# enable: 'true' #set it to false to remove it # enable: 'true' #set it to false to remove it
#[CONFIG] #[CONFIG]
# App.ini file variables # App.ini file variables
gitea_base_config: forgejo_base_config:
- 'APP_NAME = Gitea: Git with a cup of tea' - 'APP_NAME = Forgejo: Beyond coding. We forge.'
- 'RUN_USER = git' - 'RUN_USER = git'
- 'RUN_MODE = prod' - 'RUN_MODE = prod'
gitea_oauth2_config: forgejo_oauth2_config:
- 'JWT_SECRET = ' #41 random chars - 'JWT_SECRET = ' #41 random chars
gitea_ui_config: forgejo_ui_config:
- 'THEMES = auto,arc-green,gitea,forgejo-auto,forgejo-light,forgejo-dark' # add only the default ones, not themes ones - 'THEMES = auto,arc-green,gitea,forgejo-auto,forgejo-light,forgejo-dark' # add only the default ones, not themes ones
- 'DEFAULT_THEME = arc-green' - 'DEFAULT_THEME = arc-green'
gitea_security_config: forgejo_security_config:
- 'INTERNAL_TOKEN = ' #106 random chars - 'INTERNAL_TOKEN = ' #106 random chars
- 'INSTALL_LOCK = true' - 'INSTALL_LOCK = true'
- 'SECRET_KEY = ' #64 random chars - 'SECRET_KEY = ' #64 random chars
gitea_database_config: forgejo_database_config:
- 'DB_TYPE = postgres' - 'DB_TYPE = postgres'
- 'HOST = localhost:5432' - 'HOST = localhost:5432'
- 'NAME = gitea' - 'NAME = forgejo'
- 'USER = admin' - 'USER = admin'
- 'PASSWD = changeme' - 'PASSWD = changeme'
- 'SSL_MODE = disable' - 'SSL_MODE = disable'
gitea_repository_config: forgejo_repository_config:
- 'ROOT = /home/git/gitea-repositories' - 'ROOT = /home/git/forgejo-repositories'
gitea_server_config: forgejo_server_config:
- 'SSH_DOMAIN = git.example.org' - 'SSH_DOMAIN = git.example.org'
- 'DOMAIN = 192.168.33.14' - 'DOMAIN = 192.168.33.14'
- 'HTTP_PORT = 3000' - 'HTTP_PORT = 3000'
@ -60,10 +60,10 @@ gitea_server_config:
- 'LFS_JWT_SECRET = ' #40 random chars - 'LFS_JWT_SECRET = ' #40 random chars
- 'OFFLINE_MODE = false' - 'OFFLINE_MODE = false'
gitea_lfs_config: forgejo_lfs_config:
- 'PATH = /home/git/data/lfs' - 'PATH = /home/git/data/lfs'
gitea_mailer_config: forgejo_mailer_config:
- 'ENABLED = true' - 'ENABLED = true'
- 'SMTP_ADDR = mail.example.org' - 'SMTP_ADDR = mail.example.org'
- 'SMTP_PORT = 587' - 'SMTP_PORT = 587'
@ -72,7 +72,7 @@ gitea_mailer_config:
- 'PASSWD = CHANGEME' #PASSWD - 'PASSWD = CHANGEME' #PASSWD
- 'PROTOCOL = smtp+starttls' - 'PROTOCOL = smtp+starttls'
gitea_service_config: forgejo_service_config:
- 'REGISTER_EMAIL_CONFIRM = false' - 'REGISTER_EMAIL_CONFIRM = false'
- 'ENABLE_NOTIFY_MAIL = false' - 'ENABLE_NOTIFY_MAIL = false'
- 'DISABLE_REGISTRATION = false' - 'DISABLE_REGISTRATION = false'
@ -84,28 +84,28 @@ gitea_service_config:
- 'DEFAULT_ENABLE_TIMETRACKING = true' - 'DEFAULT_ENABLE_TIMETRACKING = true'
- 'NO_REPLY_ADDRESS = noreply@example.org' - 'NO_REPLY_ADDRESS = noreply@example.org'
gitea_mirror_config: forgejo_mirror_config:
- 'ENABLED = true' - 'ENABLED = true'
gitea_picture_config: forgejo_picture_config:
- 'DISABLE_GRAVATAR = true' - 'DISABLE_GRAVATAR = true'
- 'ENABLE_FEDERATED_AVATAR = true' - 'ENABLE_FEDERATED_AVATAR = true'
gitea_openid_config: forgejo_openid_config:
- 'ENABLE_OPENID_SIGNIN = false' - 'ENABLE_OPENID_SIGNIN = false'
- 'ENABLE_OPENID_SIGNUP = false' - 'ENABLE_OPENID_SIGNUP = false'
gitea_session_config: forgejo_session_config:
- 'PROVIDER = file' - 'PROVIDER = file'
gitea_log_config: forgejo_log_config:
- 'MODE = file' - 'MODE = file'
- 'LEVEL = Info' - 'LEVEL = Info'
- 'ROOT_PATH = /home/git/log' - 'ROOT_PATH = /home/git/log'
# External renderers # External renderers
# See https://docs.gitea.io/en-us/external-renderers/ # See https://docs.gitea.io/en-us/external-renderers/
gitea_markup_config: forgejo_markup_config:
- name: 'asciidoc' - name: 'asciidoc'
apt: 'asciidoc' apt: 'asciidoc'
enable: 'false' enable: 'false'
@ -117,7 +117,7 @@ gitea_markup_config:
enable: 'false' enable: 'false'
#apt #apt
gitea_apt_list: forgejo_apt_list:
- git - git
# POSTGRES # POSTGRES
@ -131,7 +131,7 @@ postgresql_pg_hba_default:
- { type: host, database: all, user: all, address: '127.0.0.1/32', method: '{{ postgresql_default_auth_method_hosts }}', comment: 'IPv4 local connections:' } - { type: host, database: all, user: all, address: '127.0.0.1/32', method: '{{ postgresql_default_auth_method_hosts }}', comment: 'IPv4 local connections:' }
postgresql_databases: postgresql_databases:
- name: gitea - name: forgejo
owner: admin # optional; specify the owner of the database owner: admin # optional; specify the owner of the database
hstore: no # flag to install the hstore extension on this database (yes/no) hstore: no # flag to install the hstore extension on this database (yes/no)
uuid_ossp: no # flag to install the uuid-ossp extension on this database (yes/no) uuid_ossp: no # flag to install the uuid-ossp extension on this database (yes/no)
@ -144,6 +144,6 @@ postgresql_users:
postgresql_user_privileges: postgresql_user_privileges:
- name: admin # user name - name: admin # user name
db: gitea # database db: forgejo # database
priv: "ALL" # privilege string format: example: INSERT,UPDATE/table:SELECT/anothertable:ALL priv: "ALL" # privilege string format: example: INSERT,UPDATE/table:SELECT/anothertable:ALL
role_attr_flags: "" # role attribute flags role_attr_flags: "" # role attribute flags

View File

@ -1,6 +1,6 @@
--- ---
- name: 'Restart gitea' - name: 'Restart forgejo'
systemd: systemd:
name: gitea name: forgejo
state: restarted state: restarted

View File

@ -2,27 +2,27 @@
- name: '[DIR] - Create bin dir' - name: '[DIR] - Create bin dir'
file: file:
path: '{{ gitea_bindir }}' path: '{{ forgejo_bindir }}'
state: directory state: directory
owner: "{{ gitea_user }}" owner: "{{ forgejo_user }}"
group: "{{ gitea_group }}" group: "{{ forgejo_group }}"
mode: '0750' mode: '0750'
- name: '[DIR] - Create lib dir' - name: '[DIR] - Create lib dir'
file: file:
path: '{{ gitea_lib_dir }}' path: '{{ forgejo_lib_dir }}'
state: directory state: directory
mode: '0750' mode: '0750'
owner: "{{ gitea_user }}" owner: "{{ forgejo_user }}"
group: "{{ gitea_group }}" group: "{{ forgejo_group }}"
- name: '[DIR] - Create lib dirs' - name: '[DIR] - Create lib dirs'
file: file:
path: "{{ gitea_lib_dir }}/{{ item }}" path: "{{ forgejo_lib_dir }}/{{ item }}"
state: directory state: directory
mode: '0750' mode: '0750'
owner: "{{ gitea_user }}" owner: "{{ forgejo_user }}"
group: "{{ gitea_group }}" group: "{{ forgejo_group }}"
with_items: with_items:
- 'custom' - 'custom'
- 'data' - 'data'
@ -30,44 +30,44 @@
- name: '[DIR] - Create etc dir' - name: '[DIR] - Create etc dir'
file: file:
path: /etc/gitea path: /etc/forgejo
state: directory state: directory
mode: '0770' mode: '0770'
owner: "{{ gitea_user }}" owner: "{{ forgejo_user }}"
group: "{{ gitea_group }}" group: "{{ forgejo_group }}"
- name: '[CONF] - Deploy gitea config' - name: '[CONF] - Deploy forgejo config'
template: template:
src: etc/gitea/app.ini.j2 src: etc/forgejo/app.ini.j2
dest: "{{ gitea_confdir }}" dest: "{{ forgejo_confdir }}"
owner: "{{ gitea_user }}" owner: "{{ forgejo_user }}"
group: "{{ gitea_group }}" group: "{{ forgejo_group }}"
notify: Restart gitea notify: Restart forgejo
tags: config tags: config
- name: "[CONF] - Create img folder" - name: "[CONF] - Create img folder"
file: file:
path: "{{ gitea_theme_dir }}/public/img/" path: "{{ forgejo_theme_dir }}/public/img/"
state: 'directory' state: 'directory'
owner: '{{ gitea_user }}' owner: '{{ forgejo_user }}'
group: '{{ gitea_group }}' group: '{{ forgejo_group }}'
when: gitea_theme_dir is defined when: forgejo_theme_dir is defined
tags: config tags: config
- name: "[CONF] - Deploy img folder" - name: "[CONF] - Deploy img folder"
copy: copy:
src: '{{ gitea_extra_files_path }}/' src: '{{ forgejo_extra_files_path }}/'
dest: "{{ gitea_theme_dir }}/public/img/" dest: "{{ forgejo_theme_dir }}/public/img/"
owner: "{{ gitea_user }}" owner: "{{ forgejo_user }}"
group: "{{ gitea_group }}" group: "{{ forgejo_group }}"
mode: 0755 mode: 0755
when: gitea_theme_dir is defined when: forgejo_theme_dir is defined
tags: config tags: config
- name: '[CONF] - Install dependencies for renderers' - name: '[CONF] - Install dependencies for renderers'
apt: apt:
name: "{{ item.apt }}" name: "{{ item.apt }}"
update_cache: yes update_cache: yes
loop: "{{ gitea_markup_config }}" loop: "{{ forgejo_markup_config }}"
when: item.enable == 'true' and item.apt != "" when: item.enable == 'true' and item.apt != ""
tags: config tags: config

View File

@ -2,36 +2,36 @@
- name: '[THEME] - Create public dir' - name: '[THEME] - Create public dir'
file: file:
path: '{{ gitea_theme_dir }}/public/' path: '{{ forgejo_theme_dir }}/public/'
state: directory state: directory
owner: "{{ gitea_user }}" owner: "{{ forgejo_user }}"
group: "{{ gitea_group }}" group: "{{ forgejo_group }}"
tags: theme tags: theme
- name: '[THEME] - Create css dir' - name: '[THEME] - Create css dir'
file: file:
path: '{{ gitea_theme_dir }}/public/css' path: '{{ forgejo_theme_dir }}/public/css'
state: directory state: directory
owner: "{{ gitea_user }}" owner: "{{ forgejo_user }}"
group: "{{ gitea_group }}" group: "{{ forgejo_group }}"
tags: theme tags: theme
# First, remove the css files from public folder, then theme repos # First, remove the css files from public folder, then theme repos
- name: "[THEME] - Remove css files from the css folder" - name: "[THEME] - Remove css files from the css folder"
shell: shell:
cmd: find "{{ gitea_theme_dir }}/{{ item.name }}" -type f -name "*.css" -printf "%f\n" | xargs -I{} rm public/css/{} cmd: find "{{ forgejo_theme_dir }}/{{ item.name }}" -type f -name "*.css" -printf "%f\n" | xargs -I{} rm public/css/{}
chdir: "{{ gitea_theme_dir }}" chdir: "{{ forgejo_theme_dir }}"
loop: "{{ gitea_custom_themes }}" loop: "{{ forgejo_custom_themes }}"
when: item.enable == 'false' when: item.enable == 'false'
tags: theme tags: theme
- name: "[THEME] - Remove theme repo" - name: "[THEME] - Remove theme repo"
file: file:
path: "{{ gitea_theme_dir }}/{{ item.name }}" path: "{{ forgejo_theme_dir }}/{{ item.name }}"
state: absent state: absent
owner: "{{ gitea_user }}" owner: "{{ forgejo_user }}"
group: "{{ gitea_group }}" group: "{{ forgejo_group }}"
loop: "{{ gitea_custom_themes }}" loop: "{{ forgejo_custom_themes }}"
when: item.enable == 'false' when: item.enable == 'false'
tags: theme tags: theme
@ -39,32 +39,32 @@
- name: "[THEME] - Get repo" - name: "[THEME] - Get repo"
git: git:
repo: "{{ item.repo }}" repo: "{{ item.repo }}"
dest: "{{ gitea_theme_dir }}/{{ item.name }}" dest: "{{ forgejo_theme_dir }}/{{ item.name }}"
force: yes force: yes
loop: "{{ gitea_custom_themes }}" loop: "{{ forgejo_custom_themes }}"
when: item.enable == 'true' when: item.enable == 'true'
become: true become: true
become_user: "{{ gitea_user }}" become_user: "{{ forgejo_user }}"
tags: theme tags: theme
- name: "[THEME] - Find css files from different repos and copy them in the public folder" - name: "[THEME] - Find css files from different repos and copy them in the public folder"
shell: shell:
cmd: find "{{ gitea_theme_dir }}" -type f -name "*.css" -not -path "{{ gitea_theme_dir }}/public/*" | xargs cp -t "{{ gitea_theme_dir }}/public/css" cmd: find "{{ forgejo_theme_dir }}" -type f -name "*.css" -not -path "{{ forgejo_theme_dir }}/public/*" | xargs cp -t "{{ forgejo_theme_dir }}/public/css"
chdir: "{{ gitea_theme_dir }}" chdir: "{{ forgejo_theme_dir }}"
tags: theme tags: theme
# Lastly, update app.ini by adding the theme's name list. # Lastly, update app.ini by adding the theme's name list.
- name: "[THEME] - Get and prepare a list for app.ini of css files in public folder, register it" - name: "[THEME] - Get and prepare a list for app.ini of css files in public folder, register it"
shell: shell:
cmd: ls "{{ gitea_theme_dir }}/public/css" | sed -e 's/theme-//g' | sed -e 's/.css//g' | paste -s -d, cmd: ls "{{ forgejo_theme_dir }}/public/css" | sed -e 's/theme-//g' | sed -e 's/.css//g' | paste -s -d,
chdir: "{{ gitea_theme_dir }}" chdir: "{{ forgejo_theme_dir }}"
register: theme_name register: theme_name
tags: theme tags: theme
- name: "[THEME] - Add list of themes in app.ini" - name: "[THEME] - Add list of themes in app.ini"
lineinfile: lineinfile:
path: "{{ gitea_confdir }}" path: "{{ forgejo_confdir }}"
regexp: '^THEMES' regexp: '^THEMES'
line: "{{ gitea_ui_config[0] }},{{ theme_name.stdout }}" line: "{{ forgejo_ui_config[0] }},{{ theme_name.stdout }}"
notify: Restart gitea notify: Restart forgejo
tags: theme tags: theme

View File

@ -2,36 +2,36 @@
- name: '[INSTALL] - Install dependencies' - name: '[INSTALL] - Install dependencies'
apt: apt:
name: "{{ gitea_apt_list }}" name: "{{ forgejo_apt_list }}"
update_cache: yes update_cache: yes
- name: '[INSTALL] - Get forgejo download url' - name: '[INSTALL] - Get forgejo download url'
shell: shell:
cmd: wget -O - https://codeberg.org/forgejo/forgejo/releases | grep -B 1 forgejo-{{ gitea_version }}-{{ gitea_arch }}\< | sed -n 's/.*href="\(.*\)".*/\1/p' 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 register: forgejo_url
when: gitea_flavor == 'forgejo' when: forgejo_flavor == 'forgejo'
- name: "[INSTALL] - Set forgejo download url" - name: "[INSTALL] - Set forgejo download url"
set_fact: set_fact:
gitea_download_url: '{{ forgejo_url.stdout }}' forgejo_download_url: '{{ forgejo_url.stdout }}'
when: gitea_flavor == 'forgejo' when: forgejo_flavor == 'forgejo'
- name: '[INSTALL] - Download gitea binary' - name: '[INSTALL] - Download forgejo binary'
get_url: get_url:
url: '{{ gitea_download_url }}' url: '{{ forgejo_download_url }}'
dest: '{{ gitea_bindir }}/gitea' dest: '{{ forgejo_bindir }}/forgejo'
mode: '0750' mode: '0750'
owner: '{{ gitea_user }}' owner: '{{ forgejo_user }}'
group: '{{ gitea_group }}' group: '{{ forgejo_group }}'
force: 'yes' force: 'yes'
notify: 'Restart gitea' notify: 'Restart forgejo'
- name: '[INSTALL] - Set /etc/gitea rights to read-only' - name: '[INSTALL] - Set /etc/forgejo rights to read-only'
file: file:
path: '/etc/gitea' path: '/etc/forgejo'
mode: '0750' mode: '0750'
- name: '[INSTALL] - Set app.ini rights to read-only' - name: '[INSTALL] - Set app.ini rights to read-only'
file: file:
path: '/etc/gitea/app.ini' path: '/etc/forgejo/app.ini'
mode: '0640' mode: '0640'

View File

@ -1,19 +1,19 @@
--- ---
- name: "[GITEA]- Create user" - name: "[FORGEJO]- Create user"
include_tasks: user.yml include_tasks: user.yml
- name: "[GITEA] - configure" - name: "[FORGEJO] - configure"
include_tasks: configure.yml include_tasks: configure.yml
tags: config tags: config
- name: "[GITEA] - install" - name: "[FORGEJO] - install"
include_tasks: install.yml include_tasks: install.yml
- name: "[GITEA] - theme" - name: "[FORGEJO] - theme"
include_tasks: custom_themes.yml include_tasks: custom_themes.yml
when: gitea_custom_themes is defined when: forgejo_custom_themes is defined
tags: theme tags: theme
- name: "[GITEA] - systemd" - name: "[FORGEJO] - systemd"
include_tasks: systemd.yml include_tasks: systemd.yml

View File

@ -2,23 +2,23 @@
- name: '[SYSTEMD] - Deploy Systemd config' - name: '[SYSTEMD] - Deploy Systemd config'
template: template:
src: etc/systemd/system/gitea.service.j2 src: etc/systemd/system/forgejo.service.j2
dest: /etc/systemd/system/gitea.service dest: /etc/systemd/system/forgejo.service
owner: root owner: root
group: root group: root
mode: 0644 mode: 0644
register: gitea_systemd register: forgejo_systemd
- name: '[SYSTEMD] - Enable systemd' - name: '[SYSTEMD] - Enable systemd'
systemd: systemd:
name: gitea name: forgejo
enabled: yes enabled: yes
state: started state: started
daemon_reload: yes daemon_reload: yes
notify: Restart gitea notify: Restart forgejo
- name: "[SYSTEMD] - Daemon-reload" - name: "[SYSTEMD] - Daemon-reload"
systemd: systemd:
daemon_reload: yes daemon_reload: yes
name: gitea name: forgejo
when: gitea_systemd.changed when: forgejo_systemd.changed

View File

@ -2,11 +2,11 @@
- name: Add group - name: Add group
group: group:
name: '{{ gitea_group }}' name: '{{ forgejo_group }}'
state: present state: present
- name: Add user - name: Add user
user: user:
name: '{{ gitea_user }}' name: '{{ forgejo_user }}'
shell: /bin/bash shell: /bin/bash
group: '{{ gitea_group }}' group: '{{ forgejo_group }}'

View File

@ -1,84 +1,83 @@
# {{ ansible_managed }} # {{ ansible_managed }}
{% for item in gitea_base_config %} {% for item in forgejo_base_config %}
{{ item }} {{ item }}
{% endfor %} {% endfor %}
[oauth2] [oauth2]
{% for item in gitea_oauth2_config %} {% for item in forgejo_oauth2_config %}
{{ item }} {{ item }}
{% endfor %} {% endfor %}
[ui] [ui]
{% for item in gitea_ui_config %} {% for item in forgejo_ui_config %}
{{ item }} {{ item }}
{% endfor %} {% endfor %}
[security] [security]
{% for item in gitea_security_config %} {% for item in forgejo_security_config %}
{{ item }} {{ item }}
{% endfor %} {% endfor %}
[database] [database]
{% for item in gitea_database_config %} {% for item in forgejo_database_config %}
{{ item }} {{ item }}
{% endfor %} {% endfor %}
[repository] [repository]
{% for item in gitea_repository_config %} {% for item in forgejo_repository_config %}
{{ item }} {{ item }}
{% endfor %} {% endfor %}
[server] [server]
{% for item in gitea_server_config %} {% for item in forgejo_server_config %}
{{ item }} {{ item }}
{% endfor %} {% endfor %}
[lfs] [lfs]
{% for item in gitea_lfs_config %} {% for item in forgejo_lfs_config %}
{{ item }} {{ item }}
{% endfor %} {% endfor %}
[mailer] [mailer]
{% for item in gitea_mailer_config %} {% for item in forgejo_mailer_config %}
{{ item }} {{ item }}
{% endfor %} {% endfor %}
[service] [service]
{% for item in gitea_service_config %} {% for item in forgejo_service_config %}
{{ item }} {{ item }}
{% endfor %} {% endfor %}
[mirror] [mirror]
{% for item in gitea_mirror_config %} {% for item in forgejo_mirror_config %}
{{ item }} {{ item }}
{% endfor %} {% endfor %}
[picture] [picture]
{% for item in gitea_picture_config %} {% for item in forgejo_picture_config %}
{{ item }} {{ item }}
{% endfor %} {% endfor %}
[openid] [openid]
{% for item in gitea_openid_config %} {% for item in forgejo_openid_config %}
{{ item }} {{ item }}
{% endfor %} {% endfor %}
[session] [session]
{% for item in gitea_session_config %} {% for item in forgejo_session_config %}
{{ item }} {{ item }}
{% endfor %} {% endfor %}
[log] [log]
{% for item in gitea_log_config %} {% for item in forgejo_log_config %}
{{ item }} {{ item }}
{% endfor %} {% endfor %}
[markup] [markup]
{% for item in gitea_markup_config %} {% for item in forgejo_markup_config %}
{% if item.name == 'asciidoc' and item.enable == 'true' %} {% if item.name == 'asciidoc' and item.enable == 'true' %}
[markup.asciidoc] [markup.asciidoc]
ENABLED = true ENABLED = true

View File

@ -1,5 +1,5 @@
[Unit] [Unit]
Description=Gitea (Git with a cup of tea) Description=Forgejo (Git with a cup of tea)
After=syslog.target After=syslog.target
After=network.target After=network.target
#Requires=mysql.service #Requires=mysql.service
@ -17,14 +17,14 @@ After=network.target
#LimitNOFILE=65535 #LimitNOFILE=65535
RestartSec=2s RestartSec=2s
Type=simple Type=simple
User={{ gitea_user }} User={{ forgejo_user }}
Group={{ gitea_group }} Group={{ forgejo_group }}
WorkingDirectory=/var/lib/gitea/ WorkingDirectory=/var/lib/forgejo/
ExecStart={{ gitea_bindir }}/gitea web -c {{ gitea_confdir }} ExecStart={{ forgejo_bindir }}/forgejo web -c {{ forgejo_confdir }}
Restart=always Restart=always
RestartSec=3 RestartSec=3
Environment=USER={{ gitea_user }} HOME=/home/{{ gitea_user }} GITEA_WORK_DIR=/var/lib/gitea Environment=USER={{ forgejo_user }} HOME=/home/{{ forgejo_user }} FORGEJO_WORK_DIR=/var/lib/forgejo
# If you want to bind Gitea to a port below 1024 uncomment # If you want to bind Forgejo to a port below 1024 uncomment
# the two values below # the two values below
### ###
#CapabilityBoundingSet=CAP_NET_BIND_SERVICE #CapabilityBoundingSet=CAP_NET_BIND_SERVICE