mirror of
https://github.com/YunoHost-Apps/pleroma_ynh.git
synced 2024-09-03 20:15:59 +02:00
Added config files
This commit is contained in:
parent
37145d132c
commit
09bd591c11
6 changed files with 115 additions and 17 deletions
|
@ -6,9 +6,8 @@
|
||||||
;; Test complet
|
;; Test complet
|
||||||
; Manifest
|
; Manifest
|
||||||
domain="domain.tld" (DOMAIN)
|
domain="domain.tld" (DOMAIN)
|
||||||
email="admin@example.com"
|
admin="john" (ADMIN)
|
||||||
is_public=1 (PUBLIC|public=1|private=0)
|
is_public=1 (PUBLIC|public=1|private=0)
|
||||||
port="4000" (PORT)
|
|
||||||
; Checks
|
; Checks
|
||||||
pkg_linter=1
|
pkg_linter=1
|
||||||
setup_sub_dir=0
|
setup_sub_dir=0
|
||||||
|
|
65
conf/prod.secret.exs
Normal file
65
conf/prod.secret.exs
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
use Mix.Config
|
||||||
|
|
||||||
|
config :pleroma, Pleroma.Web.Endpoint,
|
||||||
|
url: [host: "__DOMAIN__", scheme: "https", port: 443],
|
||||||
|
secret_key_base: "__KEY__",
|
||||||
|
http: [port: __PORT__],
|
||||||
|
protocol: "http"
|
||||||
|
|
||||||
|
config :pleroma, :instance,
|
||||||
|
name: "__INSTANCE_NAME__",
|
||||||
|
email: "__ADMIN_EMAIL__",
|
||||||
|
limit: 5000,
|
||||||
|
registrations_open: true,
|
||||||
|
dedupe_media: false
|
||||||
|
|
||||||
|
config :pleroma, :media_proxy,
|
||||||
|
enabled: false,
|
||||||
|
redirect_on_failure: true
|
||||||
|
#base_url: "https://cache.pleroma.social"
|
||||||
|
|
||||||
|
# Configure your database
|
||||||
|
config :pleroma, Pleroma.Repo,
|
||||||
|
adapter: Ecto.Adapters.Postgres,
|
||||||
|
username: "__DB_NAME__",
|
||||||
|
password: "__DB_PWD__",
|
||||||
|
database: "__DB_NAME__",
|
||||||
|
hostname: "localhost",
|
||||||
|
pool_size: 10
|
||||||
|
|
||||||
|
# Configure S3 support if desired.
|
||||||
|
# The public S3 endpoint is different depending on region and provider,
|
||||||
|
# consult your S3 provider's documentation for details on what to use.
|
||||||
|
#
|
||||||
|
# config :pleroma, Pleroma.Uploaders.S3,
|
||||||
|
# bucket: "some-bucket",
|
||||||
|
# public_endpoint: "https://s3.amazonaws.com"
|
||||||
|
#
|
||||||
|
# Configure S3 credentials:
|
||||||
|
# config :ex_aws, :s3,
|
||||||
|
# access_key_id: "xxxxxxxxxxxxx",
|
||||||
|
# secret_access_key: "yyyyyyyyyyyy",
|
||||||
|
# region: "us-east-1",
|
||||||
|
# scheme: "https://"
|
||||||
|
#
|
||||||
|
# For using third-party S3 clones like wasabi, also do:
|
||||||
|
# config :ex_aws, :s3,
|
||||||
|
# host: "s3.wasabisys.com"
|
||||||
|
|
||||||
|
|
||||||
|
# Configure Openstack Swift support if desired.
|
||||||
|
#
|
||||||
|
# Many openstack deployments are different, so config is left very open with
|
||||||
|
# no assumptions made on which provider you're using. This should allow very
|
||||||
|
# wide support without needing separate handlers for OVH, Rackspace, etc.
|
||||||
|
#
|
||||||
|
# config :pleroma, Pleroma.Uploaders.Swift,
|
||||||
|
# container: "some-container",
|
||||||
|
# username: "api-username-yyyy",
|
||||||
|
# password: "api-key-xxxx",
|
||||||
|
# tenant_id: "<openstack-project/tenant-id>",
|
||||||
|
# auth_url: "https://keystone-endpoint.provider.com",
|
||||||
|
# storage_url: "https://swift-endpoint.prodider.com/v1/AUTH_<tenant>/<container>",
|
||||||
|
# object_url: "https://cdn-endpoint.provider.com/<container>"
|
||||||
|
#
|
||||||
|
|
6
conf/setup_db.psql
Normal file
6
conf/setup_db.psql
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
CREATE USER __DB_NAME__ WITH ENCRYPTED PASSWORD '__DB_PWD__';
|
||||||
|
CREATE DATABASE __DB_NAME__ OWNER __DB_NAME__;
|
||||||
|
\c __DB_NAME__;
|
||||||
|
--Extensions made by ecto.migrate that need superuser access
|
||||||
|
CREATE EXTENSION IF NOT EXISTS citext;
|
||||||
|
CREATE EXTENSION IF NOT EXISTS pg_trgm;
|
|
@ -29,12 +29,13 @@
|
||||||
},
|
},
|
||||||
"example": "example.com"
|
"example": "example.com"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "email",
|
"name": "admin",
|
||||||
|
"type": "user",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Choose an admin email (can be changed after installation)"
|
"en": "Choose the Pleroma administrator (must be an existing YunoHost user)",
|
||||||
},
|
"fr": "Choisissez l'administrateur de Pleroma (doit être un utilisateur YunoHost existant)"
|
||||||
"example": "johndoe@example.com"
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "is_public",
|
"name": "is_public",
|
||||||
|
|
|
@ -23,9 +23,10 @@ ynh_abort_if_errors
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url="/"
|
path_url="/"
|
||||||
admin_email=$YNH_APP_ARG_EMAIL
|
admin=$YHN_APP_ADMIN
|
||||||
admin_pass=$(ynh_string_random 24)
|
admin_email=$(ynh_user_get_info $admin 'mail')
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
|
random_key=$(ynh_string_random 64)
|
||||||
|
|
||||||
|
|
||||||
# This is a multi-instance app, meaning it can be installed several times independently
|
# This is a multi-instance app, meaning it can be installed several times independently
|
||||||
|
@ -58,8 +59,9 @@ ynh_webpath_register "$app" "$domain" "$path_url"
|
||||||
|
|
||||||
ynh_app_setting_set "$app" domain "$domain"
|
ynh_app_setting_set "$app" domain "$domain"
|
||||||
ynh_app_setting_set "$app" admin_email "$admin_email"
|
ynh_app_setting_set "$app" admin_email "$admin_email"
|
||||||
ynh_app_setting_set "$app" admin_pass "$admin_pass"
|
|
||||||
ynh_app_setting_set "$app" is_public "$is_public"
|
ynh_app_setting_set "$app" is_public "$is_public"
|
||||||
|
ynh_app_setting_set "$app" random_key "random_key"
|
||||||
|
ynh_app_setting_set "$app" admin "$admin"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
|
@ -78,18 +80,22 @@ ynh_app_setting_set "$app" port "$port"
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Add erlang for Debian Jessie
|
||||||
|
if [ "$(lsb_release --codename --short)" == "jessie" ]; then
|
||||||
|
echo "deb http://binaries.erlang-solutions.com/debian jessie contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "deb http://binaries.erlang-solutions.com/debian stretch contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list
|
||||||
|
|
||||||
# install dependencies
|
# install dependencies
|
||||||
ynh_install_app_dependencies git build-essential postgresql postgresql-contrib openssl g++ apt-transport-https
|
ynh_install_app_dependencies git build-essential postgresql postgresql-contrib openssl g++ apt-transport-https erlang-inets elixir erlang-dev erlang-parsetools erlang-xmerl erlang-tools
|
||||||
wget -P /tmp/ https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb && sudo dpkg -i /tmp/erlang-solutions_1.0_all.deb
|
|
||||||
apt-get update && apt-get -y install elixir erlang-dev erlang-parsetools erlang-xmerl erlang-tools
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DATABASE SETUP
|
# DATABASE SETUP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Create postgresql database
|
# Create postgresql database
|
||||||
db_name="peertube_${app}"
|
db_name="${app}"
|
||||||
db_pwd=$(ynh_string_random 30)
|
db_pwd=$(ynh_string_random 30)
|
||||||
ynh_app_setting_set "$app" psql_db "$db_name"
|
ynh_app_setting_set "$app" psql_db "$db_name"
|
||||||
ynh_app_setting_set "$app" psqlpwd "$db_pwd"
|
ynh_app_setting_set "$app" psqlpwd "$db_pwd"
|
||||||
|
@ -99,6 +105,8 @@ ynh_psql_execute_as_root \
|
||||||
"CREATE DATABASE $db_name ENCODING 'UTF8' LC_COLLATE='C' LC_CTYPE='C' template=template0 OWNER $app;"
|
"CREATE DATABASE $db_name ENCODING 'UTF8' LC_COLLATE='C' LC_CTYPE='C' template=template0 OWNER $app;"
|
||||||
ynh_psql_execute_as_root "\connect $db_name
|
ynh_psql_execute_as_root "\connect $db_name
|
||||||
CREATE EXTENSION IF NOT EXISTS unaccent;CREATE EXTENSION IF NOT EXISTS pg_trgm;"
|
CREATE EXTENSION IF NOT EXISTS unaccent;CREATE EXTENSION IF NOT EXISTS pg_trgm;"
|
||||||
|
ynh_psql_execute_as_root "\connect $db_name
|
||||||
|
CREATE EXTENSION IF NOT EXISTS unaccent;CREATE EXTENSION IF NOT EXISTS citext;"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
|
@ -113,8 +121,7 @@ ynh_system_user_create "$app"
|
||||||
|
|
||||||
ynh_app_setting_set "$app" final_path "$final_path"
|
ynh_app_setting_set "$app" final_path "$final_path"
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source "$final_path"
|
git clone https://git.pleroma.social/pleroma/pleroma "$final_path"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -124,6 +131,26 @@ ynh_setup_source "$final_path"
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# MODIFY A CONFIG FILE
|
||||||
|
#=================================================
|
||||||
|
cp -f ../conf/prod.secret.exs "$final_path/config/prod.secret.exs"
|
||||||
|
cp -f ../conf/setup_db.psql "$final_path/config/setup_db.psql"
|
||||||
|
|
||||||
|
ynh_replace_string "__DOMAIN__" "$domain" "$final_path/config/prod.secret.exs"
|
||||||
|
ynh_replace_string "__KEY__" "$random_key" "$final_path/config/prod.secret.exs"
|
||||||
|
ynh_replace_string "__INSTANCE_NAME__" "$instance_name" "$final_path/config/prod.secret.exs"
|
||||||
|
ynh_replace_string "__DB_NAME__" "$app" "$final_path/config/prod.secret.exs"
|
||||||
|
ynh_replace_string "__DB_PWD__" "$db_pwd" "$final_path/config/prod.secret.exs"
|
||||||
|
ynh_replace_string "__ADMIN_EMAIL__" "$admin_email" "$final_path/config/prod.secret.exs"
|
||||||
|
ynh_replace_string "__PORT__" "$port" "$final_path/config/prod.secret.exs"
|
||||||
|
ynh_replace_string "__DB_NAME__" "$app" "$final_path/config/setup_db.psql"
|
||||||
|
ynh_replace_string "__DB_PWD__" "$db_pwd" "$final_path/config/setup_db.psql"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SETUP
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
|
|
|
@ -26,7 +26,7 @@ final_path=$(ynh_app_setting_get "$app" final_path)
|
||||||
#=================================================
|
#=================================================
|
||||||
# Remove metapackage and its dependencies
|
# Remove metapackage and its dependencies
|
||||||
ynh_remove_app_dependencies
|
ynh_remove_app_dependencies
|
||||||
apt-get update && apt-get -y remove elixir erlang-dev erlang-parsetools erlang-xmerl erlang-tools
|
rm -f /etc/apt/sources.list.d/erlang-solutions.list
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE THE MYSQL DATABASE
|
# REMOVE THE MYSQL DATABASE
|
||||||
|
|
Loading…
Add table
Reference in a new issue