mirror of
https://github.com/YunoHost-Apps/acropolis_ynh.git
synced 2024-09-03 18:06:22 +02:00
Continue manifestv2
This commit is contained in:
parent
3843310bdf
commit
ee9cec8efe
3 changed files with 73 additions and 132 deletions
|
@ -7,7 +7,7 @@ name = "Acropolis"
|
||||||
description.en = "Dynamic fork of diaspora*'s federated social network"
|
description.en = "Dynamic fork of diaspora*'s federated social network"
|
||||||
description.fr = "Fourche dynamique du réseau social fédéré de diaspora*"
|
description.fr = "Fourche dynamique du réseau social fédéré de diaspora*"
|
||||||
|
|
||||||
version = "2022.01.29~ynh1"
|
version = "2022.01.29~ynh2"
|
||||||
|
|
||||||
maintainers = ["weex"]
|
maintainers = ["weex"]
|
||||||
|
|
||||||
|
@ -17,8 +17,8 @@ website = "https://magicstone.dev"
|
||||||
code = "https://github.com/magicstone-dev/acropolis"
|
code = "https://github.com/magicstone-dev/acropolis"
|
||||||
|
|
||||||
[integration]
|
[integration]
|
||||||
yunohost = ">= 4.3.0"
|
yunohost = ">=11.2"
|
||||||
architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"]
|
architectures = "all"
|
||||||
multi_instance = false
|
multi_instance = false
|
||||||
ldap = false
|
ldap = false
|
||||||
sso = false
|
sso = false
|
||||||
|
@ -64,7 +64,7 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen
|
||||||
[resources.apt]
|
[resources.apt]
|
||||||
packages = [
|
packages = [
|
||||||
"g++",
|
"g++",
|
||||||
"libjemalloc1|libjemalloc2",
|
# "libjemalloc1|libjemalloc2",
|
||||||
"libjemalloc-dev",
|
"libjemalloc-dev",
|
||||||
"zlib1g-dev",
|
"zlib1g-dev",
|
||||||
"libreadline-dev",
|
"libreadline-dev",
|
||||||
|
|
136
scripts/install
136
scripts/install
|
@ -1,7 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -13,14 +11,30 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing dependencies..." --weight=1
|
ynh_script_progression --message="Installing Ruby..." --weight=1
|
||||||
|
|
||||||
ynh_exec_warn_less ynh_install_ruby --ruby_version="$RUBY_VERSION"
|
ynh_exec_warn_less ynh_install_ruby --ruby_version="$RUBY_VERSION"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# ADD SWAP IF NEEDED
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Adding swap if needed..."
|
||||||
|
|
||||||
|
total_memory=$(ynh_get_ram --total)
|
||||||
|
swap_needed=0
|
||||||
|
|
||||||
|
if (( MEMORY_NEEDED > total_memory )); then
|
||||||
|
# Need a minimum of 2.5Go of memory
|
||||||
|
swap_needed=$((MEMORY_NEEDED - total_memory))
|
||||||
|
fi
|
||||||
|
|
||||||
|
ynh_script_progression --message="Adding $swap_needed Mo to swap..."
|
||||||
|
ynh_add_swap --size=$swap_needed
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE A POSTGRESQL DATABASE
|
# CREATE A POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting a PostgreSQL database..."
|
ynh_script_progression --message="Setting the PostgreSQL database..."
|
||||||
|
|
||||||
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS hstore;" --database="$db_name"
|
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS hstore;" --database="$db_name"
|
||||||
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database="$db_name"
|
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database="$db_name"
|
||||||
|
@ -33,116 +47,72 @@ ynh_script_progression --message="Setting up source files..." --weight=1
|
||||||
ynh_setup_source --dest_dir="$install_dir"
|
ynh_setup_source --dest_dir="$install_dir"
|
||||||
|
|
||||||
mkdir -p "$install_dir/tmp/pids"
|
mkdir -p "$install_dir/tmp/pids"
|
||||||
chmod 750 "$install_dir"
|
|
||||||
chmod -R o-rwx "$install_dir"
|
chmod -R o-rwx "$install_dir"
|
||||||
chown -R $app:www-data "$install_dir"
|
chown -R "$app:www-data" "$install_dir"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
|
||||||
|
|
||||||
ynh_add_nginx_config
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC SETUP
|
|
||||||
#=================================================
|
|
||||||
# ADD SWAP IF NEEDED
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Adding swap if needed..."
|
|
||||||
|
|
||||||
total_memory=$(ynh_get_ram --total)
|
|
||||||
swap_needed=0
|
|
||||||
|
|
||||||
if (( MEMORY_NEEDED > total_memory )); then
|
|
||||||
# Need a minimum of 2.5Go of memory
|
|
||||||
swap_needed=$((MEMORY_NEEDED - total_memory))
|
|
||||||
fi
|
|
||||||
|
|
||||||
ynh_script_progression --message="Adding $swap_needed Mo to swap..."
|
|
||||||
ynh_add_swap --size=$swap_needed
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# INSTALLING RUBY AND BUNDLER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Installing Ruby..."
|
|
||||||
|
|
||||||
pushd "$install_dir"
|
|
||||||
ynh_use_ruby
|
|
||||||
ynh_gem install bundler:1.17.3 --no-document
|
|
||||||
ynh_exec_as "$app" echo "gem: --no-ri --no-rdoc" >> "$install_dir/.gemrc"
|
|
||||||
ynh_exec_as "$app" chmod +x script/server
|
|
||||||
popd
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||||
|
|
||||||
database_yml="$install_dir/config/database.yml"
|
ynh_add_config --template="database.yml.example" --destination="$install_dir/config/database.yml"
|
||||||
diaspora_toml="$install_dir/config/diaspora.toml"
|
ynh_add_config --template="diaspora.toml.example" --destination="$install_dir/config/diaspora.toml"
|
||||||
|
|
||||||
ynh_add_config --template="../conf/database.yml.example" --destination="$database_yml"
|
chmod 400 "$install_dir/config/database.yml"
|
||||||
ynh_add_config --template="../conf/diaspora.toml.example" --destination="$diaspora_toml"
|
chmod 400 "$install_dir/config/diaspora.toml"
|
||||||
|
chown "$app:$app" "$install_dir/config/database.yml"
|
||||||
chmod 400 "$database_yml"
|
chown "$app:$app" "$install_dir/config/diaspora.toml"
|
||||||
chown $app:$app "$database_yml"
|
|
||||||
|
|
||||||
chmod 400 "$diaspora_toml"
|
|
||||||
chown $app:$app "$diaspora_toml"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# INSTALLING RUBY AND BUNDLER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
ynh_script_progression --message="Building $app..."
|
||||||
|
|
||||||
ynh_add_systemd_config --service="$app-web" --template="$app-web.service"
|
|
||||||
ynh_add_systemd_config --service="$app-sidekiq" --template="$app-sidekiq.service"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# INSTALLING ACROPOLIS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Installing acropolis..."
|
|
||||||
|
|
||||||
pushd "$install_dir"
|
pushd "$install_dir"
|
||||||
ynh_exec_warn_less ynh_exec_as $app $ynh_ruby_load_path script/configure_bundler
|
ynh_use_ruby
|
||||||
ynh_exec_warn_less ynh_exec_as $app $ynh_ruby_load_path bin/bundle config set path 'vendor/bundle'
|
ynh_gem install bundler:1.17.3 --no-document
|
||||||
ynh_exec_warn_less ynh_exec_as $app $ynh_ruby_load_path bin/bundle install --full-index
|
ynh_exec_as "$app" echo "gem: --no-ri --no-rdoc" >> "$install_dir/.gemrc"
|
||||||
|
ynh_exec_as "$app" chmod +x script/server
|
||||||
|
popd
|
||||||
|
|
||||||
|
pushd "$install_dir"
|
||||||
|
ynh_exec_warn_less ynh_exec_as "$app" "$ynh_ruby_load_path" script/configure_bundler
|
||||||
|
ynh_exec_warn_less ynh_exec_as "$app" "$ynh_ruby_load_path" bin/bundle config set path 'vendor/bundle'
|
||||||
|
ynh_exec_warn_less ynh_exec_as "$app" "$ynh_ruby_load_path" bin/bundle install --full-index
|
||||||
popd
|
popd
|
||||||
|
|
||||||
ynh_script_progression --message="Preparing the database and create initial admin user..."
|
ynh_script_progression --message="Preparing the database and create initial admin user..."
|
||||||
|
|
||||||
pushd "$install_dir"
|
pushd "$install_dir"
|
||||||
ynh_exec_warn_less ynh_exec_as $app $ynh_ruby_load_path RAILS_ENV=production bin/rake db:migrate
|
ynh_exec_warn_less ynh_exec_as "$app" "$ynh_ruby_load_path" RAILS_ENV=production bin/rake db:migrate
|
||||||
ynh_exec_warn_less ynh_exec_as $app $ynh_ruby_load_path RAILS_ENV=production bin/rake assets:precompile
|
ynh_exec_warn_less ynh_exec_as "$app" "$ynh_ruby_load_path" RAILS_ENV=production bin/rake assets:precompile
|
||||||
ynh_exec_warn_less ynh_exec_as $app $ynh_ruby_load_path RAILS_ENV=production bin/rake "admin:create[$admin, $email, $password]"
|
ynh_exec_warn_less ynh_exec_as "$app" "$ynh_ruby_load_path" RAILS_ENV=production bin/rake "admin:create[$admin, $email, $password]"
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# SYSTEM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
ynh_add_nginx_config
|
||||||
|
|
||||||
|
ynh_add_systemd_config --service="$app-web" --template="$app-web.service"
|
||||||
|
yunohost service add "$app-web" --description="$app web service"
|
||||||
|
|
||||||
|
ynh_add_systemd_config --service="$app-sidekiq" --template="$app-sidekiq.service"
|
||||||
|
yunohost service add "$app-sidekiq" --description="$app sidekiq service"
|
||||||
|
|
||||||
# Use logrotate to manage application logfile(s)
|
# Use logrotate to manage application logfile(s)
|
||||||
ynh_use_logrotate
|
ynh_use_logrotate
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
|
||||||
|
|
||||||
yunohost service add "$app-web" --description="$app web service"
|
|
||||||
yunohost service add "$app-sidekiq" --description="$app sidekiq service"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=${app}-web --action="start" --log_path=systemd --line_match="listening on"
|
ynh_systemd_action --service_name="${app}-web" --action="start" --log_path=systemd --line_match="listening on"
|
||||||
ynh_systemd_action --service_name=${app}-sidekiq --action="start" --log_path=systemd --line_match="Booted Rails"
|
ynh_systemd_action --service_name="${app}-sidekiq" --action="start" --log_path=systemd --line_match="Booted Rails"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -11,64 +9,37 @@ source ynh_add_swap
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# REMOVE SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
|
||||||
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
|
||||||
if ynh_exec_warn_less yunohost service status "$app-web" >/dev/null
|
|
||||||
then
|
|
||||||
ynh_script_progression --message="Removing $app-web service integration..." --weight=1
|
|
||||||
yunohost service remove "$app-web"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ynh_exec_warn_less yunohost service status "$app-sidekiq" >/dev/null
|
|
||||||
then
|
|
||||||
ynh_script_progression --message="Removing $app-sidekiq service integration..." --weight=1
|
|
||||||
yunohost service remove "$app-sidekiq"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STOP AND REMOVE SERVICE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
|
|
||||||
|
|
||||||
ynh_remove_systemd_config --service="$app-web"
|
|
||||||
ynh_remove_systemd_config --service="$app-sidekiq"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE NGINX CONFIGURATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
||||||
|
|
||||||
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
||||||
|
if ynh_exec_warn_less yunohost service status "$app-web" >/dev/null; then
|
||||||
|
yunohost service remove "$app-web"
|
||||||
|
fi
|
||||||
|
ynh_remove_systemd_config --service="$app-web"
|
||||||
|
|
||||||
|
if ynh_exec_warn_less yunohost service status "$app-sidekiq" >/dev/null; then
|
||||||
|
yunohost service remove "$app-sidekiq"
|
||||||
|
fi
|
||||||
|
ynh_remove_systemd_config --service="$app-sidekiq"
|
||||||
|
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=1
|
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
|
||||||
ynh_remove_ruby
|
|
||||||
#REMOVEME? ynh_remove_app_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC REMOVE
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE VARIOUS FILES
|
# REMOVE VARIOUS FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing various files..." --weight=1
|
|
||||||
|
|
||||||
# Remove a directory securely
|
|
||||||
ynh_secure_remove --file="/etc/$app"
|
ynh_secure_remove --file="/etc/$app"
|
||||||
|
|
||||||
# Remove the log files
|
|
||||||
ynh_secure_remove --file="/var/log/$app"
|
ynh_secure_remove --file="/var/log/$app"
|
||||||
|
|
||||||
# Remove swap
|
ynh_script_progression --message="Removing Swap..." --weight=1
|
||||||
ynh_del_swap
|
ynh_del_swap
|
||||||
|
|
||||||
|
ynh_script_progression --message="Uninstalling Ruby..." --weight=1
|
||||||
|
ynh_remove_ruby
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue