Skip to content
Snippets Groups Projects
Commit bc0526ba authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Merge branch 'ci' into 'master'

CI  tests

See merge request funkwhale/ansible!6
parents 6074dda1 51f8cd16
No related branches found
No related tags found
No related merge requests found
stages: stages:
- test
- deploy - deploy
variables:
LATEST_VERSION_URL: https://docs.funkwhale.audio/latest.txt
test-install-script:
stage: test
image: debian:10
interruptible: true
before_script:
- apt-get update && apt-get install -y curl
- |
echo "Retrieving latest version from $LATEST_VERSION_URL"
funkwhale_version=$(curl -sfL $LATEST_VERSION_URL || true)
if [ -z "$funkwhale_version" ]; then
echo "Could not retrieve latest version!"
exit 1
fi
- echo "Latest version is $funkwhale_version"
- sed -i "0,/funkwhale_version_placeholder/{s/funkwhale_version_placeholder/$funkwhale_version/}" install.sh
script:
- |
set -x
export ANSIBLE_FUNKWHALE_ROLE_PATH=$(pwd)
printf 'test.deployment\ntest\ncontact@test.deployment\nY\nN\n\n\n\N\n\n\n' | bash install.sh
tags:
- docker
pages: pages:
stage: deploy stage: deploy
image: buildpack-deps image: buildpack-deps
variables:
LATEST_VERSION_URL: https://docs.funkwhale.audio/latest.txt
script: script:
- | - |
echo "Retrieving latest version from $LATEST_VERSION_URL" echo "Retrieving latest version from $LATEST_VERSION_URL"
......
...@@ -138,6 +138,7 @@ Role Variables ...@@ -138,6 +138,7 @@ Role Variables
| `funkwhale_ssl_cert_path` | `` | Path to an existing SSL certificate to use (use in combination with `funkwhale_letsencrypt_enabled: false`) | | `funkwhale_ssl_cert_path` | `` | Path to an existing SSL certificate to use (use in combination with `funkwhale_letsencrypt_enabled: false`) |
| `funkwhale_ssl_key_path` | `` | Path to an existing SSL key to use (use in combination with `funkwhale_letsencrypt_enabled: false`) | | `funkwhale_ssl_key_path` | `` | Path to an existing SSL key to use (use in combination with `funkwhale_letsencrypt_enabled: false`) |
| `funkwhale_static_path` | `/srv/funkwhale/data/static` | Path were Funkwhale static files should be stored | | `funkwhale_static_path` | `/srv/funkwhale/data/static` | Path were Funkwhale static files should be stored |
| `funkwhale_systemd_managed` | `true` | If `true`, will configure Funkwhale systemd services |
| `funkwhale_systemd_after` | `redis.service postgresql.service` | Configuration used for Systemd `After=` directive. Modify it if you have a database or redis server on a separate host | | `funkwhale_systemd_after` | `redis.service postgresql.service` | Configuration used for Systemd `After=` directive. Modify it if you have a database or redis server on a separate host |
| `funkwhale_systemd_service_name` | `funkwhale` | Name of the generated Systemd service, e.g when calling `systemctl start <xxx>` | | `funkwhale_systemd_service_name` | `funkwhale` | Name of the generated Systemd service, e.g when calling `systemctl start <xxx>` |
| `funkwhale_username` | `funkwhale` | Username of the system user and owner of Funkwhale data, files and configuration | | `funkwhale_username` | `funkwhale` | Username of the system user and owner of Funkwhale data, files and configuration |
......
...@@ -21,6 +21,7 @@ funkwhale_web_workers: 1 ...@@ -21,6 +21,7 @@ funkwhale_web_workers: 1
funkwhale_protocol: https funkwhale_protocol: https
funkwhale_settings_module: config.settings.production funkwhale_settings_module: config.settings.production
funkwhale_env_vars: [] funkwhale_env_vars: []
funkwhale_systemd_managed: true
funkwhale_systemd_after: redis.service postgresql.service funkwhale_systemd_after: redis.service postgresql.service
funkwhale_systemd_service_name: funkwhale funkwhale_systemd_service_name: funkwhale
funkwhale_letsencrypt_certbot_flags: funkwhale_letsencrypt_certbot_flags:
......
--- ---
- name: restart funkwhale - name: restart funkwhale
become: true become: true
when: funkwhale_systemd_managed
service: service:
name: "{{ funkwhale_systemd_service_name }}.target" name: "{{ funkwhale_systemd_service_name }}.target"
state: restarted state: restarted
- name: reload funkwhale - name: reload funkwhale
become: true become: true
when: funkwhale_systemd_managed
shell: | shell: |
systemctl kill -s HUP {{ funkwhale_systemd_service_name }}-server systemctl kill -s HUP {{ funkwhale_systemd_service_name }}-server
systemctl kill -s HUP {{ funkwhale_systemd_service_name }}-worker systemctl kill -s HUP {{ funkwhale_systemd_service_name }}-worker
......
...@@ -7,7 +7,6 @@ set -eu ...@@ -7,7 +7,6 @@ set -eu
# If Ansible step fails with ascii decore error, ensure you have a locale properly set on # If Ansible step fails with ascii decore error, ensure you have a locale properly set on
# your system e.g apt-get install -y locales locales-all # your system e.g apt-get install -y locales locales-all
export LANG="en_US.UTF-8" export LANG="en_US.UTF-8"
funkwhale_version="${FUNKWHALE_VERSION-funkwhale_version_placeholder}" funkwhale_version="${FUNKWHALE_VERSION-funkwhale_version_placeholder}"
funkwhale_hostname="${FUNKWHALE_DOMAIN-}" funkwhale_hostname="${FUNKWHALE_DOMAIN-}"
funkwhale_admin_email="${FUNKWHALE_ADMIN_EMAIL-}" funkwhale_admin_email="${FUNKWHALE_ADMIN_EMAIL-}"
...@@ -23,6 +22,7 @@ base_path="/srv/funkwhale" ...@@ -23,6 +22,7 @@ base_path="/srv/funkwhale"
ansible_conf_path="$base_path/ansible" ansible_conf_path="$base_path/ansible"
ansible_bin_path="$HOME/.local/bin" ansible_bin_path="$HOME/.local/bin"
ansible_funkwhale_role_version="${ANSIBLE_FUNKWHALE_ROLE_VERSION-master}" ansible_funkwhale_role_version="${ANSIBLE_FUNKWHALE_ROLE_VERSION-master}"
ansible_funkwhale_role_path="${ANSIBLE_FUNKWHALE_ROLE_PATH-}"
funkwhale_systemd_after="" funkwhale_systemd_after=""
total_steps="4" total_steps="4"
...@@ -89,12 +89,14 @@ setup() { ...@@ -89,12 +89,14 @@ setup() {
read -p "Enter your redis configuration, (e.g redis://127.0.0.1:6379/0): " funkwhale_redis_url read -p "Enter your redis configuration, (e.g redis://127.0.0.1:6379/0): " funkwhale_redis_url
funkwhale_systemd_after="funkwhale_systemd_after: " funkwhale_systemd_after="funkwhale_systemd_after: "
fi fi
yesno_prompt funkwhale_systemd_managed 'Install and manage systemd services files?' 'yes'
yesno_prompt funkwhale_disable_django_admin 'Disable access to API admin dashboard?' 'no' yesno_prompt funkwhale_disable_django_admin 'Disable access to API admin dashboard?' 'no'
else else
funkwhale_nginx_managed="true" funkwhale_nginx_managed="true"
funkwhale_database_managed="true" funkwhale_database_managed="true"
funkwhale_redis_managed="true" funkwhale_redis_managed="true"
funkwhale_disable_django_admin="false" funkwhale_disable_django_admin="false"
funkwhale_systemd_managed="true"
fi fi
...@@ -107,6 +109,7 @@ setup() { ...@@ -107,6 +109,7 @@ setup() {
echo "- Admin email: $funkwhale_admin_email" echo "- Admin email: $funkwhale_admin_email"
echo "- Manage nginx and certbot: $funkwhale_nginx_managed" echo "- Manage nginx and certbot: $funkwhale_nginx_managed"
echo "- Manage redis: $funkwhale_redis_managed" echo "- Manage redis: $funkwhale_redis_managed"
echo "- Manage systemd unit files: $funkwhale_systemd_managed"
if [ "$funkwhale_redis_managed" = "false" ]; then if [ "$funkwhale_redis_managed" = "false" ]; then
echo " - Custom redis configuration: $funkwhale_redis_url" echo " - Custom redis configuration: $funkwhale_redis_url"
fi fi
...@@ -220,17 +223,25 @@ init_ansible() { ...@@ -220,17 +223,25 @@ init_ansible() {
echo "[2/$total_steps] Creating ansible configuration files in $ansible_conf_path..." echo "[2/$total_steps] Creating ansible configuration files in $ansible_conf_path..."
mkdir -p "$ansible_conf_path" mkdir -p "$ansible_conf_path"
cd "$ansible_conf_path" cd "$ansible_conf_path"
cat <<EOF >requirements.yml
- src: git+https://dev.funkwhale.audio/funkwhale/ansible
name: funkwhale
version: $ansible_funkwhale_role_version
EOF
cat <<EOF >ansible.cfg cat <<EOF >ansible.cfg
[defaults] [defaults]
# Needed to use become with unprevileged users, # Needed to use become with unprevileged users,
# see https://docs.ansible.com/ansible/latest/user_guide/become.html#becoming-an-unprivileged-user # see https://docs.ansible.com/ansible/latest/user_guide/become.html#becoming-an-unprivileged-user
#allow_world_readable_tmpfiles=true #allow_world_readable_tmpfiles=true
EOF EOF
if [ "$ansible_funkwhale_role_path" = '' ]; then
cat <<EOF >requirements.yml
- src: git+https://dev.funkwhale.audio/funkwhale/ansible
name: funkwhale
version: $ansible_funkwhale_role_version
EOF
else
mkdir -p "$ansible_conf_path/roles"
echo "roles_path = $ansible_conf_path/roles" >> ansible.cfg
echo "Symlinking local version of the ansible role: $ansible_funkwhale_role_path to $ansible_conf_path/roles/funkwhale"
rm -f "$ansible_conf_path/roles/funkwhale"
ln -s "$ansible_funkwhale_role_path" "$ansible_conf_path/roles/funkwhale"
fi
cat <<EOF >playbook.yml cat <<EOF >playbook.yml
- hosts: funkwhale_servers - hosts: funkwhale_servers
roles: roles:
...@@ -238,17 +249,34 @@ EOF ...@@ -238,17 +249,34 @@ EOF
funkwhale_hostname: $funkwhale_hostname funkwhale_hostname: $funkwhale_hostname
funkwhale_version: $funkwhale_version funkwhale_version: $funkwhale_version
funkwhale_letsencrypt_email: $funkwhale_admin_email funkwhale_letsencrypt_email: $funkwhale_admin_email
funkwhale_nginx_managed: $funkwhale_nginx_managed
funkwhale_redis_managed: $funkwhale_redis_managed
funkwhale_redis_url: $funkwhale_redis_url
funkwhale_database_managed: $funkwhale_database_managed
funkwhale_database_url: $funkwhale_database_url
# Add any environment variables to the generated .env by uncommenting and editing the lines below # Add any environment variables to the generated .env by uncommenting and editing the lines below
# then execute ./reconfigure # then execute ./reconfigure
# funkwhale_env_vars: # funkwhale_env_vars:
# - "EMAIL_CONFIG=smtp+tls://user@:password@youremail.host:587" # - "EMAIL_CONFIG=smtp+tls://user@:password@youremail.host:587"
# - "MYCUSTOM_ENV_VAR=test" # - "MYCUSTOM_ENV_VAR=test"
EOF EOF
if [ "$funkwhale_nginx_managed" = "false" ]; then
cat <<EOF >>playbook.yml
funkwhale_nginx_managed: false
EOF
fi
if [ "$funkwhale_database_managed" = "false" ]; then
cat <<EOF >>playbook.yml
funkwhale_database_managed: false
funkwhale_database_url: $funkwhale_database_url
EOF
fi
if [ "$funkwhale_redis_managed" = "false" ]; then
cat <<EOF >>playbook.yml
funkwhale_redis_managed: false
funkwhale_redis_url: $funkwhale_redis_url
EOF
fi
if [ "$funkwhale_systemd_managed" = "false" ]; then
cat <<EOF >>playbook.yml
funkwhale_systemd_managed: false
EOF
fi
cat <<EOF >reconfigure cat <<EOF >reconfigure
#!/bin/sh #!/bin/sh
# reapply playbook with existing parameter # reapply playbook with existing parameter
...@@ -270,14 +298,12 @@ EOF ...@@ -270,14 +298,12 @@ EOF
[funkwhale_servers] [funkwhale_servers]
127.0.0.1 ansible_connection=local ansible_python_interpreter=/usr/bin/python3 127.0.0.1 ansible_connection=local ansible_python_interpreter=/usr/bin/python3
EOF EOF
if [ "$funkwhale_disable_django_admin" = "true" ]; then if [ "$ansible_funkwhale_role_path" = '' ]; then
cat <<EOF >>playbook.yml echo "[2/$total_steps] Downloading Funkwhale playbook dependencies"
funkwhale_disable_django_admin: true $ansible_bin_path/ansible-galaxy install -r requirements.yml -f
EOF else
echo "[2/$total_steps] Skipping playbook dependencies, using local role instead"
fi fi
echo "[2/$total_steps] Downloading Funkwhale playbook dependencies"
$ansible_bin_path/ansible-galaxy install -r requirements.yml -f
} }
run_playbook() { run_playbook() {
cd "$ansible_conf_path" cd "$ansible_conf_path"
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
- name: "Create {{ funkwhale_systemd_service_name }}-* systemd file" - name: "Create {{ funkwhale_systemd_service_name }}-* systemd file"
become: true become: true
when: funkwhale_systemd_managed
template: template:
src: "funkwhale-process.service.j2" src: "funkwhale-process.service.j2"
dest: "/etc/systemd/system/{{ funkwhale_systemd_service_name }}-{{ item.name }}.service" dest: "/etc/systemd/system/{{ funkwhale_systemd_service_name }}-{{ item.name }}.service"
...@@ -21,6 +22,7 @@ ...@@ -21,6 +22,7 @@
- name: "Create {{ funkwhale_systemd_service_name }} systemd target file" - name: "Create {{ funkwhale_systemd_service_name }} systemd target file"
become: true become: true
when: funkwhale_systemd_managed
template: template:
src: "{{ funkwhale_systemd_service_name }}.target.j2" src: "{{ funkwhale_systemd_service_name }}.target.j2"
dest: "/etc/systemd/system/{{ funkwhale_systemd_service_name }}.target" dest: "/etc/systemd/system/{{ funkwhale_systemd_service_name }}.target"
...@@ -30,6 +32,7 @@ ...@@ -30,6 +32,7 @@
- name: "Start and enable {{ funkwhale_systemd_service_name }}-* services" - name: "Start and enable {{ funkwhale_systemd_service_name }}-* services"
become: true become: true
when: funkwhale_systemd_managed
systemd: systemd:
name: "{{ item }}" name: "{{ item }}"
enabled: true enabled: true
......
  • This Pakistani app itself is smooth and engaging. The developers have done an excellent job ensuring that the game runs without a hitch, even during peak times when there are a lot of players online. I appreciate that the game mechanics are straightforward, yet they still require a good amount of skill and strategy to win.

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment