From 8e7c9179105bd6e6892dd46ed4a5227bcfe83b72 Mon Sep 17 00:00:00 2001 From: Jiahao Dai Date: Sun, 5 Nov 2017 09:27:09 +0800 Subject: [PATCH 1/2] Manage Stringer With Systemd --- docs/VPS.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/VPS.md b/docs/VPS.md index 39f788495..745008b03 100644 --- a/docs/VPS.md +++ b/docs/VPS.md @@ -113,6 +113,30 @@ add the lines PATH=/home/stringer/.rbenv/bin:/bin/:/usr/bin:/usr/local/bin/:/usr/local/sbin */10 * * * * source $HOME/.bash_profile; cd $HOME/stringer/; bundle exec rake fetch_feeds; +Manage Stringer With Systemd +============================ + +You may want to manage Stringer as a systemd service on distributions come with systemd. + +As stringer user, export app service files with foreman: + + cd ~/stringer + mkdir systemd-services + foreman export systemd systemd-services -a stringer -u stringer + +Logout stringer user, install systemd services: + + sudo cp -a ~stringer/stringer/systemd-services/* /etc/systemd/system + +As stringer user, close existing Stringer instance: + + exit # exit racksh and app + +Start app as a systemd service and make app run at startup + + sudo systemctl start stringer.target + sudo systemctl enable stringer.target + Reverse Proxy With Nginx ======================== From ebea85a3286751dab0e2d2784ed05652306160e6 Mon Sep 17 00:00:00 2001 From: Jiahao Dai Date: Sun, 5 Nov 2017 12:17:01 +0800 Subject: [PATCH 2/2] Deploy Stringer With Passenger And Apache --- docs/VPS.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/docs/VPS.md b/docs/VPS.md index 745008b03..752f91550 100644 --- a/docs/VPS.md +++ b/docs/VPS.md @@ -159,3 +159,50 @@ server { } } ``` + +Deploy Stringer With Passenger And Apache +========================================= + +You may want to run Stringer with the existing Apache server. We need to install +*mod_passenger* and edit few files. + +The installation of *mod_passenger* depends on VPS's system distribution release. +Offical installation guide is available at [Passenger Library](https://www.phusionpassenger.com/library/install/apache/install/oss/) + +After validating the *mod_passenger* install, we will fetch dependencies again +to meet Passenger's default GEM_HOME set. As stringer user: + + cd ~/stringer + bundle install --path vendor/bundle + +Edit database.yml with correct database url: + + cd ~/stringer + sed -i "s|url: .*|url: $DATABASE_URL|" config/database.yml + +Add VirtualHost to your Apache installation, here's a sample configuration: + +```bash + + ServerName example.com + DocumentRoot /home/stringer/stringer/app/public + + PassengerEnabled On + PassengerAppRoot /home/stringer/stringer + PassengerRuby /home/stringer/.rbenv/shims/ruby + # PassengerLogFile /dev/null # don't flow logs to apache error.log + + + Options FollowSymLinks + Require all granted + AllowOverride All + + + + # you can harden your connection with https, don't forget + # change to + # SSLCertificateFile /etc/path/to/example.com/fullchain.pem + # SSLCertificateKeyFile /etc/path/to/example.com/privkey.pem + # Include /etc/path/to/options-ssl-apache.conf + +```