mirror of
https://github.com/YunoHost-Apps/gogs_ynh.git
synced 2024-09-03 20:36:23 +02:00
Several fixes
This commit is contained in:
parent
0ea4574aa5
commit
8dbdc0f2a1
8 changed files with 102 additions and 100 deletions
|
@ -61,7 +61,7 @@ TLS_MIN_VERSION = TLS10
|
||||||
; default is the path where Gogs is executed
|
; default is the path where Gogs is executed
|
||||||
STATIC_ROOT_PATH =
|
STATIC_ROOT_PATH =
|
||||||
; Default path for App data
|
; Default path for App data
|
||||||
APP_DATA_PATH = __DATA_PATH__
|
APP_DATA_PATH = __DATADIR__/data
|
||||||
; Application level GZIP support
|
; Application level GZIP support
|
||||||
ENABLE_GZIP = false
|
ENABLE_GZIP = false
|
||||||
; Landing page for non-logged users, can be "home" or "explore"
|
; Landing page for non-logged users, can be "home" or "explore"
|
||||||
|
@ -69,7 +69,7 @@ LANDING_PAGE = explore
|
||||||
|
|
||||||
[repository]
|
[repository]
|
||||||
; Root path for storing repositories's data, default is "~/<username>/gogs-repositories"
|
; Root path for storing repositories's data, default is "~/<username>/gogs-repositories"
|
||||||
ROOT = __REPO_PATH__
|
ROOT = __DATADIR__/repositories
|
||||||
; The script type server supports, sometimes could be "sh"
|
; The script type server supports, sometimes could be "sh"
|
||||||
SCRIPT_TYPE = bash
|
SCRIPT_TYPE = bash
|
||||||
; Default ANSI charset for an unrecognized charset
|
; Default ANSI charset for an unrecognized charset
|
||||||
|
@ -281,7 +281,7 @@ CSRF_COOKIE_NAME = _csrf
|
||||||
|
|
||||||
[picture]
|
[picture]
|
||||||
; Path to store user uploaded avatars
|
; Path to store user uploaded avatars
|
||||||
AVATAR_UPLOAD_PATH = __DATA_PATH__/avatars
|
AVATAR_UPLOAD_PATH = __DATADIR__/data/avatars
|
||||||
; Chinese users can choose "duoshuo"
|
; Chinese users can choose "duoshuo"
|
||||||
; or a custom avatar source, like: http://cn.gravatar.com/avatar/
|
; or a custom avatar source, like: http://cn.gravatar.com/avatar/
|
||||||
GRAVATAR_SOURCE = gravatar
|
GRAVATAR_SOURCE = gravatar
|
||||||
|
@ -297,7 +297,7 @@ ENABLE_FEDERATED_AVATAR = false
|
||||||
; Whether attachments are enabled. Defaults to `true`
|
; Whether attachments are enabled. Defaults to `true`
|
||||||
ENABLED = true
|
ENABLED = true
|
||||||
; Path for attachments. Defaults to `data/attachments`
|
; Path for attachments. Defaults to `data/attachments`
|
||||||
PATH = __DATA_PATH__/attachments
|
PATH = __DATADIR__/data/attachments
|
||||||
; One or more allowed types, e.g. image/jpeg|image/png
|
; One or more allowed types, e.g. image/jpeg|image/png
|
||||||
ALLOWED_TYPES = image/jpeg|image/png
|
ALLOWED_TYPES = image/jpeg|image/png
|
||||||
; Max size of each file. Defaults to 4MB
|
; Max size of each file. Defaults to 4MB
|
||||||
|
|
|
@ -15,10 +15,10 @@ After=slapd.service
|
||||||
Type=simple
|
Type=simple
|
||||||
User=__APP__
|
User=__APP__
|
||||||
Group=__APP__
|
Group=__APP__
|
||||||
WorkingDirectory=/home/__APP__
|
WorkingDirectory=/home/yunohost.app/__APP__
|
||||||
ExecStart=/opt/__APP__/gogs web
|
ExecStart=/opt/__APP__/gogs web
|
||||||
Restart=always
|
Restart=always
|
||||||
Environment=USER=__APP__ HOME=/home/__APP__
|
Environment=USER=__APP__ HOME=/home/yunohost.app/__APP__
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
|
@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
true
|
ynh_clean_check_starting
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
@ -61,12 +61,6 @@ 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/systemd/system/$app.service"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP VARIOUS FILES
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup --src_path="/var/log/$app"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE MYSQL DATABASE
|
# BACKUP THE MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -130,7 +130,7 @@ ynh_add_config --template="../conf/ldap.conf" --destination="$final_path/custom/
|
||||||
ynh_script_progression --message="Starting a systemd service..."
|
ynh_script_progression --message="Starting a systemd service..."
|
||||||
|
|
||||||
# Start a systemd service
|
# Start a systemd service
|
||||||
ynh_check_starting "INFO] Listen: http://0.0.0.0:" "/var/log/$app/gogs.log"
|
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="INFO] Listen: http://0.0.0.0:"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
|
|
|
@ -14,6 +14,9 @@ source /usr/share/yunohost/helpers
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
ynh_clean_setup () {
|
||||||
|
ynh_clean_check_starting
|
||||||
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
@ -29,7 +32,7 @@ secret_key=$(ynh_string_random)
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
datadir=/home/$app
|
datadir=/home/yunohost.app/$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
|
@ -98,7 +101,6 @@ architecture=$(ynh_detect_arch)
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source --dest_dir="$final_path" --source_id="$architecture"
|
ynh_setup_source --dest_dir="$final_path" --source_id="$architecture"
|
||||||
|
|
||||||
mkdir -p "$final_path/data"
|
|
||||||
mkdir -p "$final_path/custom/conf/auth.d"
|
mkdir -p "$final_path/custom/conf/auth.d"
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
chmod 750 "$final_path"
|
||||||
|
@ -123,16 +125,13 @@ ynh_script_progression --message="Creating a data directory..."
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
||||||
|
|
||||||
mkdir -p "$datadir/avatars"
|
mkdir -p "$datadir/data/avatars"
|
||||||
mkdir -p "$datadir/attachments"
|
mkdir -p "$datadir/data/attachments"
|
||||||
|
|
||||||
chmod 750 "$datadir"
|
chmod 750 "$datadir"
|
||||||
chmod -R o-rwx "$datadir"
|
chmod -R o-rwx "$datadir"
|
||||||
chown -R $app:$app "/home/$app"
|
chown -R $app:$app "$datadir"
|
||||||
chmod u=rwX,g=rX,o= "/home/$app"
|
chmod u=rwX,g=rX,o= "$datadir"
|
||||||
|
|
||||||
repo_path="$datadir/repositories"
|
|
||||||
data_path="$datadir/data"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
|
@ -147,7 +146,12 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_add_config --template="../conf/app.ini" --destination="$final_path/custom/conf/app.ini"
|
ynh_add_config --template="../conf/app.ini" --destination="$final_path/custom/conf/app.ini"
|
||||||
|
chmod 400 "$final_path/custom/conf/app.ini"
|
||||||
|
chown $app:$app "$final_path/custom/conf/app.ini"
|
||||||
|
|
||||||
ynh_add_config --template="../conf/ldap.conf" --destination="$final_path/custom/conf/auth.d/ldap.conf"
|
ynh_add_config --template="../conf/ldap.conf" --destination="$final_path/custom/conf/auth.d/ldap.conf"
|
||||||
|
chmod 400 "$final_path/custom/conf/auth.d/ldap.conf"
|
||||||
|
chown $app:$app "$final_path/custom/conf/auth.d/ldap.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
|
@ -176,7 +180,7 @@ ynh_use_logrotate
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||||
|
|
||||||
yunohost service add $app --log="/var/log/$app/$app.log"
|
yunohost service add $app --description="$app daemon" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
|
@ -184,7 +188,7 @@ yunohost service add $app --log="/var/log/$app/$app.log"
|
||||||
ynh_script_progression --message="Starting a systemd service..."
|
ynh_script_progression --message="Starting a systemd service..."
|
||||||
|
|
||||||
# Start a systemd service
|
# Start a systemd service
|
||||||
ynh_clean_check_starting "INFO] Listen: http://0.0.0.0:" "/var/log/$app/gogs.log"
|
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="INFO] Listen: http://0.0.0.0:"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
|
|
|
@ -10,6 +10,13 @@
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# MANAGE SCRIPT FAILURE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_clean_setup () {
|
||||||
|
ynh_clean_check_starting
|
||||||
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
@ -66,7 +73,6 @@ ynh_script_progression --message="Restoring the app main directory..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$final_path"
|
ynh_restore_file --origin_path="$final_path"
|
||||||
|
|
||||||
mkdir -p "$final_path/data"
|
|
||||||
mkdir -p "$final_path/custom/conf/auth.d"
|
mkdir -p "$final_path/custom/conf/auth.d"
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
chmod 750 "$final_path"
|
||||||
|
@ -83,16 +89,13 @@ ynh_restore_file --origin_path="$datadir" --not_mandatory
|
||||||
|
|
||||||
mkdir -p $datadir
|
mkdir -p $datadir
|
||||||
|
|
||||||
mkdir -p "$datadir/avatars"
|
mkdir -p "$datadir/data/avatars"
|
||||||
mkdir -p "$datadir/attachments"
|
mkdir -p "$datadir/data/attachments"
|
||||||
|
|
||||||
chmod 750 "$datadir"
|
chmod 750 "$datadir"
|
||||||
chmod -R o-rwx "$datadir"
|
chmod -R o-rwx "$datadir"
|
||||||
chown -R $app:$app "/home/$app"
|
chown -R $app:$app "$datadir"
|
||||||
chmod u=rwX,g=rX,o= "/home/$app"
|
chmod u=rwX,g=rX,o= "$datadir"
|
||||||
|
|
||||||
repo_path="$datadir/repositories"
|
|
||||||
data_path="$datadir/data"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC RESTORATION
|
# SPECIFIC RESTORATION
|
||||||
|
@ -118,14 +121,14 @@ systemctl enable $app.service --quiet
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||||
|
|
||||||
yunohost service add $app --log="/var/log/$app/$app.log"
|
yunohost service add $app --description="$app daemon" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..."
|
ynh_script_progression --message="Starting a systemd service..."
|
||||||
|
|
||||||
ynh_check_starting "INFO] Listen: http://0.0.0.0:" "/var/log/$app/$app.log"
|
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="INFO] Listen: http://0.0.0.0:"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE LOGROTATE CONFIGURATION
|
# RESTORE THE LOGROTATE CONFIGURATION
|
||||||
|
|
|
@ -40,6 +40,7 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
|
ynh_clean_check_starting
|
||||||
# Restore it if the upgrade fails
|
# Restore it if the upgrade fails
|
||||||
ynh_restore_upgradebackup
|
ynh_restore_upgradebackup
|
||||||
}
|
}
|
||||||
|
@ -129,7 +130,6 @@ then
|
||||||
ynh_setup_source --dest_dir="$final_path" --source_id="$architecture"
|
ynh_setup_source --dest_dir="$final_path" --source_id="$architecture"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p "$final_path/data"
|
|
||||||
mkdir -p "$final_path/custom/conf/auth.d"
|
mkdir -p "$final_path/custom/conf/auth.d"
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
chmod 750 "$final_path"
|
||||||
|
@ -184,13 +184,14 @@ ynh_use_logrotate --non-append
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||||
|
|
||||||
yunohost service add $app --log="/var/log/$app/$app.log"
|
yunohost service add $app --description="$app daemon" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..."
|
ynh_script_progression --message="Starting a systemd service..."
|
||||||
ynh_check_starting "INFO] Listen: http://0.0.0.0:" "/var/log/$app/gogs.log"
|
|
||||||
|
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="INFO] Listen: http://0.0.0.0:"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
|
|
Loading…
Add table
Reference in a new issue