From 279feedd74744ac2ba5c8d18921ba3be9b853bd2 Mon Sep 17 00:00:00 2001 From: nemsia Date: Mon, 10 Apr 2017 10:44:24 +0200 Subject: [PATCH 1/8] Sudo on nodejs install --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 8e086a7..95be1b2 100644 --- a/scripts/install +++ b/scripts/install @@ -62,7 +62,7 @@ ynh_app_setting_set $app final_path $final_path # Install de Node.js pushd /opt -curl -sL https://deb.nodesource.com/setup_4.x | bash - +curl -sL https://deb.nodesource.com/setup_4.x | sudo bash - sudo apt-get -y install nodejs npm install -g yarn @@ -182,4 +182,4 @@ sudo systemctl reload nginx || true sudo systemctl status nginx # Nettoyer hosts -sudo sed -i '/#MASTODON/d' /etc/hosts \ No newline at end of file +sudo sed -i '/#MASTODON/d' /etc/hosts From d81564718cac221ab1243dc6a28c3245b8bdafde Mon Sep 17 00:00:00 2001 From: nemsia Date: Mon, 10 Apr 2017 10:48:39 +0200 Subject: [PATCH 2/8] Sudo on yarn install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 95be1b2..d7e5f5f 100644 --- a/scripts/install +++ b/scripts/install @@ -64,7 +64,7 @@ ynh_app_setting_set $app final_path $final_path pushd /opt curl -sL https://deb.nodesource.com/setup_4.x | sudo bash - sudo apt-get -y install nodejs -npm install -g yarn +sudo npm install -g yarn ## Install postgresql database dbname=$app From 64e013a56708149e97f1731a36b3cdc2dd246427 Mon Sep 17 00:00:00 2001 From: nemsia Date: Mon, 10 Apr 2017 11:05:16 +0200 Subject: [PATCH 3/8] Add Postgresql Restart Add Postgresql Restart before database creation --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index d7e5f5f..805560a 100644 --- a/scripts/install +++ b/scripts/install @@ -67,6 +67,7 @@ sudo apt-get -y install nodejs sudo npm install -g yarn ## Install postgresql database +sudo systemctl restart postgresql dbname=$app dbuser=$app # Generate random password From bbdb5bf40cee75a0875e3d7339413d7854c5c08d Mon Sep 17 00:00:00 2001 From: nemsia Date: Mon, 10 Apr 2017 11:10:24 +0200 Subject: [PATCH 4/8] Sudo on git clone --- scripts/install | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 805560a..14aee5a 100644 --- a/scripts/install +++ b/scripts/install @@ -76,9 +76,9 @@ ynh_psql_create_db "$dbname" "$dbuser" "$dbpass" # Download all Ruby source sudo git clone https://github.com/rbenv/rbenv.git $final_path/.rbenv -git clone https://github.com/rbenv/ruby-build.git $final_path/.rbenv/plugins/ruby-build -git clone https://github.com/tootsuite/mastodon.git $final_path/live -git clone git://github.com/dcarley/rbenv-sudo.git $final_path/.rbenv/plugins/rbenv-sudo +sudo git clone https://github.com/rbenv/ruby-build.git $final_path/.rbenv/plugins/ruby-build +sudo git clone https://github.com/tootsuite/mastodon.git $final_path/live +sudo git clone git://github.com/dcarley/rbenv-sudo.git $final_path/.rbenv/plugins/rbenv-sudo sudo chown -R $app: "${final_path}" # Install de rbenv From 81df00a1a6a96e961ba85e8b2f1a15547b4d85f5 Mon Sep 17 00:00:00 2001 From: nemsia Date: Mon, 10 Apr 2017 12:06:45 +0200 Subject: [PATCH 5/8] Modify pushd --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 14aee5a..fb15986 100644 --- a/scripts/install +++ b/scripts/install @@ -132,7 +132,7 @@ RAILS_ENV=production bin/bundle exec rails assets:precompile ENDCOMMANDS # Add Services -pushd /var/cache/yunohost/from_file/scripts +pushd /var/cache/yunohost/from_file/mastodon_ynh-master/scripts sudo cp ../conf/mastodon-web.service /etc/systemd/system/mastodon-web.service sudo chown root: /etc/systemd/system/mastodon-web.service From 226cbaad593b07c4289c961a73ba11d52d3b7edc Mon Sep 17 00:00:00 2001 From: nemsia Date: Mon, 10 Apr 2017 15:40:28 +0200 Subject: [PATCH 6/8] Update remove --- scripts/remove | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/remove b/scripts/remove index b8f2d6b..f83b286 100644 --- a/scripts/remove +++ b/scripts/remove @@ -75,6 +75,9 @@ ynh_psql_drop_user $app SECURE_REMOVE '/opt/$app' [[ -n $domain ]] && sudo rm -f "/etc/nginx/conf.d/${domain}.d/${app}.conf" +# Suppression d'un lien symbolique +rm /usr/bin/ruby + REMOVE_NGINX_CONF # Suppression de la configuration nginx SECURE_REMOVE '/var/log/$app/' # Suppression des log @@ -85,4 +88,4 @@ sudo userdel -f $app # Reload services sudo service nginx reload -echo -e "\e[0m" # Restore normal color \ No newline at end of file +echo -e "\e[0m" # Restore normal color From b2cd5cc97ad463beac1f12f8ccc02a76c97dc257 Mon Sep 17 00:00:00 2001 From: nemsia Date: Mon, 10 Apr 2017 15:46:57 +0200 Subject: [PATCH 7/8] Adjust Mastodon config .env.production --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index fb15986..f3c9ed4 100644 --- a/scripts/install +++ b/scripts/install @@ -113,7 +113,7 @@ sudo cp -a .env.production.sample .env.production sudo sed -i "s@REDIS_HOST=localhost@REDIS_HOST=127.0.0.1@g" "${final_path}/live/.env.production" sudo sed -i "s@DB_HOST=db@DB_HOST=/var/run/postgresql@g" "${final_path}/live/.env.production" sudo sed -i "s@DB_USER=mastodon@DB_USER=${dbuser}@g" "${final_path}/live/.env.production" -sudo sed -i "s@DB_NAME=mastodon@DB_NAME=${dbuser}@g" "${final_path}/live/.env.production" +sudo sed -i "s@DB_NAME=mastodon@DB_NAME=${dbname}@g" "${final_path}/live/.env.production" sudo sed -i "s@LOCAL_DOMAIN=domainedevotreinstance.tld@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" From 1c8abcfbef197a27155e9ce6a78eae144d35e061 Mon Sep 17 00:00:00 2001 From: nemsia Date: Mon, 10 Apr 2017 21:09:27 +0200 Subject: [PATCH 8/8] add reload-daemon for mastodon services --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index ad88c10..b5236ec 100644 --- a/scripts/install +++ b/scripts/install @@ -140,7 +140,7 @@ sudo cp ../conf/mastodon-sidekiq.service /etc/systemd/system/mastodon-sidekiq.se sudo chown root: /etc/systemd/system/mastodon-sidekiq.service sudo cp ../conf/mastodon-streaming.service /etc/systemd/system/mastodon-streaming.service sudo chown root: /etc/systemd/system/mastodon-streaming.service - +sudo systemctl daemon-reload sudo systemctl enable /etc/systemd/system/mastodon-*.service # sudo systemctl start mastodon-web.service mastodon-sidekiq.service mastodon-streaming.service # # debug