From 9599028041ac35cb0a7834fd1cb4cb47f4425544 Mon Sep 17 00:00:00 2001 From: magikcypress Date: Thu, 13 Apr 2017 01:38:09 +0200 Subject: [PATCH 1/5] [fix] rbenv init + start service --- scripts/install | 49 ++++++++++++++----------------------------------- scripts/remove | 8 +++----- 2 files changed, 17 insertions(+), 40 deletions(-) diff --git a/scripts/install b/scripts/install index 6a1fe20..3258465 100644 --- a/scripts/install +++ b/scripts/install @@ -101,13 +101,12 @@ popd # sudo chown -R $app: "${final_path}" # Install de rbenv -# Tips: rbenv init - bash (see: https://github.com/rbenv/rbenv/issues/925) sudo su - $app <> ~/.profile echo 'export PATH="/opt/mastodon/.rbenv/bin:/opt/mastodon/live/bin:$PATH"' >> ~/.bashrc -echo 'eval "\$(rbenv init - bash)"' >> ~/.bashrc +echo 'eval "\$(rbenv init -)"' >> ~/.profile COMMANDS # Install ruby-build @@ -127,19 +126,6 @@ bin/bundle install --deployment --without development test yarn install --production MCOMMANDS -# Vérif Mastodon -sudo su - $app < Date: Thu, 13 Apr 2017 02:09:01 +0200 Subject: [PATCH 2/5] Update README do not install in production --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index efc3f14..ac871f6 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Status](https://img.shields.io/badge/status-in_progress-yellow.svg?style=flat)](https://github.com/Snipees/couchpotato_ynh/milestones) [![Yunohost version](https://img.shields.io/badge/yunohost-2.4.2_tested-orange.svg?style=flat)](https://github.com/YunoHost/yunohost) -:warning: working process for the moment, do not working :warning: +:warning: working process for the moment, do not working correctly & do not install in production :warning: ## Mastodon c'est quoi ? From 4f11bfe432c675fe33a22cb6a6b8e08eb3c13234 Mon Sep 17 00:00:00 2001 From: magikcypress Date: Thu, 13 Apr 2017 17:19:53 +0200 Subject: [PATCH 3/5] [fix] add smtp login & pass --- manifest.json | 9 +++++++++ scripts/install | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 23184f6..22ce245 100644 --- a/manifest.json +++ b/manifest.json @@ -50,6 +50,15 @@ }, "example": "john" }, + { + "name": "passwd", + "type": "password", + "ask": { + "en": "Add password for the Admin YunoHost", + "fr": "Ajouter le mot de passe l'Administrateur YunoHost" + }, + "example": "adminpassword" + }, { "name": "is_public", "ask": { diff --git a/scripts/install b/scripts/install index 3258465..9c100c2 100644 --- a/scripts/install +++ b/scripts/install @@ -16,6 +16,7 @@ TRAP_ON # Active trap to stop the script if an error is detected. domain=$YNH_APP_ARG_DOMAIN path=$YNH_APP_ARG_PATH admin_mastodon=$YNH_APP_ARG_ADMIN +admin_pass=$YNH_APP_ARG_PASSWD is_public=$YNH_APP_ARG_IS_PUBLIC app=$YNH_APP_INSTANCE_NAME @@ -33,8 +34,8 @@ CHECK_FINALPATH ynh_app_setting_set $app domain $domain ynh_app_setting_set $app path $path ynh_app_setting_set $app admin $admin_mastodon +ynh_app_setting_set $app pass $admin_pass ynh_app_setting_set $app is_public $is_public -# ynh_app_setting_set $app language $language # Create user unix sudo adduser $app --home /opt/$app --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password --disabled-login @@ -140,6 +141,8 @@ sudo sed -i "s@PAPERCLIP_SECRET=@PAPERCLIP_SECRET=$(head -n32 /dev/urandom | tr sudo sed -i "s@SECRET_KEY_BASE=@SECRET_KEY_BASE=$(head -n32 /dev/urandom | tr -dc -d 'A-Za-z0-9' | head -c32)@g" "${final_path}/live/.env.production" sudo sed -i "s@OTP_SECRET=@OTP_SECRET=$(head -n32 /dev/urandom | tr -dc -d 'A-Za-z0-9' | head -c32)@g" "${final_path}/live/.env.production" +sudo sed -i 's,SMTP_LOGIN=,SMTP_LOGIN='${admin_mastodon}'@'${domain}',' "${final_path}/live/.env.production" +sudo sed -i 's,SMTP_PASSWORD=,SMTP_PASSWORD=${admin_pass},' "${final_path}/live/.env.production" sudo sed -i "s@SMTP_SERVER=smtp.mailgun.org@SMTP_SERVER=localhost@g" "${final_path}/live/.env.production" sudo sed -i 's,SMTP_FROM_ADDRESS=notifications@example.com,SMTP_FROM_ADDRESS='${admin_mastodon}'@'${domain}',' "${final_path}/live/.env.production" sudo sed -i "s@#SMTP_OPENSSL_VERIFY_MODE=peer@SMTP_OPENSSL_VERIFY_MODE=none@g" "${final_path}/live/.env.production" From 5665b8030ff665227c070ecdeff8ef9540d60322 Mon Sep 17 00:00:00 2001 From: magikcypress Date: Thu, 13 Apr 2017 17:22:49 +0200 Subject: [PATCH 4/5] [fix] clean sed --- scripts/install | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 9c100c2..74106f4 100644 --- a/scripts/install +++ b/scripts/install @@ -134,7 +134,6 @@ sudo sed -i "s@REDIS_HOST=redis@REDIS_HOST=127.0.0.1@g" "${final_path}/live/.env sudo sed -i "s@DB_HOST=db@DB_HOST=/var/run/postgresql@g" "${final_path}/live/.env.production" sudo sed -i "s@DB_USER=postgres@DB_USER=${app}@g" "${final_path}/live/.env.production" sudo sed -i "s@DB_NAME=postgres@DB_NAME=${app}_production@g" "${final_path}/live/.env.production" -# sudo sed -i "s@DB_PASS=@DB_PASS=${dbpass}@g" "${final_path}/live/.env.production" sudo sed -i "s@LOCAL_DOMAIN=example.com@LOCAL_DOMAIN=${domain}@g" "${final_path}/live/.env.production" sudo sed -i "s@PAPERCLIP_SECRET=@PAPERCLIP_SECRET=$(head -n32 /dev/urandom | tr -dc -d 'A-Za-z0-9' | head -c32)@g" "${final_path}/live/.env.production" @@ -142,7 +141,7 @@ sudo sed -i "s@SECRET_KEY_BASE=@SECRET_KEY_BASE=$(head -n32 /dev/urandom | tr -d sudo sed -i "s@OTP_SECRET=@OTP_SECRET=$(head -n32 /dev/urandom | tr -dc -d 'A-Za-z0-9' | head -c32)@g" "${final_path}/live/.env.production" sudo sed -i 's,SMTP_LOGIN=,SMTP_LOGIN='${admin_mastodon}'@'${domain}',' "${final_path}/live/.env.production" -sudo sed -i 's,SMTP_PASSWORD=,SMTP_PASSWORD=${admin_pass},' "${final_path}/live/.env.production" +sudo sed -i 's@SMTP_PASSWORD=@SMTP_PASSWORD=${admin_pass}@g' "${final_path}/live/.env.production" sudo sed -i "s@SMTP_SERVER=smtp.mailgun.org@SMTP_SERVER=localhost@g" "${final_path}/live/.env.production" sudo sed -i 's,SMTP_FROM_ADDRESS=notifications@example.com,SMTP_FROM_ADDRESS='${admin_mastodon}'@'${domain}',' "${final_path}/live/.env.production" sudo sed -i "s@#SMTP_OPENSSL_VERIFY_MODE=peer@SMTP_OPENSSL_VERIFY_MODE=none@g" "${final_path}/live/.env.production" From 3846d5a626446023e045084639c68032c83a2038 Mon Sep 17 00:00:00 2001 From: magikcypress Date: Thu, 13 Apr 2017 18:04:29 +0200 Subject: [PATCH 5/5] [fix] bug sed variable admin_pass --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 74106f4..9696925 100644 --- a/scripts/install +++ b/scripts/install @@ -141,7 +141,7 @@ sudo sed -i "s@SECRET_KEY_BASE=@SECRET_KEY_BASE=$(head -n32 /dev/urandom | tr -d sudo sed -i "s@OTP_SECRET=@OTP_SECRET=$(head -n32 /dev/urandom | tr -dc -d 'A-Za-z0-9' | head -c32)@g" "${final_path}/live/.env.production" sudo sed -i 's,SMTP_LOGIN=,SMTP_LOGIN='${admin_mastodon}'@'${domain}',' "${final_path}/live/.env.production" -sudo sed -i 's@SMTP_PASSWORD=@SMTP_PASSWORD=${admin_pass}@g' "${final_path}/live/.env.production" +sudo sed -i "s@SMTP_PASSWORD=@SMTP_PASSWORD=${admin_pass}@g" "${final_path}/live/.env.production" sudo sed -i "s@SMTP_SERVER=smtp.mailgun.org@SMTP_SERVER=localhost@g" "${final_path}/live/.env.production" sudo sed -i 's,SMTP_FROM_ADDRESS=notifications@example.com,SMTP_FROM_ADDRESS='${admin_mastodon}'@'${domain}',' "${final_path}/live/.env.production" sudo sed -i "s@#SMTP_OPENSSL_VERIFY_MODE=peer@SMTP_OPENSSL_VERIFY_MODE=none@g" "${final_path}/live/.env.production"