Skip to content

Add free fly.io deployment instructions #456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@
- [Docker](#docker)
- [Docker Compose](#docker-compose)
- [Docker CLI](#docker-cli)
- Podman
- Podman
- Quadlets

- [Binary](#binary)
- [Running as a systemd service](#running-as-a-systemd-service)
- [Building from source](#building-from-source)
- [Replit/Heroku/Glitch](#replit-heroku-glitch)
- [Replit/Heroku/Fly.io](#replitherokuflyio)
- [launchd (macOS)](#launchd-macos)
6. [Configuration](#configuration)
- [Instance settings](#instance-settings)
Expand Down Expand Up @@ -216,7 +216,7 @@ Stream logs from the Redlib container:
```bash
docker logs -f redlib
```
## Podman
## Podman

[Podman](https://podman.io/) lets you run containerized applications in a rootless fashion. Containers are loosely isolated environments that are lightweight and contain everything needed to run the application, so there's no need to rely on what's installed on the host.

Expand All @@ -225,8 +225,8 @@ Container images for Redlib are available at [quay.io](https://quay.io/repositor
### Quadlets

> [!IMPORTANT]
> These instructions assume that you are on a systemd based distro with [podman](https://podman.io/). If not, follow these [instructions on podman's website](https://podman.io/docs/installation) for how to do so.
> It also assumes you have used `loginctl enable-linger <username>` to enable the service to start for your user without logging in.
> These instructions assume that you are on a systemd based distro with [podman](https://podman.io/). If not, follow these [instructions on podman's website](https://podman.io/docs/installation) for how to do so.
> It also assumes you have used `loginctl enable-linger <username>` to enable the service to start for your user without logging in.

Copy the `redlib.container` and `.env.example` files to `.config/containers/systemd/` and modify any relevant values (for example, the ports Redlib should listen on, renaming the .env file and editing its values, etc.).

Expand All @@ -244,7 +244,7 @@ systemctl --user start redlib.service
```

You can check the status of your container by using the following command:
```bash
```bash
systemctl --user status redlib.service
```

Expand Down Expand Up @@ -313,14 +313,25 @@ git clone https://github.com/redlib-org/redlib && cd redlib
cargo run
```

## Replit/Heroku
## Replit/Heroku/Fly.io

> [!WARNING]
> These are free hosting options, but they are _not_ private and will monitor server usage to prevent abuse. If you need a free and easy setup, this method may work best for you.

<a href="https://repl.it/github/redlib-org/redlib"><img src="https://repl.it/badge/github/redlib-org/redlib" alt="Run on Repl.it" height="32" /></a>
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/redlib-org/redlib)

### Fly.io
Fly.io lets you run an app with 512mb memory for free per month. Don't worry if you see your monthly bill going up, if it's less than $5, they will waive the cost.

- Install flyctl by `brew install flyctl` or see other options at https://fly.io/docs/getting-started/launch/
- Create an account with `fly auth signup` or log in with `fly auth login`.
- `git clone https://github.com/redlib-org/redlib && cd redlib`
- Edit fly.toml to configure your redlib instance
- `fly deploy`
- Go to https://replace-this-name.fly.dev and now you have your own redlib instance
- To upgrade your instance to the latest build, run `fly deploy --image quay.io/redlib/redlib:latest`

## launchd (macOS)

If you are on macOS, you can use the [launchd](https://en.wikipedia.org/wiki/Launchd) service available in `contrib/redlib.plist`.
Expand Down Expand Up @@ -441,4 +452,4 @@ Assign a default value for each user-modifiable setting by passing environment v
| `HIDE_SCORE` | `["on", "off"]` | `off` |
| `HIDE_SIDEBAR_AND_SUMMARY` | `["on", "off"]` | `off` |
| `FIXED_NAVBAR` | `["on", "off"]` | `on` |
| `REMOVE_DEFAULT_FEEDS` | `["on", "off"]` | `off` |
| `REMOVE_DEFAULT_FEEDS` | `["on", "off"]` | `off` |
20 changes: 20 additions & 0 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
app = "replace-this-name" # Your free redlib instance will be at https://replace-this-name.fly.dev
primary_region = "sea" # Choose a region closest to you, see https://fly.io/docs/reference/regions/

[build]
image = "quay.io/redlib/redlib:latest"

[env]
REDLIB_DEFAULT_THEME = "dark" # Add more env variables here

[http_service]
auto_start_machines = true
force_https = true
internal_port = 8_080
min_machines_running = 0
processes = [ "app" ]

[[vm]]
cpu_kind = "shared"
cpus = 1
memory = "512mb"