-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: basic deno lightning address server (#1)
* feat: basic deno lightning address server * doc: update readme * add docker build GH workflow * return 404 for missing amount instead of Error which uses 5xx * fix: run db migration at startup * chore: remove unused field * feat: encrypt connection secret field * chore: also deploy on deno branch * fix: remove --env from start command * chore: add volume to fly config * fix: docker deployment * fix: fly deploy branch * fix: properly follow LNURL spec and add LNURL error handling * doc: update README * chore: remove feat/deno branch from fly deploy workflow --------- Co-authored-by: Fmar <[email protected]>
- Loading branch information
Showing
29 changed files
with
5,166 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fly.toml | ||
node_modules | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
LOG_LEVEL=debug | ||
BASE_URL=http://localhost:8080 | ||
DATABASE_URL=postgresql://myuser:mypass@localhost:5432/alby_lite | ||
# generate using deno task db:generate:key | ||
ENCRYPTION_KEY= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Docker build & push | ||
on: | ||
push: | ||
release: | ||
types: [published] | ||
jobs: | ||
build: | ||
env: | ||
REGISTRY: ghcr.io | ||
IMAGENAME: ${{ github.event.repository.name }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
name: Check out code | ||
- name: Docker build | ||
uses: mr-smithers-excellent/docker-build-push@v5 | ||
id: build | ||
with: | ||
image: ${{ env.IMAGENAME }} | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/ | ||
|
||
name: Fly Deploy | ||
on: | ||
push: | ||
branches: | ||
- master | ||
jobs: | ||
deploy: | ||
name: Deploy app | ||
runs-on: ubuntu-latest | ||
concurrency: deploy-group # optional: ensure only one action runs at a time | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: superfly/flyctl-actions/setup-flyctl@master | ||
- run: flyctl deploy --remote-only | ||
env: | ||
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.env | ||
alby-lite.db* | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. | ||
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp | ||
|
||
// List of extensions which should be recommended for users of this workspace. | ||
"recommendations": ["denoland.vscode-deno"], | ||
// List of extensions recommended by VS Code that should not be recommended for users of this workspace. | ||
"unwantedRecommendations": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"editor.formatOnSave": true, | ||
"editor.codeActionsOnSave": { | ||
"source.organizeImports": "always" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM denoland/deno:1.45.5 | ||
EXPOSE 8080 | ||
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
|
||
USER deno | ||
|
||
CMD ["task", "start"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,37 @@ | ||
# Alby Lite | ||
|
||
A minimal LNURL + Zapper service powered powered by [NWC](https://nwc.dev) | ||
|
||
## Development | ||
|
||
- [Install Deno](https://docs.deno.com/runtime/manual/getting_started/installation/) | ||
- Copy `.env.example` to `.env` | ||
- Setup DB: `deno task db:migrate` | ||
- Run in dev mode: `deno task dev` | ||
|
||
### Creating a new migration | ||
|
||
- Create the migration files: `deno task db:generate` | ||
- The migration will automatically happen when the app starts. | ||
|
||
### Running Tests | ||
|
||
`deno task test` | ||
|
||
## Deployment | ||
|
||
### Run with Deno | ||
|
||
`deno task start` | ||
|
||
### Docker (from Alby's Container Registry) | ||
|
||
`docker run -p 8080:8080 --pull always ghcr.io/getalby/lite:latest` | ||
|
||
### Docker (from source) | ||
|
||
docker run -p 8080:8080 $(docker build -q .) | ||
|
||
### Deploy on Fly | ||
|
||
- `fly deploy` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"imports": { | ||
"hono": "jsr:@hono/hono@^4.5.5", | ||
"drizzle-orm": "npm:[email protected]", | ||
"drizzle-kit": "npm:[email protected]", | ||
"postgres": "npm:[email protected]" | ||
}, | ||
"tasks": { | ||
"cache": "deno cache ./src/main.ts ./src/db/schema.ts npm:@libsql/client", | ||
"cache:reload": "deno cache --reload ./src/main.ts ./src/db/schema.ts", | ||
"db:generate": "deno run -A --node-modules-dir npm:drizzle-kit generate", | ||
"db:generate:key": "deno run ./src/db/generateKey.ts", | ||
"dev": "deno run --env --allow-net --allow-env --allow-read --allow-write --watch src/main.ts", | ||
"start": "deno run --allow-net --allow-env --allow-read --allow-write src/main.ts", | ||
"test": "deno test --env --allow-env" | ||
}, | ||
"compilerOptions": { | ||
"jsx": "precompile", | ||
"jsxImportSource": "hono/jsx" | ||
} | ||
} |
Oops, something went wrong.