diff options
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/.fonctions | 11 | ||||
| -rw-r--r-- | scripts/install | 38 | ||||
| -rw-r--r-- | scripts/remove | 2 |
3 files changed, 41 insertions, 10 deletions
diff --git a/scripts/.fonctions b/scripts/.fonctions index 59e4f46..8abb720 100644 --- a/scripts/.fonctions +++ b/scripts/.fonctions @@ -176,6 +176,15 @@ ynh_psql_create_user() { "CREATE USER ${1} WITH PASSWORD '${2}';" } +# Create a user without password +# +# usage: ynh_mysql_create_user user pwd [host] +# | arg: user - the user name to create +ynh_psql_create_user_without_password() { + sudo su -c "psql" postgres <<< \ + "CREATE USER ${1};" +} + # Create a database and grant optionnaly privilegies to a user # # usage: ynh_mysql_create_db db [user [pwd]] @@ -217,4 +226,4 @@ ynh_psql_drop_db() { # | arg: user - the user name to drop ynh_psql_drop_user() { sudo su -c "dropuser ${1}" postgres -}
\ No newline at end of file +} diff --git a/scripts/install b/scripts/install index 012d558..dba714e 100644 --- a/scripts/install +++ b/scripts/install @@ -63,15 +63,30 @@ 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 +<<<<<<< HEAD +# Set UTF8 encoding by default +sudo su -c "psql" postgres <<< \ + "update pg_database set datistemplate='false' where datname='template1';"\ + "drop database template1;"\ + "create database template1 encoding='UTF8' template template0;"\ + "update pg_database set datistemplate='true' where datname='template1';" + +# Create DB user mastodon +======= # Create DB without password sudo systemctl restart postgresql +>>>>>>> refs/remotes/magikcypress/master ynh_psql_create_db_without_password "$app" # Download all Ruby source sudo git clone https://github.com/rbenv/rbenv.git $final_path/.rbenv sudo git clone https://github.com/rbenv/ruby-build.git $final_path/.rbenv/plugins/ruby-build +<<<<<<< HEAD +sudo git clone https://github.com/tootsuite/mastodon.git $final_path/live + +======= # Be king rewind (/var/cache/yunohost/from_file/scripts) popd @@ -79,6 +94,7 @@ popd # Get Mastodon last version sudo mkdir "${final_path}/live" SETUP_SOURCE +>>>>>>> refs/remotes/magikcypress/master sudo chown -R $app: "${final_path}" # Install de rbenv @@ -92,17 +108,17 @@ COMMANDS # Install ruby-build sudo su - $app <<RCOMMANDS -/opt/mastodon/.rbenv/bin/rbenv install 2.3.1 -/opt/mastodon/.rbenv/versions/2.3.1/bin/ruby -v +/opt/mastodon/.rbenv/bin/rbenv install 2.4.1 +/opt/mastodon/.rbenv/versions/2.4.1/bin/ruby -v RCOMMANDS # Create symlink for ruby -sudo ln -s /opt/mastodon/.rbenv/versions/2.3.1/bin/ruby /usr/bin/ruby || true +sudo ln -s /opt/mastodon/.rbenv/versions/2.4.1/bin/ruby /usr/bin/ruby || true # Install Mastodon sudo su - $app <<MCOMMANDS pushd ~/live -/opt/mastodon/.rbenv/versions/2.3.1/bin/gem install bundler +/opt/mastodon/.rbenv/versions/2.4.1/bin/gem install bundler bin/bundle install --deployment --without development test yarn install MCOMMANDS @@ -148,7 +164,7 @@ pushd ~/live ACOMMANDS # 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 @@ -156,7 +172,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 @@ -193,4 +209,10 @@ fi sudo yunohost app ssowatconf # Reload Nginx -sudo systemctl reload nginx
\ No newline at end of file +<<<<<<< HEAD +sudo systemctl reload nginx || true +# debug +sudo systemctl status nginx +======= +sudo systemctl reload nginx +>>>>>>> refs/remotes/magikcypress/master diff --git a/scripts/remove b/scripts/remove index 2b55b23..f4390af 100644 --- a/scripts/remove +++ b/scripts/remove @@ -89,4 +89,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 |
