Egge on Nostr: I finally made it. npubcash-server is now deployable without much hassle. 🥜 This ...
I finally made it. npubcash-server is now deployable without much hassle. 🥜
This is not final and merged yet, so please proceed with caution. If you try it out, please let me know when you break something 💜🙌🏻
This is not final and merged yet, so please proceed with caution. If you try it out, please let me know when you break something 💜🙌🏻
quoting note1fs4…wqmk_Disclaimer: Beware, there be dragons... Deploying your own version of npubcash-server is highly experimental. Do not use this in production yet. If you do deploy it, please make sure to leave your feedback with [me](https://njump.me/npub1mhcr4j594hsrnen594d7700n2t03n8gdx83zhxzculk6sh9nhwlq7uc226)._
## Prerequisites
Before we dive in, you'll need a few things:
1. **Blink API Key**: npubcash-server uses Blink API for payment callbacks. If you don’t have a Blink account yet, sign up [here](https://dashboard.blink.sv/).
2. **Postgres**: npubcash-server utilizes a Postgres database for storage.
3. **fly.io Account and flyctl**: While you can deploy npubcash-server anywhere, this guide focuses on fly.io and its CLI tool, flyctl.
## Setup
### Step 1: Clone the Repository
First, clone the npubcash-server repository, specifically the `migrations` branch, as it contains the necessary deployment scripts. Don’t forget to clone all submodules recursively.
```zsh
git clone -b migrations --recurse-submodules https://github.com/cashubtc/npubcash-server.git
cd npubcash-server
```
### Step 2: Create fly.toml Configuration
Next, create your `fly.toml` file to configure your deployment.
```zsh
nvim fly.toml
```
Here's a sample configuration. Adjust the environment variables to match your setup:
```toml
app = "npubcash-server"
primary_region = "ams"
[build]
[http_service]
internal_port = 8000
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
processes = ["app"]
[[vm]]
memory = "512mb"
cpu_kind = "shared"
cpus = 1
[env]
NODE_ENV = "production"
PGUSER = ""
PGPASSWORD = ""
PGHOST = ""
PGDATABASE = ""
PGPORT = ""
MINTURL = ""
BLINK_API_KEY = "