mirror of
https://github.com/YunoHost-Apps/wekan_ynh.git
synced 2024-09-03 20:36:09 +02:00
commit
e2b4ae177a
4 changed files with 48 additions and 14 deletions
14
conf/.env
Normal file
14
conf/.env
Normal file
|
@ -0,0 +1,14 @@
|
|||
# The path to NODEJS
|
||||
PATH=__NODEJS_PATH__
|
||||
|
||||
# URL of the mongodb
|
||||
MONGO_URL=mongodb://127.0.0.1:27017/__DB_NAME__
|
||||
|
||||
# Root URL
|
||||
ROOT_URL=https://__DOMAIN_URI__
|
||||
|
||||
#Port
|
||||
PORT=__PORT__
|
||||
|
||||
# The Node Environnement
|
||||
NODE_ENV=production
|
|
@ -7,10 +7,7 @@ After=network.target mongodb.service
|
|||
Type=simple
|
||||
User=__APP__
|
||||
Group=__APP__
|
||||
Environment="PATH=__ENV_PATH__"
|
||||
Environment=NODE_ENV=production
|
||||
Environment=MONGO_URL=mongodb://127.0.0.1:27017/__DB_NAME__
|
||||
Environment=ROOT_URL=https://__DOMAIN_URI__ PORT=__PORT__
|
||||
EnvironmentFile=__FINALPATH__/.env
|
||||
WorkingDirectory=__FINALPATH__
|
||||
ExecStart=/opt/node_n/bin/node __FINALPATH__/main.js
|
||||
Restart=on-failure
|
||||
|
|
|
@ -194,13 +194,32 @@ ynh_print_info "Configuring a systemd service..."
|
|||
### - And the section "SETUP SYSTEMD" in the upgrade script
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_print_info "Adding wekan systemd service ..."
|
||||
ynh_replace_string "__ENV_PATH__" "$nodejs_path" "../conf/systemd.service"
|
||||
ynh_replace_string "__DB_NAME__" "$db_name" "../conf/systemd.service"
|
||||
ynh_replace_string "__DOMAIN_URI__" "$domain$path_url" "../conf/systemd.service"
|
||||
ynh_replace_string "__PORT__" "$port" "../conf/systemd.service"
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# MODIFY A CONFIG FILE
|
||||
#=================================================
|
||||
|
||||
### `ynh_replace_string` is used to replace a string in a file.
|
||||
### (It's compatible with sed regular expressions syntax)
|
||||
cp "../conf/.env" "$final_path/.env"
|
||||
|
||||
ynh_replace_string "__NODEJS_PATH__" "$nodejs_path" "$final_path/.env"
|
||||
ynh_replace_string "__DB_NAME__" "$db_name" "$final_path/.env"
|
||||
ynh_replace_string "__DOMAIN_URI__" "$domain$path_url" "$final_path/.env"
|
||||
ynh_replace_string "__PORT__" "$port" "$final_path/.env"
|
||||
|
||||
#=================================================
|
||||
# STORE THE CONFIG FILE CHECKSUM
|
||||
#=================================================
|
||||
|
||||
### `ynh_store_file_checksum` is used to store the checksum of a file.
|
||||
### That way, during the upgrade script, by using `ynh_backup_if_checksum_is_different`,
|
||||
### you can make a backup of this file before modifying it again if the admin had modified it.
|
||||
|
||||
# Calculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum "$final_path/.env"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
|
|
@ -69,13 +69,17 @@ fi
|
|||
|
||||
if ynh_version_gt "0.77-2" "${previous_version}" ; then
|
||||
ynh_install_nodejs 8.9.3
|
||||
ynh_use_nodejs
|
||||
ynh_use_nodejs
|
||||
# Create a dedicated systemd config
|
||||
ynh_replace_string "__ENV_PATH__" "$nodejs_path" "../conf/systemd.service"
|
||||
ynh_replace_string "__DB_NAME__" "$db_name" "../conf/systemd.service"
|
||||
ynh_replace_string "__DOMAIN_URI__" "$domain$path_url" "../conf/systemd.service"
|
||||
ynh_replace_string "__PORT__" "$port" "../conf/systemd.service"
|
||||
ynh_add_systemd_config
|
||||
# Create a dedicated .env config
|
||||
ynh_backup_if_checksum_is_different "$final_path/.env"
|
||||
cp "../conf/.env" "$final_path/.env"
|
||||
ynh_replace_string "__NODEJS_PATH__" "$nodejs_path" "$final_path/.env"
|
||||
ynh_replace_string "__DB_NAME__" "$db_name" "$final_path/.env"
|
||||
ynh_replace_string "__DOMAIN_URI__" "$domain$path_url" "$final_path/.env"
|
||||
ynh_replace_string "__PORT__" "$port" "$final_path/.env"
|
||||
ynh_store_file_checksum "$final_path/.env"
|
||||
fi
|
||||
|
||||
if ynh_version_gt "1.07~ynh2" "${previous_version}" ; then
|
||||
|
|
Loading…
Reference in a new issue