1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/diaspora_ynh.git synced 2024-09-03 18:26:13 +02:00

Make the app install and remove

This commit is contained in:
Augustin Trancart 2019-12-02 21:04:01 +01:00
parent 00e92cebf6
commit 8be94ade02
7 changed files with 67 additions and 41 deletions

View file

@ -1,7 +1,7 @@
[Unit]
Description=Diaspora social network
Wants=redis.service mysqld.service
After=redis.service mysqld.service
Description=Diaspora social network (instance {{ app}})
Wants=redis.service postgresql.service
After=redis.service postgresql.service
StopWhenUnneeded=true
[Install]

1
conf/diaspora.tmpfiles.d Normal file
View file

@ -0,0 +1 @@
d /run/{{ app }} 0755 {{ app }} {{ app }} - -

View file

@ -36,7 +36,7 @@ configuration: ## Section
## However changing http to https is okay and has no consequences.
## If you do change the URL, you will have to start again as the URL
## will be hardcoded into the database.
url: "FULLURLTOCHANGE"
url: "https://{{ domain }}{{ path_url }}"
## Set the bundle of certificate authorities (CA) certificates.
## This is specific to your operating system.
@ -175,15 +175,16 @@ configuration: ## Section
## Where the appserver should listen to (default=unix:tmp/diaspora.sock)
#listen: 'unix:tmp/diaspora.sock'
#listen: 'unix:/run/diaspora/diaspora.sock'
listen: '127.0.0.1:3986'
#listen: '127.0.0.1:3000'
listen: unix:/run/{{ app }}/diaspora.sock
## Set the path for the PID file of the unicorn master process (default=tmp/pids/web.pid)
#pid: 'tmp/pids/web.pid'
pid: '/run/{{ app }}/diaspora.pid'
## Rails environment (default='development').
## The environment in which the server should be started by default.
## Change this to 'production' if you wish to run a production environment.
#rails_environment: 'development'
rails_environment: 'production'
## Write unicorn stderr and stdout log.
#stderr_log: '/usr/local/app/diaspora/log/unicorn-stderr.log'

View file

@ -1,17 +0,0 @@
[Unit]
Description=Diaspora social network (application server)
PartOf=diaspora.target
StopWhenUnneeded=true
[Service]
User=diaspora
WorkingDirectory=/var/www/diaspora
Environment=RAILS_ENV=production
ExecStart=/var/www/diaspora/.rvm/scripts/extras/chruby.sh 2.2 -- bin/bundle exec puma -b unix:///var/run/diaspora/diaspora.sock -e $RAILS_ENV
Restart=always
CPUAccounting=true
MemoryAccounting=true
BlockIOAccounting=true
[Install]
WantedBy=diaspora.target

View file

@ -0,0 +1,14 @@
[Unit]
Description=Diaspora social network (sidekiq - instance {{ app }})
PartOf={{ app }}.target
StopWhenUnneeded=true
[Service]
User={{ app }}
Environment=RAILS_ENV=production
WorkingDirectory={{ final_path }}/diaspora
ExecStart=/bin/bash -lc "bin/bundle exec sidekiq"
Restart=always
[Install]
WantedBy={{ app }}.target

16
conf/diaspora_web.service Normal file
View file

@ -0,0 +1,16 @@
[Unit]
Description=Diaspora social network (unicorn - instance {{ app }})
PartOf={{ app }}.target
StopWhenUnneeded=true
[Service]
User={{ app }}
Environment=RAILS_ENV=production
WorkingDirectory={{ final_path }}/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

View file

@ -1,22 +1,33 @@
# Proxy if requested file not found
try_files $uri @diaspora;
root ROOTOCHANGE/public;
location __PATH__ {
root __FINALPATH__/diaspora/public;
location @diaspora {
# Configure maximum picture size
# Note that Diaspora has a client side check set at 4M
client_max_body_size 5M;
client_body_buffer_size 256K;
# Proxy if requested file not found
try_files $uri @diaspora;
location __PATH__/assets/ {
expires max;
add_header Cache-Control public;
}
# Include SSOWAT user panel.
# TODO check that
include conf.d/yunohost_panel.conf.inc;
}
location @diaspora {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://diaspora_server;
proxy_pass http://unix:/run/__NAME__/diaspora.sock;
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
}