mirror of
https://github.com/YunoHost-Apps/mobilizon_ynh.git
synced 2024-09-03 19:46:19 +02:00
commit
8d20652e67
4 changed files with 31 additions and 40 deletions
|
@ -30,6 +30,15 @@
|
|||
},
|
||||
"example": "example.com"
|
||||
},
|
||||
{
|
||||
"name": "admin",
|
||||
"type": "user",
|
||||
"ask": {
|
||||
"en": "Choose an admin user",
|
||||
"fr": "Choisissez l'administrateur"
|
||||
},
|
||||
"example": "johndoe"
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
|
@ -48,15 +57,6 @@
|
|||
},
|
||||
"choices": ["fr", "en"],
|
||||
"default": "fr"
|
||||
},
|
||||
{
|
||||
"name": "admin",
|
||||
"type": "user",
|
||||
"ask": {
|
||||
"en": "Choose an admin user",
|
||||
"fr": "Choisissez l'administrateur"
|
||||
},
|
||||
"example": "johndoe"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -145,37 +145,37 @@ chown -R "$app":"$app" "$final_path"
|
|||
config="$final_path/$app/config/prod.secret.exs"
|
||||
|
||||
pushd $final_path/$app/js
|
||||
ynh_use_nodejs
|
||||
ynh_script_progression --message="Installing NodeJS dependencies (this is going to take a while...)"
|
||||
sudo -u $app env PATH=$PATH yarn install
|
||||
ynh_script_progression --message="Building NodeJS application (this is going to take a while...)"
|
||||
sudo -u $app env PATH=$PATH NODE_BUILD_MEMORY=1024 yarn run build
|
||||
ynh_use_nodejs
|
||||
ynh_script_progression --message="Installing NodeJS dependencies (this is going to take a while...)"
|
||||
sudo -u $app env PATH=$PATH yarn install
|
||||
ynh_script_progression --message="Building NodeJS application (this is going to take a while...)"
|
||||
sudo -u $app env PATH=$PATH NODE_BUILD_MEMORY=1024 yarn run build
|
||||
popd
|
||||
|
||||
ynh_script_progression --message="Building Elixir application (this is going to take a while...)"
|
||||
pushd $final_path/$app
|
||||
sudo -u "$app" MIX_ENV=prod mix local.hex --force
|
||||
sudo -u "$app" MIX_ENV=prod mix local.rebar --force
|
||||
sudo -u "$app" MIX_ENV=prod mix deps.get
|
||||
sudo -u "$app" MIX_ENV=prod mix compile
|
||||
sudo -u "$app" MIX_ENV=prod mix mobilizon.instance gen --force --output $config --output-psql /tmp/setup_db.psql --domain $domain --instance-name "Mobilizon" --admin-email "$app@$domain" --dbhost localhost --dbname $db_name --dbuser $db_user --dbpass $db_pwd --listen-port $port
|
||||
sudo -u "$app" MIX_ENV=prod mix local.hex --force
|
||||
sudo -u "$app" MIX_ENV=prod mix local.rebar --force
|
||||
sudo -u "$app" MIX_ENV=prod mix deps.get
|
||||
sudo -u "$app" MIX_ENV=prod mix compile
|
||||
sudo -u "$app" MIX_ENV=prod mix mobilizon.instance gen --force --output $config --output-psql /tmp/setup_db.psql --domain $domain --instance-name "Mobilizon" --admin-email "$app@$domain" --dbhost localhost --dbname $db_name --dbuser $db_user --dbpass $db_pwd --listen-port $port
|
||||
popd
|
||||
|
||||
cat "../conf/ldap.exs" >> "$config"
|
||||
cat "../conf/mail.exs" >> "$config"
|
||||
|
||||
pushd $final_path/$app
|
||||
chmod o-rwx $config
|
||||
ynh_replace_string --match_string="__YNH_USER__" --replace_string="${app}_notifs" --target_file="$config"
|
||||
ynh_replace_string --match_string="__YNH_USER_PASSWORD__" --replace_string="${ynh_user_password}" --target_file="$config"
|
||||
# Compile *again* because we added ldap conf in between... dunno if the first is relevant
|
||||
sudo -u "$app" MIX_ENV=prod mix compile
|
||||
ynh_secure_remove --file="/tmp/setup_db.psql"
|
||||
sudo -u "$app" MIX_ENV=prod mix ecto.migrate
|
||||
chmod o-rwx $config
|
||||
ynh_replace_string --match_string="__YNH_USER__" --replace_string="${app}_notifs" --target_file="$config"
|
||||
ynh_replace_string --match_string="__YNH_USER_PASSWORD__" --replace_string="${ynh_user_password}" --target_file="$config"
|
||||
# Compile *again* because we added ldap conf in between... dunno if the first is relevant
|
||||
sudo -u "$app" MIX_ENV=prod mix compile
|
||||
ynh_secure_remove --file="/tmp/setup_db.psql"
|
||||
sudo -u "$app" MIX_ENV=prod mix ecto.migrate
|
||||
|
||||
# We generate a dummy password ... this will actually *not* be used because the admin is supposed to connect via the ldap
|
||||
password=$(ynh_string_random --length=30)
|
||||
sudo -u "$app" MIX_ENV=prod mix mobilizon.users.new "$admin_email" --admin --password "$password"
|
||||
# We generate a dummy password ... this will actually *not* be used because the admin is supposed to connect via the ldap
|
||||
password=$(ynh_string_random --length=30)
|
||||
sudo -u "$app" MIX_ENV=prod mix mobilizon.users.new "$admin_email" --admin --password "$password"
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -57,9 +57,8 @@ ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
|||
ynh_script_progression --message="Removing dependencies..."
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
ynh_remove_nodejs
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
|
|
|
@ -98,15 +98,7 @@ if ynh_version_gt "1.0.0~ynh1" "${previous_version}" ; then
|
|||
|
||||
# Configure Mobilizon
|
||||
config="$final_path/$app/config/prod.secret.exs"
|
||||
cp ../conf/prod.secret.exs "$config"
|
||||
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config"
|
||||
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config"
|
||||
ynh_replace_string --match_string="__SECRET__" --replace_string="$secret" --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_PWD__" --replace_string="$db_pwd" --target_file="$config"
|
||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$config"
|
||||
ynh_replace_string --match_string="__ADMIN_EMAIL__" --replace_string="$admin_email" --target_file="$config"
|
||||
ynh_add_config --template="../conf/prod.secret.exs" --destination="$config"
|
||||
|
||||
# Implement ldap and mail
|
||||
cat "../conf/ldap.exs" >> "$config"
|
||||
|
|
Loading…
Add table
Reference in a new issue