mirror of
https://github.com/YunoHost-Apps/movim_ynh.git
synced 2024-09-03 19:46:19 +02:00
fix
This commit is contained in:
parent
867cea5f99
commit
8a288cc743
9 changed files with 84 additions and 68 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,2 +0,0 @@
|
||||||
*~
|
|
||||||
*.sw[op]
|
|
|
@ -1,5 +1,4 @@
|
||||||
Movim for Yunohost.
|
# Movim for YunoHost
|
||||||
==========
|
|
||||||
|
|
||||||
[](https://dash.yunohost.org/appci/app/movim)  
|
[](https://dash.yunohost.org/appci/app/movim)  
|
||||||
[](https://install-app.yunohost.org/?app=movim)
|
[](https://install-app.yunohost.org/?app=movim)
|
||||||
|
@ -8,7 +7,7 @@ Movim is a decentralized social network, written in PHP and HTML5 and based on t
|
||||||
|
|
||||||
It is recommended to use a "valid" certificate to use Movim, auto-signed is sometimes problematic. You might want to take a look a StartSSL or Let's Encrypt.
|
It is recommended to use a "valid" certificate to use Movim, auto-signed is sometimes problematic. You might want to take a look a StartSSL or Let's Encrypt.
|
||||||
|
|
||||||
Provided Movim version: 0.13
|
Provided Movim version: 0.18
|
||||||
|
|
||||||
Please read CHANGELOG.
|
Please read CHANGELOG.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
SOURCE_URL=https://github.com/movim/movim/archive/v0.13.tar.gz
|
SOURCE_URL=https://github.com/movim/movim/archive/v0.18rc11.tar.gz
|
||||||
SOURCE_SUM=7aa5b2b6cd97e87a440981cfb6788a6f04ffd5eb4545026c49e1c61771593d11
|
SOURCE_SUM=6614d09f50d7cd13671dadd0c31af32d65e6309f6ba251d50b8d0d92efdb5cc9
|
||||||
SOURCE_SUM_PRG=sha256sum
|
SOURCE_SUM_PRG=sha256sum
|
||||||
SOURCE_FORMAT=tar.gz
|
SOURCE_FORMAT=tar.gz
|
||||||
|
SOURCE_IN_SUBDIR=true
|
||||||
|
SOURCE_FILENAME=
|
|
@ -3,15 +3,15 @@
|
||||||
# You need to copy an rename this file to 'db.inc.php' and complete the values
|
# You need to copy an rename this file to 'db.inc.php' and complete the values
|
||||||
$conf = [
|
$conf = [
|
||||||
# The type can be 'pgsql' or 'mysql'
|
# The type can be 'pgsql' or 'mysql'
|
||||||
'type' => 'mysql',
|
'type' => 'pgsql',
|
||||||
# The database username
|
# The database username
|
||||||
'username' => '__DB_USER__',
|
'username' => '__DB_USER__',
|
||||||
# The password
|
# The password
|
||||||
'password' => '__DB_PWD__',
|
'password' => '__DB_PWD__',
|
||||||
# Where can we find the database ?
|
# Where can we find the database ?
|
||||||
'host' => 'localhost',
|
'host' => 'localhost',
|
||||||
# The port number, 3306 for MySQL and 5432 for PostGreSQL
|
# The port number, 3306 for MySQL and 5432 for PostgreSQL
|
||||||
'port' => 3306,
|
'port' => 5432,
|
||||||
# The database name
|
# The database name
|
||||||
'database' => '__DB_NAME__'
|
'database' => '__DB_NAME__'
|
||||||
];
|
];
|
|
@ -15,7 +15,7 @@ location __PATH__/ {
|
||||||
}
|
}
|
||||||
|
|
||||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||||
fastcgi_pass unix:/var/run/php-fpm-__NAME__.sock;
|
fastcgi_pass unix:/var/run/php7.3-fpm-__NAME__.sock;
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_param REMOTE_USER $remote_user;
|
fastcgi_param REMOTE_USER $remote_user;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Movim daemon (__APP__)
|
Description=Movim daemon
|
||||||
After=nginx.service network.target local-fs.target mysql.service
|
After=nginx.service network.target local-fs.target postgresql.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
"description": {
|
"description": {
|
||||||
"en": "The Kickass Social Network"
|
"en": "The Kickass Social Network"
|
||||||
},
|
},
|
||||||
"version": "0.13.0~ynh1",
|
"version": "0.18.0~ynh1",
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 3.0"
|
"yunohost": ">= 3.8.1"
|
||||||
},
|
},
|
||||||
"url": "https://movim.eu/",
|
"url": "https://movim.eu/",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
|
@ -18,9 +18,7 @@
|
||||||
},
|
},
|
||||||
"services": [
|
"services": [
|
||||||
"nginx",
|
"nginx",
|
||||||
"php5-fpm",
|
"php7.0-fpm"
|
||||||
"mysql",
|
|
||||||
"metronome"
|
|
||||||
],
|
],
|
||||||
"multi_instance": false,
|
"multi_instance": false,
|
||||||
"arguments": {
|
"arguments": {
|
||||||
|
@ -74,7 +72,7 @@
|
||||||
{
|
{
|
||||||
"name": "ssoenabled",
|
"name": "ssoenabled",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Enable SSO support (autologin) ?",
|
"en": "Enable SSO support (autologin)?",
|
||||||
"fr": "Activer le support SSO (connexin auto) ?"
|
"fr": "Activer le support SSO (connexin auto) ?"
|
||||||
},
|
},
|
||||||
"choices": ["Yes", "No"],
|
"choices": ["Yes", "No"],
|
||||||
|
|
|
@ -1,7 +1,26 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
|
||||||
# Common variables
|
#=================================================
|
||||||
#
|
# COMMON VARIABLES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# dependencies used by the app
|
||||||
|
pkg_dependencies="postgresql composer php-fpm php-curl php-mbstring php-imagick php-gd php-pgsql php-xml"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# PERSONAL HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# EXPERIMENTAL HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# FUTURE OFFICIAL HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# App package root directory should be the parent folder
|
# App package root directory should be the parent folder
|
||||||
PKGDIR=$(cd ../; pwd)
|
PKGDIR=$(cd ../; pwd)
|
||||||
|
|
|
@ -28,99 +28,95 @@ language=$YNH_APP_ARG_LANGUAGE
|
||||||
ssoenabled=$YNH_APP_ARG_SSOENABLED
|
ssoenabled=$YNH_APP_ARG_SSOENABLED
|
||||||
timezone=$(cat /etc/timezone)
|
timezone=$(cat /etc/timezone)
|
||||||
|
|
||||||
### If it's a multi-instance app, meaning it can be installed several times independently
|
|
||||||
### The id of the app as stated in the manifest is available as $YNH_APP_ID
|
|
||||||
### The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...)
|
|
||||||
### The app instance name is available as $YNH_APP_INSTANCE_NAME
|
|
||||||
### - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample
|
|
||||||
### - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2
|
|
||||||
### - ynhexample__{N} for the subsequent installations, with N=3,4, ...
|
|
||||||
### The app instance name is probably what interests you most, since this is
|
|
||||||
### guaranteed to be unique. This is a good unique identifier to define installation path,
|
|
||||||
### db names, ...
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
||||||
|
|
||||||
final_path=/var/www/$app
|
final_path=/var/www/$app
|
||||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||||
|
|
||||||
# Normalize the url path syntax
|
|
||||||
path_url=$(ynh_normalize_url_path $path_url)
|
|
||||||
|
|
||||||
# Check web path availability
|
|
||||||
ynh_webpath_available $domain $path_url
|
|
||||||
# Register (book) web path
|
# Register (book) web path
|
||||||
ynh_webpath_register $app $domain $path_url
|
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Storing installation settings..." --weight=2
|
||||||
|
|
||||||
# Save app settings
|
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||||
ynh_app_setting_set "$app" admin "$admin"
|
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||||
ynh_app_setting_set "$app" ssoenabled "$ssoenabled"
|
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||||
ynh_app_setting_set "$app" path "$path_url"
|
ynh_app_setting_set --app=$app --key=ssoenabled --value=$ssoenabled
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
# FIND AND OPEN A PORT
|
# FIND AND OPEN A PORT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring firewall..." --weight=2
|
||||||
|
|
||||||
# Find a free port
|
# Find a free port
|
||||||
port=$(ynh_find_port 9537)
|
port=$(ynh_find_port 9537)
|
||||||
|
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||||
|
|
||||||
# Open this port
|
# Open this port
|
||||||
yunohost firewall allow --no-upnp TCP "$port" 2>&1
|
yunohost firewall allow --no-upnp TCP "$port" 2>&1
|
||||||
ynh_app_setting_set "$app" port "$port"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Installing dependencies..." --time --weight=1
|
||||||
|
|
||||||
# Install packages
|
# Install packages
|
||||||
ynh_install_app_dependencies php-gd php-curl php-imagick php-cli php-zmq
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE A MYSQL DATABASE
|
# CREATE A POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2
|
||||||
|
|
||||||
db_name=$(ynh_sanitize_dbid "$app")
|
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||||
db_user=$db_name
|
db_user=$db_name
|
||||||
ynh_app_setting_set "$app" db_name "$db_name"
|
db_pwd=$(ynh_string_random --length=30)
|
||||||
ynh_mysql_setup_db "$db_user" "$db_name"
|
|
||||||
|
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||||
|
ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
|
||||||
|
|
||||||
|
ynh_psql_test_if_first_run
|
||||||
|
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Setting up source files..." --time --weight=1
|
||||||
|
|
||||||
ynh_app_setting_set "$app" final_path "$final_path"
|
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source "$final_path"
|
ynh_setup_source --dest_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring nginx web server..." --time --weight=1
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
ynh_replace_string "//ws/" "/ws/" "$finalnginxconf" # Avoid duplicate /
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring system user..." --time --weight=1
|
||||||
|
|
||||||
# Create a system user
|
# Create a system user
|
||||||
ynh_system_user_create "$app"
|
ynh_system_user_create --username=$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring php-fpm..." --time --weight=1
|
||||||
|
|
||||||
# Create a dedicated php-fpm config
|
# Create a dedicated php-fpm config
|
||||||
ynh_replace_string "YHTZ" "$timezone" ../conf/php-fpm.ini
|
ynh_replace_string "YHTZ" "$timezone" ../conf/php-fpm.ini
|
||||||
|
@ -129,17 +125,20 @@ ynh_add_fpm_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# SET CONFIGURATION FILE
|
# SET CONFIGURATION FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Modifying a config file..."
|
||||||
|
|
||||||
# TODO: add checksum
|
cp ../conf/db.example.inc.php $final_path/config/db.inc.php
|
||||||
cp ../conf/db.inc.php "$final_path/config/db.inc.php"
|
|
||||||
|
|
||||||
ynh_replace_string "__DB_USER__" "$db_user" "$final_path/config/db.inc.php"
|
ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$final_path/config/db.inc.php"
|
||||||
ynh_replace_string "__DB_PWD__" "$db_pwd" "$final_path/config/db.inc.php"
|
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/config/db.inc.php"
|
||||||
ynh_replace_string "__DB_NAME__" "$db_name" "$final_path/config/db.inc.php"
|
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/config/db.inc.php"
|
||||||
|
|
||||||
## TODO: consider installation in a subpath
|
ynh_store_file_checksum --file="$final_path/config/db.inc.php"
|
||||||
ynh_replace_string "'/ws/'" "'${path_url%/}/ws/'" \
|
|
||||||
"$final_path/app/assets/js/movim_websocket.js"
|
|
||||||
|
## TODO: consider installation in a subpath
|
||||||
|
ynh_replace_string "'/ws/'" "'${path_url%/}/ws/'" \
|
||||||
|
"$final_path/app/assets/js/movim_websocket.js"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# Install PHP dependencies using composer
|
# Install PHP dependencies using composer
|
||||||
|
@ -156,10 +155,11 @@ ynh_replace_string "'/ws/'" "'${path_url%/}/ws/'" \
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
||||||
|
|
||||||
|
ynh_replace_string --match_string="__URL__" --replace_string="${domain}${path_url}" --target_file=../conf/systemd.service
|
||||||
|
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file=../conf/systemd.service
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
|
||||||
ynh_replace_string "__URL__" "${domain}${path_url}" ../conf/systemd.service
|
|
||||||
ynh_replace_string "__PORT__" "${port}" ../conf/systemd.service
|
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue