diff --git a/conf/.env b/conf/.env new file mode 100644 index 0000000..afa1777 --- /dev/null +++ b/conf/.env @@ -0,0 +1,14 @@ +# Database configuration +DB_DRIVER=pgsql +DB_HOST=127.0.0.1 +DB_PORT=5432 +DB_DATABASE=__DB_NAME__ +DB_USERNAME=__DB_USER__ +DB_PASSWORD=__DB_PWD__ + +# Daemon configuration +DAEMON_URL=https://__DOMAIN____PATH__/ # Public URL of your Movim instance +DAEMON_PORT=__PORT__ # Port on which the daemon will listen +DAEMON_INTERFACE=127.0.0.1 # Interface on which the daemon will listen, must be an IP +DAEMON_DEBUG=true +DAEMON_VERBOSE=true diff --git a/conf/db.example.inc.php b/conf/db.example.inc.php deleted file mode 100644 index 26e9bfb..0000000 --- a/conf/db.example.inc.php +++ /dev/null @@ -1,17 +0,0 @@ - 'pgsql', - # The database username - 'username' => '__DB_USER__', - # The password - 'password' => '__DB_PWD__', - # Where can we find the database ? - 'host' => 'localhost', - # The port number, 3306 for MySQL and 5432 for PostgreSQL - 'port' => 5432, - # The database name - 'database' => '__DB_NAME__' -]; diff --git a/conf/systemd.service b/conf/systemd.service index 8e6662d..7edc87f 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -9,7 +9,7 @@ Group=__APP__ Environment=PUBLIC_URL=https://__DOMAIN____PATH__/ Environment=WS_PORT=__PORT__ WorkingDirectory=__INSTALL_DIR__/ -ExecStart=/usr/bin/php__PHPVERSION__ daemon.php start --url=${PUBLIC_URL} --port=${WS_PORT} +ExecStart=/usr/bin/php__PHPVERSION__ daemon.php start StandardOutput=syslog SyslogIdentifier=__APP__ PIDFile=/run/movim.pid diff --git a/scripts/install b/scripts/install index 5717f3f..8ce466b 100644 --- a/scripts/install +++ b/scripts/install @@ -34,10 +34,10 @@ chown -R "$app:www-data" "$install_dir" #================================================= ynh_script_progression --message="Adding $app's configuration file..." -ynh_add_config --template="db.example.inc.php" --destination="$install_dir/config/db.inc.php" +ynh_add_config --template=".env" --destination="$install_dir/.env" -chmod 400 "$install_dir/config/db.inc.php" -chown "$app:$app" "$install_dir/config/db.inc.php" +chmod 650 "$install_dir/.env" +chown "$app:$app" "$install_dir/.env" #================================================= # BUILD MOVIM @@ -47,8 +47,8 @@ ynh_script_progression --message="Building Movim..." # Install composer ynh_install_composer +ynh_exec_warn_less ynh_composer_exec --commands="install" ynh_exec_warn_less ynh_composer_exec --commands="movim:migrate" -ynh_exec_as "$app" "php$phpversion" "$install_dir/daemon.php" config --username="$admin" --password="$password" --quiet #================================================= # SYSTEM CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 3a2386a..b6cd5ff 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,7 +20,7 @@ ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" ynh_script_progression --message="Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="config/db.inc.php" +ynh_setup_source --dest_dir="$install_dir" --full_replace=1 # Temporary workaround to fix movim.ERROR: Error: Call to undefined function GuzzleHttp\Psr7\uri_for() ynh_replace_string --match_string="0.3.5" --replace_string="0.4.1" --target_file="$install_dir/composer.json" @@ -33,10 +33,10 @@ chown -R "$app:www-data" "$install_dir" #================================================= ynh_script_progression --message="Updating $app's configuration file..." -ynh_add_config --template="db.example.inc.php" --destination="$install_dir/config/db.inc.php" +ynh_add_config --template=".env" --destination="$install_dir/.env" -chmod 400 "$install_dir/config/db.inc.php" -chown "$app:$app" "$install_dir/config/db.inc.php" +chmod 400 "$install_dir/.env" +chown "$app:$app" "$install_dir/.env" #================================================= # BUILD MOVIM