1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/hedgedoc_ynh.git synced 2024-09-03 19:25:52 +02:00
This commit is contained in:
Éric Gaspar 2024-05-28 23:31:51 +02:00
parent 4a83da3d50
commit c412fb04cd
5 changed files with 6 additions and 28 deletions

View file

@ -7,12 +7,12 @@ After=network.target postgresql.service __APP___backend.service
Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__FINALPATH__/frontend
Environment="PATH=__ENV_PATH__"
WorkingDirectory=__INSTALL_DIR__/frontend
Environment="__YNH_NODE_LOAD_PATH__"
Environment="NODE_ENV=production"
Environment="PORT=__PORT_FRONTEND__"
Environment="REACT_APP_BACKEND_BASE_URL=http://localhost:__PORT_BACKEND__/"
ExecStart=__FINALPATH__/frontend/node_modules/.bin/cross-env PORT=__PORT_FRONTEND__ REACT_APP_BACKEND_BASE_URL=http://localhost:__PORT_BACKEND__/ __FINAL_PATH__/frontend/node_modules/.bin/craco start
ExecStart=__INSTALL_DIR__/frontend/node_modules/.bin/cross-env PORT=__PORT_FRONTEND__ REACT_APP_BACKEND_BASE_URL=http://localhost:__PORT_BACKEND__/ __INSTALL_DIR__/frontend/node_modules/.bin/craco start
Restart=always
PrivateTmp=true
PrivateDevices=true

View file

@ -53,6 +53,8 @@ ram.runtime = "50M"
autoupdate.strategy = "latest_github_tag"
[resources.ports]
frontend.default = 3001
backend.default = 3000
[resources.system_user]

View file

@ -36,7 +36,7 @@ ynh_backup_if_checksum_is_different --file="$install_dir/config.json"
domain=$new_domain
url_path=${new_path#/}
ynh_add_config --template="../conf/config.json.example" --destination="$install_dir/config.json"
ynh_add_config --template="config.json.example" --destination="$install_dir/config.json"
chmod 400 "$install_dir/config.json"
chown $app:$app "$install_dir/config.json"

View file

@ -26,21 +26,6 @@ require_free_url_authentication=false
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 available ports..." --weight=2
# Find an available port for the backend
port_backend=$(ynh_find_port --port=3000)
ynh_app_setting_set --app=$app --key=port_backend --value=$port_backend
# Find an available port for the frontend
port_frontend=$(ynh_find_port --port=$(($port_backend+1)))
ynh_app_setting_set --app=$app --key=port_frontend --value=$port_frontend
#=================================================
# INSTALL DEPENDENCIES
#=================================================
@ -78,7 +63,6 @@ yunohost service add $app --description="Collaborative Markdown editor" --log="/
#==============================================
# INSTALL HEDGEDOC
#==============================================
ynh_script_progression --message="Building HedgeDoc backend... (this will take some time and resources!)" --weight=20
pushd "$install_dir/backend"
@ -100,9 +84,6 @@ popd
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1
ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/backend.service"
ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/frontend.service"
ynh_add_systemd_config --service="${app}_backend" --template="../conf/backend.service"
ynh_add_systemd_config --service="${app}_frontend" --template="../conf/frontend.service"

View file

@ -29,11 +29,6 @@ then
yunohost service remove ${app}_frontend
fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stopping and removing the systemd services..." --weight=1
# Remove the dedicated systemd config
ynh_remove_systemd_config --service=${app}_backend
ynh_remove_systemd_config --service=${app}_frontend