Skip to content

Commit

Permalink
Replace Heroku with Fly.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefansundin committed Nov 26, 2022
1 parent eca3286 commit aba3ff4
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 74 deletions.
9 changes: 0 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,12 @@
# docker buildx create --use --name multiarch --node multiarch0
# docker buildx build --pull --push --progress plain --platform linux/amd64,linux/arm64,linux/arm/v7 -t stefansundin/rssbox .
# Push to public ECR:
# export AWS_PROFILE=stefansundin
# docker buildx imagetools create -t public.ecr.aws/stefansundin/rssbox stefansundin/rssbox

FROM stefansundin/ruby:3.1
LABEL org.opencontainers.image.authors="Stefan Sundin"
LABEL org.opencontainers.image.url="https://github.com/stefansundin/rssbox"

# install gem dependencies
RUN \
apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends libxml2-dev libxslt1-dev libcurl4 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

WORKDIR /app
COPY Gemfile Gemfile.lock ./
RUN bundle config set --local without development:test
Expand Down
16 changes: 3 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,19 @@

This app uses the API of other websites and gives you an RSS feed in return. Quick and simple.

To open `vlc://` links, see [vlc-protocol](https://github.com/stefansundin/vlc-protocol).
List of public RSS Box instances: https://github.com/stefansundin/rssbox/discussions/64

You can use this app freely at [rssbox.herokuapp.com](https://rssbox.herokuapp.com/). An experimental Elastic Beanstalk version [is available](https://rssbox.us-west-2.elasticbeanstalk.com/).
To open `vlc://` links, see [vlc-protocol](https://github.com/stefansundin/vlc-protocol).

## Roll your own

[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy?template=https://github.com/stefansundin/rssbox)

To deploy to Elastic Beanstalk, see [.ebextensions/README.md](.ebextensions/README.md).

To deploy to Kubernetes, see [kubernetes/README.md](kubernetes/README.md).

A Docker image is available on [Docker Hub](https://hub.docker.com/r/stefansundin/rssbox) and [Amazon ECR](https://gallery.ecr.aws/stefansundin/rssbox).

**Note:** Redis is now an optional dependency! It is only used for the URL resolution feature (turned off on the public Heroku instance).

#### Heroku

If you need to re-provision redis, or you didn't use the deploy button above to provision the app initially, then you need to make sure to set the maxmemory policy:

```
heroku redis:maxmemory --policy=allkeys-lru
```
**Note:** Redis is an optional dependency! It is only used for the URL resolution feature.

### Configuration

Expand Down
48 changes: 0 additions & 48 deletions app.json

This file was deleted.

4 changes: 2 additions & 2 deletions app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
end

# This route is useful together with this bookmarklet:
# javascript:location='https://rssbox.herokuapp.com/go?q='+encodeURIComponent(location.href);
# javascript:location='https://rssbox.fly.dev/go?q='+encodeURIComponent(location.href);
# Or for Firefox:
# javascript:location='https://rssbox.herokuapp.com/?go='+encodeURIComponent(location.href);
# javascript:location='https://rssbox.fly.dev/?go='+encodeURIComponent(location.href);
get "/go" do
if /^https?:\/\/(?:mobile\.)?twitter\.com\// =~ params[:q]
redirect Addressable::URI.new(path: "/twitter", query_values: params).normalize.to_s, 301
Expand Down
2 changes: 1 addition & 1 deletion config/newrelic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ common: &default_settings
# See https://newrelic.com/docs/site/renaming-applications for more details
# on renaming your New Relic applications.
#
app_name: <%= ENV["NEW_RELIC_APP_NAME"] || ENV["HEROKU_APP_NAME"] %>
app_name: <%= ENV["NEW_RELIC_APP_NAME"] || ENV["FLY_APP_NAME"] || ENV["HEROKU_APP_NAME"] %>

# When "true", the agent collects performance data about your
# application and reports this data to the New Relic service at
Expand Down
47 changes: 47 additions & 0 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# To deploy to your own fly app, change the app name below and run "fly launch".
# Please do not add sensitive environment variables here, use "fly secrets" instead!

app = "rssbox"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []

[env]
MAX_THREADS = "25"
MIN_THREADS = "25"
URL_MAX_CONCURRENCY = "5"
WEB_CONCURRENCY = "2"

[experimental]
allowed_public_ports = []
auto_rollback = true

[[services]]
http_checks = []
internal_port = 3000
processes = ["app"]
protocol = "tcp"
script_checks = []
[services.concurrency]
hard_limit = 50
soft_limit = 40
type = "connections"

[[services.ports]]
force_https = true
handlers = ["http"]
port = 80

[[services.ports]]
handlers = ["tls", "http"]
port = 443

[[services.tcp_checks]]
grace_period = "1s"
interval = "15s"
restart_limit = 0
timeout = "2s"

[[statics]]
guest_path = "/app/public"
url_prefix = "/public"
2 changes: 1 addition & 1 deletion public/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ $(document).ready(async function() {
submit.attr("value", submit_value);
form.find("input").prop("disabled", false);
if (response.status == 503) {
// This is usually just HTML garbage from Heroku when a 30 second timeout has been reached, so print a better error
// This is usually just HTML garbage when the server request timeout is reached, so print a better error
alert("Something went wrong. Try again later.");
}
else if (!response.ok) {
Expand Down

0 comments on commit aba3ff4

Please sign in to comment.