Add the files we use for production deployments

We are using apache as reverse proxy and two systemd units
(puma & delayed job) for events.opensuse.org. Track them
also in this project, might be useful for others.
This commit is contained in:
Henne Vogelsang 2019-02-15 22:16:10 +01:00
parent 9cc5c83477
commit 228190396c
4 changed files with 76 additions and 0 deletions

View file

@ -38,6 +38,7 @@ task :deploy do
in_path(fetch(:current_path)) do
command %{mkdir -p tmp/}
command %{touch tmp/restart.txt}
command %{sudo systemctl restart osem-dj}
end
end
end

45
dist/apache-vhost.conf vendored Normal file
View file

@ -0,0 +1,45 @@
<VirtualHost *:80>
ServerAdmin admin@opensuse.org
ServerName events.opensuse.org
ServerAlias conference.opensuse.org
ServerAlias summit.opensuse.org
DocumentRoot /home/osem/events/current/public
CustomLog /home/osem/events/current/log/access.log combined
ErrorLog /home/osem/events/current/log/error.log
RewriteEngine on
RewriteRule "^/conference/(.+)" "https://events.opensuse.org/conferences/$1" [R,L]
# Serve assets and uploads directly
<location /assets>
ProxyPass !
</location>
<location /system>
ProxyPass !
</location>
# Pass the rest on to puma
ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000/
# don't loose time with IP address lookups
HostnameLookups Off
UseCanonicalName Off
# enable the footer on server-generated documents
ServerSignature On
<Directory "/home/osem/events">
Options FollowSymLinks
</Directory>
<Directory "/home/osem/events/current/public">
Options FollowSymLinks
AllowOverride All
Options -MultiViews
Require all granted
</Directory>
</VirtualHost>

17
dist/osem-dj.service vendored Normal file
View file

@ -0,0 +1,17 @@
[Unit]
Description=Open Source Event Manager Delayed Jobs
Wants=osem.service
Before=osem.service
[Service]
User=osem
EnvironmentFile=/home/osem/events/current/.env.production
WorkingDirectory=/home/osem/events/current
ExecStart = /usr/bin/bundle exec bin/delayed_job -e production start
ExecStop = /usr/bin/bundle exec bin/delayed_job -e production stop
Type = forking
PIDFile = /home/osem/events/current/tmp/pids/delayed_job.pid
[Install]
WantedBy=multi-user.target

13
dist/osem.service vendored Normal file
View file

@ -0,0 +1,13 @@
[Unit]
Description=Open Source Event Manager
Wants=apache2.service
Before=apache2.service
[Service]
User=osem
EnvironmentFile=/home/osem/events/current/.env.production
WorkingDirectory=/home/osem/events/current
ExecStart=/usr/bin/bundle exec puma -e production
[Install]
WantedBy=multi-user.target