mirror of
https://github.com/YunoHost-Apps/yunorunner_ynh.git
synced 2024-09-03 20:36:13 +02:00
Merge pull request #57 from YunoHost-Apps/testing
Testing - Packaging v2
This commit is contained in:
commit
1a4fab396c
22 changed files with 387 additions and 933 deletions
64
.github/workflows/updater.sh
vendored
64
.github/workflows/updater.sh
vendored
|
@ -1,64 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# PACKAGE UPDATING HELPER
|
||||
#=================================================
|
||||
|
||||
# This script is meant to be run by GitHub Actions
|
||||
# The YunoHost-Apps organisation offers a template Action to run this script periodically
|
||||
|
||||
#=================================================
|
||||
# FETCHING LATEST RELEASE AND ITS ASSETS
|
||||
#=================================================
|
||||
|
||||
# Fetching information
|
||||
current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
|
||||
current_yunorunner_release=$(grep -Po 'yunorunner_release="\K.*?(?=")' scripts/_common.sh)
|
||||
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
|
||||
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
|
||||
version=$(curl --silent "https://api.github.com/repos/$repo/commits/master" | jq -r '.commit.committer.date | split("T")[0] | gsub("-";".")')
|
||||
yunorunner_release=$(curl --silent "https://api.github.com/repos/$repo/commits/master" | jq -r '.sha')
|
||||
|
||||
# Setting up the environment variables
|
||||
echo "Current version: $current_version"
|
||||
echo "Latest release from upstream: $version"
|
||||
echo "VERSION=$version" >> $GITHUB_ENV
|
||||
# For the time being, let's assume the script will fail
|
||||
echo "PROCEED=false" >> $GITHUB_ENV
|
||||
|
||||
# Proceed only if the retrieved version is greater than the current one
|
||||
if [[ ! "$version" > "$current_version" ]]; then
|
||||
echo "::warning ::No new version available"
|
||||
exit 0
|
||||
# Proceed only if a PR for this new version does not already exist
|
||||
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then
|
||||
echo "::warning ::A branch already exists for this update"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# UPDATE SOURCE FILES
|
||||
#=================================================
|
||||
|
||||
sed -i "s/$current_yunorunner_release/$yunorunner_release/gi" scripts/_common.sh
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPDATE STEPS
|
||||
#=================================================
|
||||
|
||||
# Any action on the app's source code can be done.
|
||||
# The GitHub Action workflow takes care of committing all changes after this script ends.
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
||||
# Replace new version in manifest
|
||||
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
|
||||
|
||||
# No need to update the README, yunohost-bot takes care of it
|
||||
|
||||
# The Action will proceed only if the PROCEED environment variable is set to true
|
||||
echo "PROCEED=true" >> $GITHUB_ENV
|
||||
exit 0
|
||||
|
50
.github/workflows/updater.yml
vendored
50
.github/workflows/updater.yml
vendored
|
@ -1,50 +0,0 @@
|
|||
# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected.
|
||||
# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization.
|
||||
# This file should be enough by itself, but feel free to tune it to your needs.
|
||||
# It calls updater.sh, which is where you should put the app-specific update steps.
|
||||
name: Check for new upstream releases
|
||||
on:
|
||||
# Allow to manually trigger the workflow
|
||||
workflow_dispatch:
|
||||
# Run it every day at 6:00 UTC
|
||||
schedule:
|
||||
- cron: '0 6 * * *'
|
||||
jobs:
|
||||
updater:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Fetch the source code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Run the updater script
|
||||
id: run_updater
|
||||
run: |
|
||||
# Setting up Git user
|
||||
git config --global user.name 'yunohost-bot'
|
||||
git config --global user.email 'yunohost-bot@users.noreply.github.com'
|
||||
# Run the updater script
|
||||
/bin/bash .github/workflows/updater.sh
|
||||
- name: Commit changes
|
||||
id: commit
|
||||
if: ${{ env.PROCEED == 'true' }}
|
||||
run: |
|
||||
git commit -am "Upgrade to v$VERSION"
|
||||
- name: Create Pull Request
|
||||
id: cpr
|
||||
if: ${{ env.PROCEED == 'true' }}
|
||||
uses: peter-evans/create-pull-request@v4
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
commit-message: Update to version ${{ env.VERSION }}
|
||||
committer: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
|
||||
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
|
||||
signoff: false
|
||||
base: testing
|
||||
branch: ci-auto-update-v${{ env.VERSION }}
|
||||
delete-branch: true
|
||||
title: 'Upgrade to version ${{ env.VERSION }}'
|
||||
body: |
|
||||
Upgrade to v${{ env.VERSION }}
|
||||
draft: false
|
||||
|
16
README.md
16
README.md
|
@ -16,9 +16,11 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
|||
|
||||
## Overview
|
||||
|
||||
CI runner of YunoHost
|
||||
Yunorunner is a CI server for YunoHost apps.
|
||||
|
||||
**Shipped version:** 2023.04.05~ynh1
|
||||
It is based on LXD/LXC and uses [package_check](https://github.com/YunoHost/package_check).
|
||||
|
||||
**Shipped version:** 2023.04.05~ynh2
|
||||
|
||||
## Screenshots
|
||||
|
||||
|
@ -26,9 +28,9 @@ CI runner of YunoHost
|
|||
|
||||
## Documentation and resources
|
||||
|
||||
* Upstream app code repository: <https://github.com/YunoHost/yunorunner>
|
||||
* YunoHost Store: <https://apps.yunohost.org/app/yunorunner>
|
||||
* Report a bug: <https://github.com/YunoHost-Apps/yunorunner_ynh/issues>
|
||||
- Upstream app code repository: <https://github.com/YunoHost/yunorunner>
|
||||
- YunoHost Store: <https://apps.yunohost.org/app/yunorunner>
|
||||
- Report a bug: <https://github.com/YunoHost-Apps/yunorunner_ynh/issues>
|
||||
|
||||
## Developer info
|
||||
|
||||
|
@ -36,10 +38,10 @@ Please send your pull request to the [testing branch](https://github.com/YunoHos
|
|||
|
||||
To try the testing branch, please proceed like that.
|
||||
|
||||
``` bash
|
||||
```bash
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/yunorunner_ynh/tree/testing --debug
|
||||
or
|
||||
sudo yunohost app upgrade yunorunner -u https://github.com/YunoHost-Apps/yunorunner_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>
|
||||
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>
|
||||
|
|
16
README_fr.md
16
README_fr.md
|
@ -16,9 +16,11 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po
|
|||
|
||||
## Vue d’ensemble
|
||||
|
||||
Runner d'intégration continue de YunoHost
|
||||
Yunorunner is a CI server for YunoHost apps.
|
||||
|
||||
**Version incluse :** 2023.04.05~ynh1
|
||||
It is based on LXD/LXC and uses [package_check](https://github.com/YunoHost/package_check).
|
||||
|
||||
**Version incluse :** 2023.04.05~ynh2
|
||||
|
||||
## Captures d’écran
|
||||
|
||||
|
@ -26,9 +28,9 @@ Runner d'intégration continue de YunoHost
|
|||
|
||||
## Documentations et ressources
|
||||
|
||||
* Dépôt de code officiel de l’app : <https://github.com/YunoHost/yunorunner>
|
||||
* YunoHost Store: <https://apps.yunohost.org/app/yunorunner>
|
||||
* Signaler un bug : <https://github.com/YunoHost-Apps/yunorunner_ynh/issues>
|
||||
- Dépôt de code officiel de l’app : <https://github.com/YunoHost/yunorunner>
|
||||
- YunoHost Store : <https://apps.yunohost.org/app/yunorunner>
|
||||
- Signaler un bug : <https://github.com/YunoHost-Apps/yunorunner_ynh/issues>
|
||||
|
||||
## Informations pour les développeurs
|
||||
|
||||
|
@ -36,10 +38,10 @@ Merci de faire vos pull request sur la [branche testing](https://github.com/Yuno
|
|||
|
||||
Pour essayer la branche testing, procédez comme suit.
|
||||
|
||||
``` bash
|
||||
```bash
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/yunorunner_ynh/tree/testing --debug
|
||||
ou
|
||||
sudo yunohost app upgrade yunorunner -u https://github.com/YunoHost-Apps/yunorunner_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**Plus d’infos sur le packaging d’applications :** <https://yunohost.org/packaging_apps>
|
||||
**Plus d’infos sur le packaging d’applications :** <https://yunohost.org/packaging_apps>
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
;; Test complet
|
||||
; Manifest
|
||||
domain="domain.tld"
|
||||
path="/path"
|
||||
context="personal-ci"
|
||||
mode="manual"
|
||||
cluster="no"
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=1
|
||||
setup_root=1
|
||||
setup_nourl=0
|
||||
setup_private=0
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
# 2021-03-05~ynh1
|
||||
upgrade=1 from_commit=f0e9373aa2403bf04f84c67646ac5d34376b7959
|
||||
# 2021-09-22~ynh1
|
||||
upgrade=1 from_commit=fea498cd83a7da12a102efe2f47397dace3cddda
|
||||
backup_restore=1
|
||||
multi_instance=1
|
||||
port_already_use=1 (4242)
|
||||
change_url=1
|
||||
;;; Options
|
||||
Email=
|
||||
Notification=down
|
||||
;;; Upgrade options
|
||||
; commit=f0e9373aa2403bf04f84c67646ac5d34376b7959
|
||||
name=2021-03-05~ynh1
|
||||
; commit=fea498cd83a7da12a102efe2f47397dace3cddda
|
||||
name=2021-09-22~ynh1
|
2
conf/cron
Normal file
2
conf/cron
Normal file
|
@ -0,0 +1,2 @@
|
|||
# self-upgrade every night
|
||||
0 3 * * * root "__INSTALL_DIR__/maintenance/self_upgrade.sh" >> "__INSTALL_DIR__/maintenance/self_upgrade.log" 2>&1
|
44
conf/lxd-preseed.yml
Normal file
44
conf/lxd-preseed.yml
Normal file
|
@ -0,0 +1,44 @@
|
|||
config:
|
||||
cluster.https_address: __DOMAIN__:8443
|
||||
core.https_address: __DOMAIN__:8443
|
||||
core.trust_password: __YUNO_PWD__
|
||||
networks:
|
||||
- config:
|
||||
ipv4.address: 192.168.__LXC_NETWORK__.1/24
|
||||
ipv4.nat: "true"
|
||||
ipv6.address: none
|
||||
description: ""
|
||||
name: lxdbr0
|
||||
type: bridge
|
||||
project: default
|
||||
storage_pools:
|
||||
- config:
|
||||
size: __BTRFS_SIZE__GB
|
||||
source: /var/lib/lxd/disks/local.img
|
||||
description: ""
|
||||
name: local
|
||||
driver: btrfs
|
||||
profiles:
|
||||
- config: {}
|
||||
description: Default LXD profile
|
||||
devices:
|
||||
lxdbr0:
|
||||
nictype: bridged
|
||||
parent: lxdbr0
|
||||
type: nic
|
||||
root:
|
||||
path: /
|
||||
pool: local
|
||||
type: disk
|
||||
name: default
|
||||
projects:
|
||||
- config:
|
||||
features.images: "true"
|
||||
features.networks: "true"
|
||||
features.profiles: "true"
|
||||
features.storage.volumes: "true"
|
||||
description: Default LXD project
|
||||
name: default
|
||||
cluster:
|
||||
server_name: __DOMAIN__
|
||||
enabled: true
|
|
@ -11,13 +11,13 @@ location __PATH__/ {
|
|||
include conf.d/yunohost_panel.conf.inc;
|
||||
|
||||
location __PATH__/logs {
|
||||
alias __FINALPATH__/results/logs/;
|
||||
alias __INSTALL_DIR__/results/logs/;
|
||||
autoindex on;
|
||||
default_type "text/plain";
|
||||
}
|
||||
|
||||
location __PATH__/summary/ {
|
||||
alias __FINALPATH__/results/summary/;
|
||||
alias __INSTALL_DIR__/results/summary/;
|
||||
autoindex on;
|
||||
etag off;
|
||||
more_set_headers "Cache-control: max-age=300, s-maxage=300";
|
||||
|
|
|
@ -7,8 +7,9 @@ Type=simple
|
|||
Restart=always
|
||||
User=__APP__
|
||||
Group=__APP__
|
||||
WorkingDirectory=__FINALPATH__/
|
||||
ExecStart=__FINALPATH__/venv/bin/python ./run.py
|
||||
WorkingDirectory=__INSTALL_DIR__/
|
||||
ExecStart=__INSTALL_DIR__/venv/bin/python ./run.py
|
||||
Environment=YNHDEV_BACKEND=lxd
|
||||
|
||||
# Sandboxing options to harden security
|
||||
# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
BASE_URL = "https://__DOMAIN____PATH__"
|
||||
PORT = __PORT__
|
||||
PACKAGE_CHECK_DIR = "__FINALPATH__/package_check/"
|
||||
PACKAGE_CHECK_DIR = "__INSTALL_DIR__/package_check/"
|
||||
MONITOR_APPS_LIST = __AUTO__
|
||||
MONITOR_GIT = __AUTO__
|
||||
MONITOR_ONLY_GOOD_QUALITY_APPS = False
|
||||
|
|
3
doc/DESCRIPTION.md
Normal file
3
doc/DESCRIPTION.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
Yunorunner is a CI server for YunoHost apps.
|
||||
|
||||
It is based on LXD/LXC and uses [package_check](https://github.com/YunoHost/package_check).
|
|
@ -1,6 +1,6 @@
|
|||
If you want to enable Matrix notification, you should look at
|
||||
the instructions inside `__FINAL_PATH__lib/chat_notify.sh` to deploy matrix-commander.
|
||||
the instructions inside `__INSTALL_DIR__/lib/chat_notify.sh` to deploy matrix-commander.
|
||||
|
||||
You may also want to tweak the `__FINAL_PATH__/config.py` file to run test with a different branch or architecture.
|
||||
You may also want to tweak the `__INSTALL_DIR__/config.py` file to run test with a different branch or architecture.
|
||||
|
||||
When you're ready to start the CI, restart its service via the webadmin or run `systemctl restart __APP__`.
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
{
|
||||
"name": "YunoRunner",
|
||||
"id": "yunorunner",
|
||||
"packaging_format": 1,
|
||||
"description": {
|
||||
"en": "CI runner of YunoHost",
|
||||
"fr": "Runner d'intégration continue de YunoHost"
|
||||
},
|
||||
"version": "2023.04.05~ynh1",
|
||||
"url": "https://github.com/YunoHost/yunorunner",
|
||||
"upstream": {
|
||||
"license": "GPL-3.0-or-later",
|
||||
"code": "https://github.com/YunoHost/yunorunner"
|
||||
},
|
||||
"license": "GPL-3.0-or-later",
|
||||
"maintainer": {
|
||||
"name": ""
|
||||
},
|
||||
"previous_maintainer": {
|
||||
"name": "Maniack Crudelis",
|
||||
"email": "maniackc_dev@crudelis.fr"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 4.3.0"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
"nginx"
|
||||
],
|
||||
"arguments": {
|
||||
"install": [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"type": "path",
|
||||
"default": "/ci"
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "select",
|
||||
"choices": ["personal-ci", "official-infra"],
|
||||
"default": "personal-ci",
|
||||
"ask": {
|
||||
"en": "Leave it to 'personal-ci'. If set to 'official-infra', Yunorunner will take over your server and disable vital services to run alone."
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "mode",
|
||||
"type": "select",
|
||||
"choices": ["auto", "manual"],
|
||||
"default": "manual",
|
||||
"ask": {
|
||||
"en": "Should the jobs be automatically run from the apps list? In manual mode, Yunorunner will expect to be triggered by the `ciclic` command or webhooks (like ci-apps-dev). In auto mode, all apps of the catalog will be scheduled to be tested at least once a month and upon any change in their designated main branch (like ci-apps)."
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "cluster",
|
||||
"type": "select",
|
||||
"choices": ["cluster", "no"],
|
||||
"default": "no",
|
||||
"ask": {
|
||||
"en": "Should an LXD cluster be created with this server as first node? (cluster mode is experimental)"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
78
manifest.toml
Normal file
78
manifest.toml
Normal file
|
@ -0,0 +1,78 @@
|
|||
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
|
||||
|
||||
packaging_format = 2
|
||||
|
||||
id = "yunorunner"
|
||||
name = "YunoRunner"
|
||||
description.en = "CI runner of YunoHost"
|
||||
description.fr = "Runner d'intégration continue de YunoHost"
|
||||
|
||||
version = "2023.04.05~ynh2"
|
||||
|
||||
maintainers = []
|
||||
|
||||
[upstream]
|
||||
license = "GPL-3.0-or-later"
|
||||
code = "https://github.com/YunoHost/yunorunner"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.2"
|
||||
architectures = "all"
|
||||
multi_instance = true
|
||||
ldap = "not_relevant"
|
||||
sso = "not_relevant"
|
||||
disk = "50M"
|
||||
ram.build = "50M"
|
||||
ram.runtime = "50M"
|
||||
|
||||
[install]
|
||||
[install.domain]
|
||||
type = "domain"
|
||||
|
||||
[install.path]
|
||||
type = "path"
|
||||
default = "/ci"
|
||||
|
||||
[install.init_main_permission]
|
||||
type = "group"
|
||||
default = "visitors"
|
||||
|
||||
[install.context]
|
||||
ask.en = "Leave it to 'personal-ci'. If set to 'official-infra', Yunorunner will take over your server and disable vital services to run alone."
|
||||
type = "select"
|
||||
choices.personal_ci = "Personal CI"
|
||||
choices.official_infra = "Official infra"
|
||||
default = "personal_ci"
|
||||
|
||||
[install.mode]
|
||||
ask.en = "Should the jobs be automatically run from the apps list? In manual mode, Yunorunner will expect to be triggered by the `ciclic` command or webhooks (like ci-apps-dev). In auto mode, all apps of the catalog will be scheduled to be tested at least once a month and upon any change in their designated main branch (like ci-apps)."
|
||||
type = "select"
|
||||
choices.auto = "Automatically from the catalog"
|
||||
choices.manual = "Manually via ciclic or webhook"
|
||||
default = "manual"
|
||||
|
||||
[install.cluster]
|
||||
ask.en = "Should an LXD cluster be created with this server as first node? (cluster mode is experimental)"
|
||||
type = "boolean"
|
||||
default = false
|
||||
|
||||
[resources]
|
||||
[resources.system_user]
|
||||
|
||||
[resources.install_dir]
|
||||
|
||||
[resources.permissions]
|
||||
main.url = "/"
|
||||
|
||||
[resources.ports]
|
||||
main.default = 8095
|
||||
|
||||
[resources.apt]
|
||||
packages = [
|
||||
"python3-venv",
|
||||
"python3-dev",
|
||||
"python3-pip",
|
||||
"sqlite3",
|
||||
"wkhtmltopdf",
|
||||
"optipng",
|
||||
]
|
|
@ -4,9 +4,6 @@
|
|||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
# dependencies used by the app
|
||||
pkg_dependencies="python3-venv python3-dev python3-pip sqlite3 wkhtmltopdf optipng"
|
||||
|
||||
yunorunner_repository="https://github.com/YunoHost/yunorunner"
|
||||
|
||||
yunorunner_release="52ef23a2cb37cb4fe13debca58eb589bb2f4d927"
|
||||
|
@ -15,110 +12,47 @@ yunorunner_release="52ef23a2cb37cb4fe13debca58eb589bb2f4d927"
|
|||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
||||
function tweak_yunohost() {
|
||||
|
||||
tweak_yunohost() {
|
||||
# Idk why this is needed but wokay I guess >_>
|
||||
echo -e "\n127.0.0.1 $domain #CI_APP" >> /etc/hosts
|
||||
|
||||
ynh_print_info "Disabling unecessary services to save up RAM..."
|
||||
for SERVICE in mysql php7.4-fpm metronome rspamd dovecot postfix redis-server postsrsd yunohost-api avahi-daemon
|
||||
do
|
||||
for SERVICE in mysql php7.4-fpm metronome rspamd dovecot postfix redis-server postsrsd yunohost-api avahi-daemon; do
|
||||
systemctl stop $SERVICE
|
||||
systemctl disable $SERVICE --quiet
|
||||
done
|
||||
|
||||
yunohost app makedefault -d "$domain" $app
|
||||
|
||||
}
|
||||
|
||||
function setup_lxd() {
|
||||
if ! yunohost app list --output-as json --quiet | jq -e '.apps[] | select(.id == "lxd")' >/dev/null
|
||||
then
|
||||
ynh_script_progression --message="Installing LXD... (this make take a long time!"
|
||||
yunohost app install --force https://github.com/YunoHost-Apps/lxd_ynh
|
||||
fi
|
||||
|
||||
mkdir .lxd
|
||||
pushd .lxd
|
||||
|
||||
setup_lxd() {
|
||||
ynh_print_info "Configuring lxd..."
|
||||
|
||||
if [ "$cluster" == "cluster" ]
|
||||
then
|
||||
local free_space=$(df --output=avail / | sed 1d)
|
||||
local btrfs_size=$(( $free_space * 90 / 100 / 1024 / 1024 ))
|
||||
local lxc_network=$((1 + $RANDOM % 254))
|
||||
|
||||
if [ "$cluster" -eq 1 ]; then
|
||||
yunohost firewall allow TCP 8443
|
||||
cat >./preseed.conf <<EOF
|
||||
config:
|
||||
cluster.https_address: $domain:8443
|
||||
core.https_address: ${domain}:8443
|
||||
core.trust_password: ${yuno_pwd}
|
||||
networks:
|
||||
- config:
|
||||
ipv4.address: 192.168.${lxc_network}.1/24
|
||||
ipv4.nat: "true"
|
||||
ipv6.address: none
|
||||
description: ""
|
||||
name: lxdbr0
|
||||
type: bridge
|
||||
project: default
|
||||
storage_pools:
|
||||
- config:
|
||||
size: ${btrfs_size}GB
|
||||
source: /var/lib/lxd/disks/local.img
|
||||
description: ""
|
||||
name: local
|
||||
driver: btrfs
|
||||
profiles:
|
||||
- config: {}
|
||||
description: Default LXD profile
|
||||
devices:
|
||||
lxdbr0:
|
||||
nictype: bridged
|
||||
parent: lxdbr0
|
||||
type: nic
|
||||
root:
|
||||
path: /
|
||||
pool: local
|
||||
type: disk
|
||||
name: default
|
||||
projects:
|
||||
- config:
|
||||
features.images: "true"
|
||||
features.networks: "true"
|
||||
features.profiles: "true"
|
||||
features.storage.volumes: "true"
|
||||
description: Default LXD project
|
||||
name: default
|
||||
cluster:
|
||||
server_name: ${domain}
|
||||
enabled: true
|
||||
EOF
|
||||
cat ./preseed.conf | lxd init --preseed
|
||||
rm ./preseed.conf
|
||||
lxc config set core.https_address [::]
|
||||
|
||||
free_space=$(df --output=avail / | sed 1d)
|
||||
btrfs_size=$(( free_space * 90 / 100 / 1024 / 1024 ))
|
||||
lxc_network=$((1 + RANDOM % 254))
|
||||
ynh_add_config --template="lxd-preseed.yml" --destination="$install_dir/lxd-preseed.yml"
|
||||
lxd init --preseed < "$install_dir/lxd-preseed.yml"
|
||||
rm "$install_dir/lxd-preseed.yml"
|
||||
|
||||
lxc config set core.https_address "[::]"
|
||||
else
|
||||
lxd init --auto #--storage-backend=dir
|
||||
lxd init --auto # --storage-backend=dir
|
||||
fi
|
||||
|
||||
popd
|
||||
|
||||
# ci_user will be the one launching job, gives it permission to run lxd commands
|
||||
usermod -a -G lxd $app
|
||||
usermod -a -G lxd "$app"
|
||||
|
||||
ynh_exec_as $app lxc remote add yunohost https://devbaseimgs.yunohost.org --public --accept-certificate
|
||||
ynh_exec_as "$app" lxc remote add yunohost https://devbaseimgs.yunohost.org --public --accept-certificate
|
||||
}
|
||||
|
||||
function add_cron_jobs() {
|
||||
ynh_script_progression --message="Configuring the cron jobs.."
|
||||
|
||||
# Cron tasks
|
||||
cat >> "/etc/cron.d/yunorunner" << EOF
|
||||
# self-upgrade every night
|
||||
0 3 * * * root "$final_path/maintenance/self_upgrade.sh" >> "$final_path/maintenance/self_upgrade.log" 2>&1
|
||||
EOF
|
||||
exposed_ports_if_cluster() {
|
||||
if [ "$cluster" -eq 1 ]; then
|
||||
echo "--needs_exposed_ports=8443"
|
||||
fi
|
||||
}
|
||||
|
||||
#=================================================
|
||||
|
@ -130,78 +64,63 @@ EOF
|
|||
#=================================================
|
||||
|
||||
ynh_maintenance_mode_ON () {
|
||||
# Load value of $path_url and $domain from the config if their not set
|
||||
if [ -z $path_url ]; then
|
||||
path_url=$(ynh_app_setting_get $app path)
|
||||
fi
|
||||
if [ -z $domain ]; then
|
||||
domain=$(ynh_app_setting_get $app domain)
|
||||
fi
|
||||
|
||||
# Create an html to serve as maintenance notice
|
||||
echo "<!DOCTYPE html>
|
||||
# Create an html to serve as maintenance notice
|
||||
cat > "/var/www/html/maintenance.$app.html" <<EOF
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="3">
|
||||
<title>Your app $app is currently under maintenance!</title>
|
||||
<style>
|
||||
body {
|
||||
width: 70em;
|
||||
margin: 0 auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Your app $app is currently under maintenance!</h1>
|
||||
<p>This app has been put under maintenance by your administrator at $(date)</p>
|
||||
<p>Please wait until the maintenance operation is done. This page will be reloaded as soon as your app will be back.</p>
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="3">
|
||||
<title>Your app $app is currently under maintenance!</title>
|
||||
<style>
|
||||
body {
|
||||
width: 70em;
|
||||
margin: 0 auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Your app $app is currently under maintenance!</h1>
|
||||
<p>This app has been put under maintenance by your administrator at $(date)</p>
|
||||
<p>Please wait until the maintenance operation is done. This page will be reloaded as soon as your app will be back.</p>
|
||||
</body>
|
||||
</html>
|
||||
EOF
|
||||
|
||||
</body>
|
||||
</html>" > "/var/www/html/maintenance.$app.html"
|
||||
|
||||
# Create a new nginx config file to redirect all access to the app to the maintenance notice instead.
|
||||
echo "# All request to the app will be redirected to ${path_url}_maintenance and fall on the maintenance notice
|
||||
rewrite ^${path_url}/(.*)$ ${path_url}_maintenance/? redirect;
|
||||
# Create a new nginx config file to redirect all access to the app to the maintenance notice instead.
|
||||
cat > "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf" <<EOF
|
||||
# All request to the app will be redirected to ${path}_maintenance and fall on the maintenance notice
|
||||
rewrite ^${path}/(.*)$ ${path}_maintenance/? redirect;
|
||||
# Use another location, to not be in conflict with the original config file
|
||||
location ${path_url}_maintenance/ {
|
||||
alias /var/www/html/ ;
|
||||
location ${path}_maintenance/ {
|
||||
alias /var/www/html/ ;
|
||||
try_files maintenance.$app.html =503;
|
||||
|
||||
try_files maintenance.$app.html =503;
|
||||
# Include SSOWAT user panel.
|
||||
include conf.d/yunohost_panel.conf.inc;
|
||||
}
|
||||
EOF
|
||||
|
||||
# Include SSOWAT user panel.
|
||||
include conf.d/yunohost_panel.conf.inc;
|
||||
}" > "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf"
|
||||
|
||||
# The current config file will redirect all requests to the root of the app.
|
||||
# To keep the full path, we can use the following rewrite rule:
|
||||
# rewrite ^${path_url}/(.*)$ ${path_url}_maintenance/\$1? redirect;
|
||||
# The difference will be in the $1 at the end, which keep the following queries.
|
||||
# But, if it works perfectly for a html request, there's an issue with any php files.
|
||||
# This files are treated as simple files, and will be downloaded by the browser.
|
||||
# Would be really be nice to be able to fix that issue. So that, when the page is reloaded after the maintenance, the user will be redirected to the real page he was.
|
||||
|
||||
systemctl reload nginx
|
||||
# The current config file will redirect all requests to the root of the app.
|
||||
# To keep the full path, we can use the following rewrite rule:
|
||||
# rewrite ^${path}/(.*)$ ${path}_maintenance/\$1? redirect;
|
||||
# The difference will be in the $1 at the end, which keep the following queries.
|
||||
# But, if it works perfectly for a html request, there's an issue with any php files.
|
||||
# This files are treated as simple files, and will be downloaded by the browser.
|
||||
# Would be really be nice to be able to fix that issue. So that, when the page is reloaded after the maintenance, the user will be redirected to the real page he was.
|
||||
systemctl reload nginx
|
||||
}
|
||||
|
||||
ynh_maintenance_mode_OFF () {
|
||||
# Load value of $path_url and $domain from the config if their not set
|
||||
if [ -z $path_url ]; then
|
||||
path_url=$(ynh_app_setting_get $app path)
|
||||
fi
|
||||
if [ -z $domain ]; then
|
||||
domain=$(ynh_app_setting_get $app domain)
|
||||
fi
|
||||
# Rewrite the nginx config file to redirect from ${path}_maintenance to the real url of the app.
|
||||
echo "rewrite ^${path}_maintenance/(.*)$ ${path}/\$1 redirect;" > "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf"
|
||||
systemctl reload nginx
|
||||
|
||||
# Rewrite the nginx config file to redirect from ${path_url}_maintenance to the real url of the app.
|
||||
echo "rewrite ^${path_url}_maintenance/(.*)$ ${path_url}/\$1 redirect;" > "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf"
|
||||
systemctl reload nginx
|
||||
# Sleep 4 seconds to let the browser reload the pages and redirect the user to the app.
|
||||
sleep 4
|
||||
|
||||
# Sleep 4 seconds to let the browser reload the pages and redirect the user to the app.
|
||||
sleep 4
|
||||
# Then remove the temporary files used for the maintenance.
|
||||
rm "/var/www/html/maintenance.$app.html"
|
||||
rm "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf"
|
||||
|
||||
# Then remove the temporary files used for the maintenance.
|
||||
rm "/var/www/html/maintenance.$app.html"
|
||||
rm "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf"
|
||||
|
||||
systemctl reload nginx
|
||||
systemctl reload nginx
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
@ -10,26 +8,6 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
true
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
#=================================================
|
||||
|
@ -39,7 +17,7 @@ ynh_print_info --message="Declaring files to be backed up..."
|
|||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="$final_path"
|
||||
ynh_backup --src_path="$install_dir"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
|
@ -55,6 +33,8 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
|
||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||
|
||||
ynh_backup --src_path="/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
@ -9,135 +7,27 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS
|
||||
#=================================================
|
||||
|
||||
old_domain=$YNH_APP_OLD_DOMAIN
|
||||
old_path=$YNH_APP_OLD_PATH
|
||||
|
||||
new_domain=$YNH_APP_NEW_DOMAIN
|
||||
new_path=$YNH_APP_NEW_PATH
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
# Needed for helper "ynh_add_nginx_config"
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
||||
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# ACTIVATE MAINTENANCE MODE
|
||||
#=================================================
|
||||
|
||||
path_url=$old_path
|
||||
domain=$old_domain
|
||||
ynh_maintenance_mode_ON
|
||||
|
||||
#=================================================
|
||||
# CHECK WHICH PARTS SHOULD BE CHANGED
|
||||
#=================================================
|
||||
|
||||
change_domain=0
|
||||
if [ "$old_domain" != "$new_domain" ]
|
||||
then
|
||||
change_domain=1
|
||||
fi
|
||||
|
||||
change_path=0
|
||||
if [ "$old_path" != "$new_path" ]
|
||||
then
|
||||
change_path=1
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..."
|
||||
ynh_script_progression --message="Stopping $app's systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped YunoRunner CI" --timeout=30
|
||||
ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" --line_match="Stopped YunoRunner CI" --timeout=30
|
||||
|
||||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..."
|
||||
|
||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||
ynh_change_url_nginx_config
|
||||
|
||||
# Change the path in the NGINX config file
|
||||
if [ $change_path -eq 1 ]
|
||||
then
|
||||
# Make a backup of the original NGINX config file if modified
|
||||
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
||||
# Set global variables for NGINX helper
|
||||
domain="$old_domain"
|
||||
path_url="$new_path"
|
||||
|
||||
# Store path_url setting
|
||||
ynh_app_setting_set --app=$app --key=path_url --value="$path_url"
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
fi
|
||||
|
||||
# Change the domain for NGINX
|
||||
if [ $change_domain -eq 1 ]
|
||||
then
|
||||
# Delete file checksum for the old conf file location
|
||||
ynh_delete_file_checksum --file="$nginx_conf_path"
|
||||
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
||||
# Store file checksum for the new config file location
|
||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
ynh_script_progression --message="Starting $app's systemd service..."
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started YunoRunner CI"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# DEACTIVE MAINTENANCE MODE
|
||||
#=================================================
|
||||
|
||||
path_url=$old_path
|
||||
domain=$old_domain
|
||||
ynh_maintenance_mode_OFF
|
||||
ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Started YunoRunner CI"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
167
scripts/install
167
scripts/install
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
@ -10,115 +8,44 @@ source _common.sh
|
|||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
# INSTALL LXD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing LXD... (this make take a long time!)"
|
||||
|
||||
ynh_clean_setup () {
|
||||
true
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
#=================================================
|
||||
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url=$YNH_APP_ARG_PATH
|
||||
context=$YNH_APP_ARG_CONTEXT
|
||||
mode=$YNH_APP_ARG_MODE
|
||||
cluster=$YNH_APP_ARG_CLUSTER
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating installation parameters..."
|
||||
|
||||
final_path=/var/www/$app
|
||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||
|
||||
# Register (book) web path
|
||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Storing installation settings..."
|
||||
|
||||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# FIND AND OPEN A PORT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Finding an available port..."
|
||||
|
||||
# Find an available port
|
||||
port=$(ynh_find_port --port=8095)
|
||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..."
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..."
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||
if ! yunohost app list --output-as json --quiet | jq -e '.apps[] | select(.id == "lxd")' >/dev/null; then
|
||||
yunohost app install --force https://github.com/YunoHost-Apps/lxd_ynh
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..."
|
||||
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
mkdir "$final_path"
|
||||
chown $app:$app "$final_path"
|
||||
pushd "$final_path"
|
||||
ynh_exec_as $app git init
|
||||
ynh_exec_as $app git remote add origin "$yunorunner_repository"
|
||||
ynh_exec_as $app git fetch --quiet --depth=1 origin "$yunorunner_release"
|
||||
ynh_exec_as $app git reset --quiet --hard FETCH_HEAD
|
||||
setup_lxd
|
||||
git clone https://github.com/YunoHost/package_check "./package_check"
|
||||
popd
|
||||
ynh_exec_as "$app" git -C "$install_dir" init -b main
|
||||
ynh_exec_as "$app" git -C "$install_dir" remote add origin "$yunorunner_repository"
|
||||
ynh_exec_as "$app" git -C "$install_dir" fetch --quiet --depth=1 origin "$yunorunner_release"
|
||||
ynh_exec_as "$app" git -C "$install_dir" reset --quiet --hard FETCH_HEAD
|
||||
ynh_exec_as "$app" git clone https://github.com/YunoHost/package_check "$install_dir/package_check"
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app "$final_path"
|
||||
chown $app:www-data "$final_path"
|
||||
chown -R $app:www-data "$final_path/results"
|
||||
chown "$app:$app" "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..."
|
||||
setup_lxd
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R "$app:$app" "$install_dir"
|
||||
chown "$app:www-data" "$install_dir"
|
||||
chown -R "$app:www-data" "$install_dir/results"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
# INSTALL PYTHON DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing Python dependencies..."
|
||||
|
||||
pushd $final_path
|
||||
python3 -m venv venv
|
||||
venv/bin/pip install --upgrade pip
|
||||
venv/bin/pip install -r requirements-frozen.txt
|
||||
pushd "$install_dir"
|
||||
python3 -m venv venv
|
||||
venv/bin/pip install --upgrade pip
|
||||
venv/bin/pip install -r requirements-frozen.txt
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
|
@ -127,66 +54,46 @@ popd
|
|||
ynh_script_progression --message="Adding a config file..."
|
||||
|
||||
if [ $mode = "auto" ]; then
|
||||
auto="True"
|
||||
auto="True"
|
||||
else
|
||||
auto="False"
|
||||
auto="False"
|
||||
fi
|
||||
|
||||
ynh_add_config --template="yunorunner.config.py" --destination="$final_path/config.py"
|
||||
ynh_add_config --template="yunorunner.config.py" --destination="$install_dir/config.py"
|
||||
|
||||
chmod 400 "$final_path/config.py"
|
||||
chown $app:$app "$final_path/config.py"
|
||||
chmod 400 "$install_dir/config.py"
|
||||
chown "$app:$app" "$install_dir/config.py"
|
||||
|
||||
#=================================================
|
||||
# FINISH INSTALL
|
||||
#=================================================
|
||||
ynh_script_progression --message="Run Yunorunner's finish_install script..."
|
||||
|
||||
if [ $context != "personal-ci" ] && [ ${PACKAGE_CHECK_EXEC:-0} -ne 0 ]; then
|
||||
tweak_yunohost
|
||||
if [ "$context" == "official_infra" ] && [ "${PACKAGE_CHECK_EXEC:-0}" -ne 0 ]; then
|
||||
tweak_yunohost
|
||||
fi
|
||||
|
||||
add_cron_jobs
|
||||
#=================================================
|
||||
# SYSTEM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring a systemd service..."
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
yunohost service add "$app" --description="$app daemon for YunoRunner" $(exposed_ports_if_cluster)
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add $app --description="$app daemon for YunoRunner"
|
||||
ynh_add_config --template="cron" --destination="/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
ynh_script_progression --message="Starting $app's systemd service..."
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started YunoRunner CI" --timeout=30
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring permissions..."
|
||||
|
||||
# Make app public
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Started YunoRunner CI" --timeout=30
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
@ -10,81 +8,21 @@ source _common.sh
|
|||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
#=================================================
|
||||
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
||||
# REMOVE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
||||
|
||||
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
||||
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
||||
then
|
||||
ynh_script_progression --message="Removing $app service integration..."
|
||||
yunohost service remove $app
|
||||
if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then
|
||||
yunohost service remove "$app"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STOP AND REMOVE SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping and removing the systemd service..."
|
||||
|
||||
# Remove the dedicated systemd config
|
||||
ynh_remove_systemd_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..."
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing app main directory..."
|
||||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$final_path"
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing NGINX web server configuration..."
|
||||
|
||||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# CLOSE A PORT
|
||||
#=================================================
|
||||
|
||||
if yunohost firewall list | grep -q "\- $port$"
|
||||
then
|
||||
ynh_script_progression --message="Closing port $port..."
|
||||
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the dedicated system user..."
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete --username=$app
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
111
scripts/restore
111
scripts/restore
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
@ -10,34 +8,6 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
true
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..."
|
||||
|
||||
test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
|
||||
|
||||
#=================================================
|
||||
# ACTIVATE MAINTENANCE MODE
|
||||
#=================================================
|
||||
|
@ -45,88 +15,55 @@ test ! -d $final_path || ynh_die --message="There is already a directory: $final
|
|||
ynh_maintenance_mode_ON
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
# INSTALL LXD
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the NGINX web server configuration..."
|
||||
ynh_script_progression --message="Installing LXD... (this make take a long time!)"
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Recreating the dedicated system user..."
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app
|
||||
if ! yunohost app list --output-as json --quiet | jq -e '.apps[] | select(.id == "lxd")' >/dev/null; then
|
||||
yunohost app install --force https://github.com/YunoHost-Apps/lxd_ynh
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..."
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
ynh_restore_file --origin_path="$install_dir"
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:$app "$final_path"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..."
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R "$app:$app" "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# INSTALL PYTHON DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing Python dependencies..."
|
||||
|
||||
pushd $final_path
|
||||
python3 -m venv venv
|
||||
venv/bin/pip install --upgrade pip
|
||||
venv/bin/pip install -r requirements-frozen.txt
|
||||
pushd "$install_dir"
|
||||
python3 -m venv venv
|
||||
venv/bin/pip install --upgrade pip
|
||||
venv/bin/pip install -r requirements-frozen.txt
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
# RESTORE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the systemd configuration..."
|
||||
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||
systemctl enable $app.service --quiet
|
||||
systemctl enable "$app.service" --quiet
|
||||
yunohost service add "$app" --description="$app daemon for YunoRunner" $(exposed_ports_if_cluster)
|
||||
|
||||
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
|
||||
|
||||
yunohost service add $app --description="$app daemon for YunoRunner"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started YunoRunner CI" --timeout=30
|
||||
|
||||
#=================================================
|
||||
# DEACTIVE MAINTENANCE MODE
|
||||
#=================================================
|
||||
|
||||
ynh_maintenance_mode_OFF
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Started YunoRunner CI" --timeout=30
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
|
203
scripts/upgrade
203
scripts/upgrade
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
@ -9,49 +7,6 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Checking version..."
|
||||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# CLOSE A PORT
|
||||
#=================================================
|
||||
|
||||
if yunohost firewall list | grep -q "\- $port$"
|
||||
then
|
||||
ynh_script_progression --message="Closing port $port"
|
||||
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# ACTIVATE MAINTENANCE MODE
|
||||
#=================================================
|
||||
|
@ -59,96 +14,100 @@ ynh_abort_if_errors
|
|||
ynh_maintenance_mode_ON
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
# INSTALL LXD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing LXD... (this make take a long time!)"
|
||||
|
||||
if ! yunohost app list --output-as json --quiet | jq -e '.apps[] | select(.id == "lxd")' >/dev/null; then
|
||||
yunohost app install --force https://github.com/YunoHost-Apps/lxd_ynh
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..."
|
||||
ynh_script_progression --message="Stopping $app's systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped YunoRunner CI"
|
||||
ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" --line_match="Stopped YunoRunner CI"
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..."
|
||||
|
||||
# If port doesn't exist, create it
|
||||
if [ -z "$port" ]; then
|
||||
port=4242
|
||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||
if [ ! -d "$install_dir/.git/" ]; then
|
||||
ynh_exec_as "$app" git -C "$install_dir" init -b main
|
||||
git -C "$install_dir" remote add origin "$yunorunner_repository"
|
||||
fi
|
||||
|
||||
if [[ ! -d "$final_path/.git/" ]]
|
||||
then
|
||||
git init "$final_path"
|
||||
pushd "$final_path"
|
||||
git remote add origin "$yunorunner_repository"
|
||||
popd
|
||||
# Close a legacy port
|
||||
if yunohost firewall list | grep -q "\- $port$"; then
|
||||
ynh_exec_warn_less yunohost firewall disallow TCP "$port"
|
||||
fi
|
||||
|
||||
# Cleaning legacy permissions
|
||||
if ynh_legacy_permissions_exists; then
|
||||
ynh_legacy_permissions_delete_all
|
||||
if [[ -z "${context:-}" ]]; then
|
||||
if grep -q "CI_APP" /etc/hosts; then
|
||||
context=official_infra
|
||||
else
|
||||
context=personal_ci
|
||||
fi
|
||||
ynh_app_setting_set --app="$app" --key="context" --value="$context"
|
||||
fi
|
||||
|
||||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
if [[ -z "${cluster:-}" ]]; then
|
||||
if lxc cluster list >/dev/null 2>&1; then
|
||||
cluster=1
|
||||
else
|
||||
cluster=0
|
||||
fi
|
||||
ynh_app_setting_set --app="$app" --key="cluster" --value="$cluster"
|
||||
fi
|
||||
|
||||
# Values now use underscore
|
||||
if echo "$context" | grep -- -; then
|
||||
context=$(echo "$context" | tr - _)
|
||||
ynh_app_setting_set --app="$app" --key="context" --value="$context"
|
||||
fi
|
||||
|
||||
# cluster is now a boolean
|
||||
if [[ "$cluster" == "cluster" ]] || [[ "$cluster" == "no" ]]; then
|
||||
if [[ "$cluster" == "cluster" ]]; then
|
||||
cluster=1
|
||||
else
|
||||
cluster=0
|
||||
fi
|
||||
ynh_app_setting_set --app="$app" --key="cluster" --value="$cluster"
|
||||
fi
|
||||
|
||||
if [ ! -d "$install_dir/package_check" ]; then
|
||||
ynh_exec_as "$app" git clone https://github.com/YunoHost/package_check "$install_dir/package_check"
|
||||
fi
|
||||
|
||||
# Remove Pythonz
|
||||
ynh_secure_remove --file="$final_path/.pythonz"
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..."
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||
ynh_secure_remove --file="$install_dir/.pythonz"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading source files..."
|
||||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_script_progression --message="Upgrading source files..."
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
pushd "$install_dir"
|
||||
ynh_exec_as "$app" git fetch --quiet --depth=1 origin "$yunorunner_release"
|
||||
ynh_exec_as "$app" git reset --quiet --hard FETCH_HEAD
|
||||
popd
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
pushd "$final_path"
|
||||
ynh_exec_as $app git fetch --quiet --depth=1 origin "$yunorunner_release"
|
||||
ynh_exec_as $app git reset --quiet --hard FETCH_HEAD
|
||||
popd
|
||||
fi
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R "$app:$app" "$install_dir"
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:$app "$final_path"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..."
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# INSTALL PYTHON DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing Python dependencies..."
|
||||
|
||||
pushd $final_path
|
||||
python3 -m venv venv
|
||||
venv/bin/pip install --upgrade pip
|
||||
venv/bin/pip install -r requirements-frozen.txt
|
||||
pushd "$install_dir"
|
||||
python3 -m venv venv
|
||||
venv/bin/pip install --upgrade pip
|
||||
venv/bin/pip install -r requirements-frozen.txt
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
|
@ -156,34 +115,31 @@ popd
|
|||
#=================================================
|
||||
ynh_script_progression --message="Updating a config file..."
|
||||
|
||||
ynh_backup_if_checksum_is_different --file="$final_path/config.py"
|
||||
ynh_backup_if_checksum_is_different --file="$install_dir/config.py"
|
||||
|
||||
chmod 400 "$final_path/config.py"
|
||||
chown $app:$app "$final_path/config.py"
|
||||
chmod 400 "$install_dir/config.py"
|
||||
chown "$app:$app" "$install_dir/config.py"
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
# REAPPLY SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading systemd configuration..."
|
||||
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
yunohost service add "$app" --description="$app daemon for YunoRunner" $(exposed_ports_if_cluster)
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add $app --description="$app daemon for YunoRunner"
|
||||
ynh_add_config --template="cron" --destination="/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
ynh_script_progression --message="Starting $app's systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started YunoRunner CI" --timeout=30
|
||||
ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Started YunoRunner CI" --timeout=30
|
||||
|
||||
#=================================================
|
||||
# DEACTIVE MAINTENANCE MODE
|
||||
|
@ -191,13 +147,6 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --l
|
|||
|
||||
ynh_maintenance_mode_OFF
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
15
tests.toml
Normal file
15
tests.toml
Normal file
|
@ -0,0 +1,15 @@
|
|||
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json
|
||||
|
||||
test_format = 1.0
|
||||
|
||||
[default]
|
||||
|
||||
args.context = "personal_ci"
|
||||
args.mode = "manual"
|
||||
args.cluster = false
|
||||
|
||||
# ------------
|
||||
# Tests to run
|
||||
# ------------
|
||||
|
||||
test_upgrade_from.fea498cd83a7da12a102efe2f47397dace3cddda.name = "2021-09-22~ynh1"
|
Loading…
Reference in a new issue