diff --git a/conf/default.env b/conf/default.env new file mode 100644 index 0000000..19aaf53 --- /dev/null +++ b/conf/default.env @@ -0,0 +1,57 @@ +APP_NAME="Invoice Ninja" +APP_ENV=production +APP_KEY=base64:3E5HVZ/T+VbZu+oA4GNlwnvwFe3jNtkGbR95K0uwr7A= +APP_DEBUG=false + +APP_URL=http://localhost + +DB_CONNECTION=mysql +MULTI_DB_ENABLED=false + +DB_HOST=localhost +DB_DATABASE=__DB_NAME__ +DB_USERNAME=__DB_NAME__ +DB_PASSWORD=__DB_PWD__ +DB_PORT=3306 + +DEMO_MODE=false + +BROADCAST_DRIVER=log +LOG_CHANNEL=stack +CACHE_DRIVER=file +QUEUE_CONNECTION=sync +SESSION_DRIVER=file +SESSION_LIFETIME=120 + +REDIS_HOST=127.0.0.1 +REDIS_PASSWORD=null +REDIS_PORT=6379 + +MAIL_MAILER=smtp +MAIL_HOST=smtp.__DOMAIN__ +MAIL_PORT=25 +MAIL_USERNAME=null +MAIL_PASSWORD=null +MAIL_ENCRYPTION=null +MAIL_FROM_ADDRESS='__EMAIL__' +MAIL_FROM_NAME='__EMAIL_NAME__' + +POSTMARK_API_TOKEN= +REQUIRE_HTTPS=false + +GOOGLE_MAPS_API_KEY= +ERROR_EMAIL= +TRUSTED_PROXIES= + +NINJA_ENVIRONMENT=selfhost + +#options - snappdf / phantom / hosted_ninja +PDF_GENERATOR=phantom + +PHANTOMJS_KEY='__PHANTOMJS_KEY__' +PHANTOMJS_SECRET=__APP_KEY__ + +UPDATE_SECRET=__API_SECRET__ + +COMPOSER_AUTH='{"github-oauth": {"github.com": "${{ secrets.GITHUB_TOKEN }}"}}' +SENTRY_LARAVEL_DSN=https://cc7e8e2c678041689e53e409b7dba236@sentry.invoicing.co/5 diff --git a/scripts/_common.sh b/scripts/_common.sh index 00b70ee..68382f0 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,14 +6,12 @@ YNH_PHP_VERSION="7.3" -nodejs_version=12 - # dependencies used by the app #pkg_dependencies="phantomjs gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget" +pkg_dependencies="phantomjs" extra_php_dependencies="php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-gmp php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-fileinfo php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-pdo php${YNH_PHP_VERSION}-tokenizer php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-mysql" - #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/install b/scripts/install index e651fa7..50be883 100755 --- a/scripts/install +++ b/scripts/install @@ -55,8 +55,8 @@ ynh_app_setting_set --app=$app --key=api_secret --value="$(ynh_string_random --l ynh_app_setting_set --app=$app --key=app_key --value="$(ynh_string_random --length=32)" ynh_app_setting_set --app=$app --key=phantomjs_key --value="$(ynh_string_random --length=32)" -ynh_app_setting_set --app=$app --key=mail_from_address --value="$(ynh_user_get_info $admin mail)" -ynh_app_setting_set --app=$app --key=mail_from_name --value="$(ynh_user_get_info $admin firstname) $(ynh_user_get_info $admin lastname)" +ynh_app_setting_set --app=$app --key=email --value="$(ynh_user_get_info $admin mail)" +ynh_app_setting_set --app=$app --key=email__name --value="$(ynh_user_get_info $admin firstname) $(ynh_user_get_info $admin lastname)" #================================================= # STANDARD MODIFICATIONS @@ -77,10 +77,7 @@ ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name #================================================= ynh_script_progression --message="Installing dependencies..." -#ynh_install_app_dependencies $pkg_dependencies - -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version -ynh_use_nodejs +ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE DEDICATED USER @@ -106,7 +103,7 @@ chown -R $app:www-data "$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." +ynh_script_progression --message="Configuring NGINX web server..." # Create a dedicated nginx config ynh_add_nginx_config @@ -114,7 +111,7 @@ ynh_add_nginx_config #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring php-fpm..." +ynh_script_progression --message="Configuring PHP-FPM..." # Create a dedicated php-fpm config ynh_add_fpm_config --package="$extra_php_dependencies" @@ -127,24 +124,7 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= ynh_script_progression --message="Modifying a config file..." -config="$final_path/.env" -ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$config" - -ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config" -ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$config" -ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$config" -ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$config" -ynh_replace_string --match_string="__DB_PASS__" --replace_string="$db_pwd" --target_file="$config" - -ynh_replace_string --match_string="__API_SECRET__" --replace_string="$(ynh_app_setting_get --app=$app --key=api_secret)" --target_file="$config" -ynh_replace_string --match_string="__APP_KEY__" --replace_string="$(ynh_app_setting_get --app=$app --key=app_key)" --target_file="$config" -ynh_replace_string --match_string="__PHANTOMJS_KEY__" --replace_string="$(ynh_app_setting_get --app=$app --key=phantomjs_jey)" --target_file="$config" - -ynh_replace_string --match_string="__MAIL_FROM_ADDRESS__" --replace_string="$(ynh_app_setting_get --app=$app --key=mail_from_address)" --target_file="$config" -ynh_replace_string --match_string="__MAIL_FROM_NAME__" --replace_string="$(ynh_app_setting_get --app=$app --key=mail_from_name)" --target_file="$config" - -# Calculate and store the config file checksum into the app settings -ynh_store_file_checksum --file="$config" +ynh_add_config --template="../conf/default.env" --destination="$final_path/.env" #================================================= # BUILD THE APPLICATION @@ -177,7 +157,7 @@ chmod 644 "/etc/cron.d/$app" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload