mirror of
https://github.com/YunoHost-Apps/funkwhale_ynh.git
synced 2024-09-03 18:36:24 +02:00
Fix installation
This commit is contained in:
parent
cdbac5d964
commit
d61c8f6e97
5 changed files with 45 additions and 13 deletions
6
conf/app-frontend.src
Normal file
6
conf/app-frontend.src
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
SOURCE_URL=https://code.eliotberriot.com/funkwhale/funkwhale/builds/artifacts/0.12/download?job=build_front
|
||||||
|
SOURCE_SUM=9c83b90877c6025654c071a87dd60dd69c5548df0fdfa77abcc27a259c846c64
|
||||||
|
SOURCE_SUM_PRG=sha256sum
|
||||||
|
SOURCE_FORMAT=zip
|
||||||
|
SOURCE_IN_SUBDIR=false
|
||||||
|
SOURCE_FILENAME=
|
|
@ -1,4 +1,5 @@
|
||||||
location / {
|
location / {
|
||||||
|
alias __FINALPATH__/front/dist/;
|
||||||
try_files $uri $uri/ @rewrites;
|
try_files $uri $uri/ @rewrites;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,18 +25,18 @@
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain",
|
"type": "domain",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Choose a domain for Weblate:"
|
"en": "Choose a domain"
|
||||||
},
|
},
|
||||||
"example": "domain.org"
|
"example": "domain.fr"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "path",
|
"name": "path",
|
||||||
"type": "path",
|
"type": "path",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Choose a path for Weblate:"
|
"en": "Choose a path"
|
||||||
},
|
},
|
||||||
"example": "/weblate",
|
"example": "/funkwhale",
|
||||||
"default": "/weblate"
|
"default": "/funkwhale"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "is_public",
|
"name": "is_public",
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Choose an admin user for Funkwhale?"
|
"en": "Choose an admin user for Funkwhale?"
|
||||||
},
|
},
|
||||||
"example": "jean-baptiste"
|
"example": "jibec"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@ domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url=$YNH_APP_ARG_PATH
|
path_url=$YNH_APP_ARG_PATH
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
admin=$YNH_APP_ARG_ADMIN
|
admin=$YNH_APP_ARG_ADMIN
|
||||||
port=$(ynh_find_port 5000)
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -53,11 +52,22 @@ ynh_app_setting_set "$app" domain "$domain"
|
||||||
ynh_app_setting_set "$app" path "$path_url"
|
ynh_app_setting_set "$app" path "$path_url"
|
||||||
ynh_app_setting_set "$app" is_public "$is_public"
|
ynh_app_setting_set "$app" is_public "$is_public"
|
||||||
ynh_app_setting_set "$app" admin "$admin"
|
ynh_app_setting_set "$app" admin "$admin"
|
||||||
ynh_app_setting_set "$app" port "$port"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
# FIND AND OPEN A PORT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Find a free port
|
||||||
|
port=$(ynh_find_port 5000)
|
||||||
|
# Open this port
|
||||||
|
yunohost firewall allow --no-upnp TCP "$port" 2>&1
|
||||||
|
ynh_app_setting_set "$app" port "$port"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# INSTALL DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# add backports (required to install ffmpeg)
|
# add backports (required to install ffmpeg)
|
||||||
echo "deb http://httpredir.debian.org/debian jessie-backports main" | tee /etc/apt/sources.list.d/jessie-backports.list
|
echo "deb http://httpredir.debian.org/debian jessie-backports main" | tee /etc/apt/sources.list.d/jessie-backports.list
|
||||||
|
@ -89,6 +99,7 @@ systemctl reload postgresql
|
||||||
ynh_app_setting_set "$app" final_path "$final_path"
|
ynh_app_setting_set "$app" final_path "$final_path"
|
||||||
# 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 "$final_path"
|
ynh_setup_source "$final_path"
|
||||||
|
ynh_setup_source "$final_path" "app-frontend"
|
||||||
|
|
||||||
(
|
(
|
||||||
cd "$final_path"
|
cd "$final_path"
|
||||||
|
@ -158,7 +169,7 @@ ynh_replace_string "__DBNAME__" "$app" "$configfile"
|
||||||
ynh_replace_string "__FINALPATH__" "$final_path" "$configfile"
|
ynh_replace_string "__FINALPATH__" "$final_path" "$configfile"
|
||||||
ynh_replace_string "__KEY__" "$key" "$configfile"
|
ynh_replace_string "__KEY__" "$key" "$configfile"
|
||||||
|
|
||||||
cat > "$final_path/load_env" <<EOL
|
cat > "$final_path/load_env" <<'EOL'
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export $(cat "$final_path/config/.env" | grep -v ^# | xargs)
|
export $(cat "$final_path/config/.env" | grep -v ^# | xargs)
|
||||||
EOL
|
EOL
|
||||||
|
@ -182,10 +193,7 @@ admin_mail=$(ynh_user_get_info "$admin" "mail")
|
||||||
ynh_psql_execute_as_root "ALTER USER $db_user WITH SUPERUSER;"
|
ynh_psql_execute_as_root "ALTER USER $db_user WITH SUPERUSER;"
|
||||||
python api/manage.py migrate
|
python api/manage.py migrate
|
||||||
ynh_psql_execute_as_root "ALTER USER $db_user WITH NOSUPERUSER;"
|
ynh_psql_execute_as_root "ALTER USER $db_user WITH NOSUPERUSER;"
|
||||||
python api/manage.py createsuperuser \
|
echo "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('$admin', '$admin_mail', 'funkwhale') " | python api/manage.py shell
|
||||||
--username "$admin" \
|
|
||||||
--email "$admin_mail" \
|
|
||||||
--noinput
|
|
||||||
python api/manage.py collectstatic
|
python api/manage.py collectstatic
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -194,6 +202,8 @@ admin_mail=$(ynh_user_get_info "$admin" "mail")
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
cp ../conf/funkwhale.target "/etc/systemd/system/$app.target"
|
cp ../conf/funkwhale.target "/etc/systemd/system/$app.target"
|
||||||
|
ynh_replace_string "__APP__" "$app" "/etc/systemd/system/$app.target"
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
ynh_add_systemd_config "$app-server" "funkwhale-server.service"
|
ynh_add_systemd_config "$app-server" "funkwhale-server.service"
|
||||||
ynh_add_systemd_config "$app-worker" "funkwhale-worker.service"
|
ynh_add_systemd_config "$app-worker" "funkwhale-worker.service"
|
||||||
|
@ -230,4 +240,5 @@ fi
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
systemctl start "$app-server" "$app-worker" "$app-beat"
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
|
@ -19,6 +19,7 @@ domain=$(ynh_app_setting_get $app domain)
|
||||||
db_name=$(ynh_app_setting_get $app db_name)
|
db_name=$(ynh_app_setting_get $app db_name)
|
||||||
db_user=$db_name
|
db_user=$db_name
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
|
port=$(ynh_app_setting_get $app port)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
|
@ -30,6 +31,9 @@ final_path=$(ynh_app_setting_get $app final_path)
|
||||||
ynh_remove_systemd_config "$app-server"
|
ynh_remove_systemd_config "$app-server"
|
||||||
ynh_remove_systemd_config "$app-worker"
|
ynh_remove_systemd_config "$app-worker"
|
||||||
ynh_remove_systemd_config "$app-beat"
|
ynh_remove_systemd_config "$app-beat"
|
||||||
|
|
||||||
|
systemctl disable "$app".target
|
||||||
|
systemctl stop "$app".target
|
||||||
ynh_secure_remove "/etc/systemd/system/$app.target"
|
ynh_secure_remove "/etc/systemd/system/$app.target"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -67,6 +71,16 @@ ynh_secure_remove "$final_path"
|
||||||
# Remove the dedicated nginx config
|
# Remove the dedicated nginx config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CLOSE A PORT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
if yunohost firewall list | grep -q "\- $port$"
|
||||||
|
then
|
||||||
|
echo "Close port $port"
|
||||||
|
yunohost firewall disallow TCP $port 2>&1
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Reference in a new issue