forked from aymhce/diaspora_ynh
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from YunoHost-Apps/testing
- Loading branch information
Showing
12 changed files
with
275 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
d /run/{{ app }} 0755 {{ app }} {{ app }} - - | ||
d /run/__APP__ 0755 __APP__ __APP__ - - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
[Unit] | ||
Description=Diaspora social network (sidekiq - instance {{ app }}) | ||
PartOf={{ app }}.target | ||
Description=Diaspora social network (sidekiq - instance __APP__) | ||
PartOf=__APP__.target | ||
|
||
[Service] | ||
User={{ app }} | ||
User=__APP__ | ||
Environment=RAILS_ENV=production | ||
WorkingDirectory={{ final_path }}/diaspora | ||
WorkingDirectory=__FINALPATH__/diaspora | ||
ExecStart=/bin/bash -lc "bin/bundle exec sidekiq" | ||
Restart=always | ||
|
||
[Install] | ||
WantedBy={{ app }}.target | ||
WantedBy=__APP__.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
[Unit] | ||
Description=Diaspora social network (unicorn - instance {{ app }}) | ||
PartOf={{ app }}.target | ||
Description=Diaspora social network (unicorn - instance __APP__) | ||
PartOf=__APP__.target | ||
|
||
[Service] | ||
User={{ app }} | ||
User=__APP__ | ||
Environment=RAILS_ENV=production | ||
WorkingDirectory={{ final_path }}/diaspora | ||
PIDFile=/run/{{ app }}/diaspora.pid | ||
WorkingDirectory=__FINALPATH__/diaspora | ||
PIDFile=/run/__APP__/diaspora.pid | ||
ExecStart=/bin/bash -lc "bin/bundle exec unicorn -c config/unicorn.rb -E production" | ||
ExecReload=/bin/kill -USR2 $MAINPID | ||
Restart=always | ||
|
||
[Install] | ||
WantedBy={{ app }}.target | ||
WantedBy=__APP__.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
pushd $final_path/diaspora | ||
# here we *absolutely* need bash (not dash) because dash does not understand what rvm puts in .profile | ||
# (wtf rvm for assuming everybody uses bash as default shell??) | ||
# we also need a login shell to make sure .profile is loaded | ||
sudo -u $app /bin/bash --login << EOF | ||
rvm use --default 2.4 | ||
rvm 2.4 do gem install bundler:1.17.3 | ||
script/configure_bundler | ||
bin/bundle install --full-index --with=postgresql | ||
EOF | ||
sudo -u $app /bin/bash --login << EOF | ||
RAILS_ENV=production bundle exec rake db:migrate | ||
EOF | ||
|
||
#================================================= | ||
# ASSETS PRECOMPILATION | ||
#================================================= | ||
sudo -u $app /bin/bash --login << EOF | ||
RAILS_ENV=production bin/rake assets:precompile | ||
EOF | ||
popd | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
# sidekiq | ||
echo $app $final_path | ||
install -T --mode=0644 -v ../conf/diaspora_sidekiq.service /etc/systemd/system/${app}_sidekiq.service | ||
ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file=/etc/systemd/system/${app}_sidekiq.service | ||
ynh_replace_string --match_string=__FINALPATH__ --replace_string=$final_path --target_file=/etc/systemd/system/${app}_sidekiq.service | ||
# web | ||
install -T --mode=0644 -v ../conf/diaspora_web.service /etc/systemd/system/${app}_web.service | ||
ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file=/etc/systemd/system/${app}_web.service | ||
ynh_replace_string --match_string=__FINALPATH__ --replace_string=$final_path --target_file=/etc/systemd/system/${app}_web.service | ||
# tmp files | ||
install -T --mode=0644 -v ../conf/diaspora.tmpfiles.d /etc/tmpfiles.d/${app}.conf | ||
ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file=/etc/tmpfiles.d/${app}.conf | ||
# target unit | ||
install -T --mode=0644 -v ../conf/diaspora.target /etc/systemd/system/${app}.target | ||
ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file=/etc/systemd/system/${app}.target | ||
# reload, create, enable and start stuff | ||
systemctl daemon-reload | ||
systemd-tmpfiles --create | ||
systemctl enable ${app}.target ${app}_sidekiq.service ${app}_web.service | ||
systemctl restart ${app}.target | ||
|
||
# wait for startup | ||
timeout=100 | ||
for i in $(seq 1 $timeout) | ||
do | ||
# Read the log until the sentence is found, that means the app finished to start. Or run until the timeout | ||
if grep --extended-regexp --quiet "listening on addr" "$final_path/diaspora/log/unicorn-stderr.log" | ||
then | ||
ynh_print_info --message="Diaspora* is up and running\!" | ||
break | ||
fi | ||
if [ $i -eq 3 ]; then | ||
echo -n "Please wait, diaspora* is starting" >&2 | ||
fi | ||
if [ $i -ge 3 ]; then | ||
echo -n "." >&2 | ||
fi | ||
sleep 1 | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.