+2
-2
README.md
+2
-2
README.md
···
59
59
60
60
### Running in production
61
61
62
-
First, you need to make sure that the firehose script is always running and is restarted if necessary. One option to do this could be writing a `systemd` service config file and adding it to `/etc/systemd/system`.
62
+
First, you need to make sure that the firehose script is always running and is restarted if necessary. One option to do this could be writing a `systemd` service config file and adding it to `/etc/systemd/system`. You can find an example service file in [`dist/bsky_feeds.service`](https://github.com/mackuba/bluesky-feeds-rb/blob/master/dist/bsky_feeds.service).
63
63
64
-
To run the server part, you need an HTTP server and a Ruby app server. The choice is up to you and the configuration will depend on your selected config. My recommendation is Nginx with either Passenger (runs your app automatically from Nginx) or something like Puma (needs to be started by e.g. `systemd` like the firehose).
64
+
To run the server part, you need an HTTP server and a Ruby app server. The choice is up to you and the configuration will depend on your selected config. My recommendation is Nginx with either Passenger (runs your app automatically from Nginx) or something like Puma (needs to be started by e.g. `systemd` like the firehose). You can find an example of Nginx configuration for Passenger in [`dist/feeds-nginx.conf`](https://github.com/mackuba/bluesky-feeds-rb/blob/master/dist/feeds-nginx.conf).
65
65
66
66
67
67
## Publishing the feed
+17
dist/bsky_feeds.service
+17
dist/bsky_feeds.service
···
1
+
[Unit]
2
+
Description=Bluesky feed server
3
+
After=network.target
4
+
5
+
[Service]
6
+
Type=simple
7
+
User=alf
8
+
WorkingDirectory=/var/www/bsky_feeds/current
9
+
ExecStart=/usr/bin/ruby firehose.rb
10
+
Environment="RACK_ENV=production"
11
+
TimeoutSec=15
12
+
Restart=on-failure
13
+
RestartSec=1
14
+
StandardOutput=append:/var/www/bsky_feeds/shared/log/firehose.log
15
+
16
+
[Install]
17
+
WantedBy=multi-user.target
+13
dist/feeds-nginx.conf
+13
dist/feeds-nginx.conf
···
1
+
server {
2
+
server_name feeds.example.com;
3
+
listen 443 ssl;
4
+
5
+
passenger_enabled on;
6
+
root /var/www/bsky_feeds/current/public;
7
+
8
+
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
9
+
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
10
+
11
+
access_log /var/log/nginx/feeds-access.log combined buffer=16k flush=10s;
12
+
error_log /var/log/nginx/feeds-error.log;
13
+
}