1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/rallly_ynh.git synced 2024-09-03 20:16:16 +02:00

Coding style, fix env file, fix missing db migration

This commit is contained in:
Salamandar 2024-07-14 20:09:57 +02:00
parent 6958653d17
commit 3437f2b9e9
7 changed files with 79 additions and 111 deletions

View file

@ -1,32 +1,34 @@
# REQUIRED CONFIG
# A random 32-character secret key used to encrypt user sessions
SECRET_PASSWORD=__PASSWORD__
# The base url where this instance is accessible, including the scheme.
# Example: https://example.com
NEXT_PUBLIC_BASE_URL=https://__DOMAIN__
NEXT_PUBLIC_APP_BASE_URL=https://__DOMAIN__
# NEXTAUTH_URL should be the same as NEXT_PUBLIC_BASE_URL
NEXTAUTH_URL=https://__DOMAIN__
# A connection string to your Postgres database
DATABASE_URL="postgres://__DB_USER__:__DB_PWD__@127.0.0.1:5432/__DB_NAME__?sslmode=disable\&connect_timeout=10"
# EMAIL CONFIG (required for sending emails)
# All outgoing emails will show this email as the sender's email address, which also serves as the support email.
# Required to be able to send emails
SUPPORT_EMAIL=__EMAIL__
# The host address of your SMTP server
SMTP_HOST=__MAIN_DOMAIN__
# The port of your SMTP server
SMTP_PORT=25
# Set to "true" if SSL is enabled for your SMTP connection
SMTP_SECURE=false
# The username (if auth is enabled on your SMTP server)
SMTP_USER=__APP__
# The password (if auth is enabled on your SMTP server)
SMTP_PWD=__MAIL_PWD__
# OPTIONAL CONFIG
SMTP_HOST=__MAIN_DOMAIN__
SMTP_PORT=25
SMTP_SECURE=false
SMTP_USER=__APP__
SMTP_PWD=__MAIL_PWD__
# Comma separated list of email addresses that are allowed to register and login.
# You can use wildcard syntax to match a range of email addresses.
# Example: "john@example.com,jane@example.com" or "*@example.com"
ALLOWED_EMAILS=*@__DOMAIN__
# Toggle Self-Hosted mode
NEXT_PUBLIC_SELF_HOSTED=true
# Suppress warning from sentry during local development
SENTRY_IGNORE_API_RESOLUTION_ERROR=1

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -22,15 +20,11 @@ ynh_print_info --message="Declaring files to be backed up..."
ynh_backup --src_path="$install_dir"
#=================================================
# BACKUP THE NGINX CONFIGURATION
# SYSTEM CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_backup --src_path="/etc/systemd/system/$app.service"
#=================================================

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -9,14 +7,12 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_script_progression --message="Stopping $app's systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name="$app" --action="stop" --log_path="/var/log/$app/$app.log"
#=================================================
# MODIFY URL IN NGINX CONF
@ -25,14 +21,12 @@ ynh_script_progression --message="Updating NGINX web server configuration..." --
ynh_change_url_nginx_config
#=================================================
# GENERIC FINALISATION
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_script_progression --message="Starting $app's systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# END OF SCRIPT

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -19,7 +17,7 @@ password=$(ynh_string_random --length=32)
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_script_progression --message="Installing NodeJS..." --weight=1
# Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
@ -32,47 +30,47 @@ ynh_script_progression --message="Setting up source files..." --weight=1
ynh_setup_source --dest_dir="$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
ynh_add_nginx_config
ynh_add_systemd_config
yunohost service add $app --description="Group-meeting manager" --log="/var/log/$app/$app.log"
chown -R "$app:www-data" "$install_dir"
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_script_progression --message="Adding $app's configuration file..." --weight=1
ynh_add_config --template=".env" --destination="$install_dir/.env"
chmod 650 "$install_dir/.env"
chown $app:$app "$install_dir/.env"
chown "$app:$app" "$install_dir/.env"
#=================================================
# CONFIGURE THE APP
#=================================================
ynh_script_progression --message="Configuring the app..." --weight=15
pushd $install_dir
ynh_use_nodejs
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn build
pushd "$install_dir"
ynh_use_nodejs
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn install
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn build
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn db:deploy
popd
#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
ynh_add_nginx_config
ynh_add_systemd_config
yunohost service add "$app" --description="Group-meeting manager" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_script_progression --message="Starting $app's systemd service..." --weight=1
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd"
#=================================================
# END OF SCRIPT

View file

@ -9,17 +9,13 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
if ynh_exec_warn_less yunohost service status $app >/dev/null
then
ynh_script_progression --message="Removing $app service integration..." --weight=1
yunohost service remove $app
if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then
yunohost service remove "$app"
fi
# Remove the dedicated systemd config

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -10,12 +8,10 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
ynh_script_progression --message="Reinstalling NodeJS..." --weight=1
# Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
@ -29,40 +25,32 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
ynh_restore_file --origin_path="$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
chown -R "$app:www-data" "$install_dir"
#=================================================
# RESTORE THE POSTGRESQL DATABASE
#=================================================
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=6
ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
ynh_psql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql
#=================================================
# RESTORE SYSTEMD
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
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="Group-meeting manager" --log="/var/log/$app/$app.log"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
yunohost service add $app --description="Group-meeting manager" --log="/var/log/$app/$app.log"
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd"
ynh_systemd_action --service_name=nginx --action=reload

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -9,14 +7,19 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading NodeJS..." --weight=1
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -26,45 +29,38 @@ ynh_script_progression --message="Upgrading source files..." --weight=1
ynh_setup_source --dest_dir="$install_dir" --keep=".env"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
chown -R "$app:www-data" "$install_dir"
#=================================================
# UPGRADE DEPENDENCIES
# CONFIGURE THE APP
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=1
ynh_script_progression --message="Updating $app's configuration files..." --weight=1
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
pushd $install_dir
ynh_use_nodejs
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn install
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn build
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn db:deploy
popd
#=================================================
# NGINX CONFIGURATION
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
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="Group-meeting manager" --log="/var/log/$app/$app.log"
#=================================================
# CONFIGURE THE APP
#=================================================
ynh_script_progression --message="Configuring the app..." --weight=15
pushd $install_dir
ynh_use_nodejs
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn build
popd
yunohost service add "$app" --description="Group-meeting manager" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_script_progression --message="Starting $app's systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd"
#=================================================
# END OF SCRIPT