Commit Graph

35 Commits

Author SHA1 Message Date
ekzyis ddaec36617
Fix litd healthcheck (#1246) 2024-06-24 20:28:42 -05:00
ekzyis 93713b33df
Optimistic updates via pending sats in item context (#1229)
* Use context for pending sats

* Fix sats going negative on zap undo

We already handle undoing pending sats by wrapping the payment+mutation with try/finally.

* Remove unnecessary ItemContextProvider

* Rename to parentCtx

* Fix hierarchy of ItemContextProvider

If a comment was root and it was zapped, the pending sats contributed to the sats shown in <CommentsHeader>.

This was caused by <CommentsHeader> accessing the root item context for all comments, even for the root comment.

So even if the root comment was zapped, the pending sats contributed to the sats for the comment section.

This wasn't the case for posts since their item context was above the context used by <CommentsHeader>.

This was fixed by moving <ItemProviderContext> down into <Comments> and <Item> instead of declaring it at <ItemFull> which wraps the root item and all comments.

* Optimistic update for poll votes

* prevent twice optimistic zap

* enhance client notifications with skeleton and no redudant queries

* enlarge nwc amount limits

* Disable max amount and daily limit in NWC container

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2024-06-12 08:34:24 -05:00
ekzyis c6ab776091
Add nostr-wallet-connect-lnd container (#1174)
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2024-05-15 10:10:24 -05:00
ekzyis 47bfa24b57
Add lnbits container (#1173) 2024-05-15 10:09:15 -05:00
ekzyis 7090ea3b70
Fix stacker_cln missing in channdler dependency (#1172) 2024-05-14 16:59:05 -05:00
keyan 46efb770fb actually fix worker in local dev 2024-05-08 16:25:01 -05:00
keyan 32f0b1722f fix local dev worker env loading 2024-05-08 15:15:51 -05:00
SatsAllDay 15f9950477
Store hashed and salted email addresses (#1111)
* first pass of hashing user emails

* use salt

* add a salt to .env.development (prod salt needs to be kept a secret)
* move `hashEmail` util to a new util module

* trigger a one-time job to migrate existing emails via the worker

so we can use the salt from an env var

* move newsletter signup

move newsletter signup to prisma adapter create user with email code path
so we can still auto-enroll email accounts without having to persist the email address
in plaintext

* remove `email` from api key session lookup query

* drop user email index before dropping column

* restore email column, just null values instead

* fix function name

* fix salt and hash raw sql statement

* update auth methods email type in typedefs from str to bool

* remove todo comment

* lowercase email before hashing during migration

* check for emailHash and email to accommodate migration window

update our lookups to check for a matching emailHash, and then a matching
email, in that order, to accommodate the case that a user tries to login
via email while the migration is running, and their account has not yet been migrated

also update sndev to have a command `./sndev email` to launch the mailhog inbox in your browser

also update `./sndev login` to hash the generated email address and insert it into the db record

* update sndev help

* update awards.csv

* update the hack in next-auth to re-use the email supplied on input to `getUserByEmail`

* consolidate console.error logs

* create generic open command

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2024-05-04 18:06:15 -05:00
ekzyis 10e58d41c7
Remove .env.local from env_file (#1113)
Arrays for env_file are only supported in Docker Compose >=v2.24 which is too new (from January 2024). Most distros distribute older packages.

Since --env-file as defined in the sndev script acts as an override for env_file anyway, we can safely remove it here.

Co-authored-by: ekzyis <ekzyis@ekzy.is>
2024-04-27 18:25:37 -05:00
Keyan c3d709b025
add lnc attached wallet (#1104)
* add litd to docker env

* lnc payments

* handle locked wallet configuration

* create new lnc connection for every action

* ensure creds are decrypted before reconnecting

* perform permissions check
2024-04-26 21:22:30 -05:00
ekzyis dd6e921e2e
Fix local env in docker-compose.yaml (#1085)
* Allow docker env override via .env.local

* Make .env.local optional

* Fix env var expansion ignoring .env.local

* Rename .env.development to .env.docker

* Use YAML anchors

* Revert rename of .env.development
2024-04-17 13:46:18 -05:00
keyan 51f1c08a7e get rid of docker compose version number deprecation warning 2024-04-14 17:40:52 -05:00
ekzyis 9f4d5e13aa
CLN autowithdrawal (#1042)
* Add CLN node to docker-compose.yml

* Attach CLN wallet via CLNRest

* Remove leading space

* Implement autowithdrawal to CLN in worker

* Fix UnhandledSchemeError during build

See https://github.com/vercel/next.js/discussions/33982

* Refactor CLN invoice code into @/lib/cln

* Fix missing env vars

* Fix validation error if rune invalid

* Update header

* Add rune placeholder

* Fix missing expiry for test invoice

* Remove nonsensical comment

* Remove unnecessary async

* Show level SUCCESS as OK in logs

* Add stacker_cln commands to sndev

* fix sndev posix compliance, add cln_withdraw

* give stacker_cln larger channels

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2024-04-14 17:34:21 -05:00
Anis Khalfallah 0c0f303a11
Add capture's container from /capture (#1001)
* Modified docker-compose.yml to include capture from /capture

Signed-off-by: Anis Khalfallah <khafallah.anis@hotmail.com>

* Update capture's container to include health checks via /health api

* refine capure docker service

---------

Signed-off-by: Anis Khalfallah <khafallah.anis@hotmail.com>
Co-authored-by: Anis Khalfallah <khafallah.anis@hotmail.com>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2024-04-03 14:28:51 -05:00
Keyan 2055ccaf41
Merge branch 'master' into mailhog 2024-03-25 17:46:56 -05:00
ekzyis f4a7819bb3 Keep standard ports inside container
This makes it possible to continue to use lncli without --rpcserver inside the docker container even if the GRPC port exposed on the host machine is different.

This is the case on my machine since I am running a mainnet LND node on my machine so port 10009 is already used.

I could change the port to 20009 via LND_GRPC_PORT and STACKER_LND_GRPC_PORT (they can even have the same port) but then lncli inside the container needs to be aware of that which means that the sndev script would need to parse .env.development (or some other "magic") to know the GRPC port inside the container.

However, I decided that using standard ports inside the container is better to keep the sndev script simple at the cost of having to think about host vs container ports since they are different now.

One reason for that is that I think one even does not need to think about the host ports since they aren't even needed? But that's another topic.
2024-03-25 19:02:32 +01:00
Felipe Bueno e919efc144 MailHog healthcheck with wget instead of curl 2024-03-25 09:26:45 -03:00
keyan 2502c176f1 improve sndev db healthcheck 2024-03-24 13:59:23 -05:00
Felipe Bueno 561e62481d Add 'profiles: email' to the MailHog container 2024-03-21 09:16:29 -03:00
Felipe Bueno 82dc9b076d Add MailHog container to provide login with email without extra config 2024-03-20 18:41:25 -03:00
keyan 08f1db3f68 sndev profiles 2024-03-17 20:43:34 -05:00
keyan 806f42ed40 don't use imgproxy pro, set opensearch user/pass 2024-03-15 21:16:26 -05:00
Keyan efaa2193e0
new readme with contribution awards (#922)
* new readme

* Update README.md

* Update README.md

* move more docs to README

* add proper mapping for opensearch item index

* add sndev lint

* fix index creation
2024-03-15 14:29:42 -05:00
Keyan 23ee62fb21
add sndev shell script and enhance docker compose local dev
* add hot reloading worker:dev script

* refine docker config

* sndev bash script and docker reliability stuff

* make posix shell

* restart: always -> unless-stopped

* proper check for postgres health

* add db seed to sndev

* refinements after fresh builds

* begin adding regtest network

* add changes to .env.sample

* reorganize docker and add static certs/macroon to lnd

* copy wallet and macaroon dbs for deterministic wallets/macaroons

* fix perms of shared directories

* allow debian useradd with duplicate id

* add auto-mining

* make bitcoin health check dependent on blockheight

* open channel between ln nodes

* improve channel opens

* add sndev payinvoice

* add sndev withdraw

* ascii art

* add sndev status

* sndev passthrough to docker and containers

* add sndev psql command

* remove script logging

* small script cleanup

* smaller db seed

* pin opensearch version

Co-authored-by: ekzyis <ek@stacker.news>

* pin opensearch dashboard

Co-authored-by: ekzyis <ek@stacker.news>

* add sndev prisma

* add help for all commands

* set -e

* s3 and image proxy with broken name resolution

* finally fully working image uploads

* use a better diff algo

---------

Co-authored-by: ekzyis <ek@stacker.news>
2024-03-13 09:04:09 -05:00
ekzyis bfcca7d34e
Use docker container with ip4r installed (#698)
* Use docker container with ip4r installed

* Credit source

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-12-19 09:52:09 -06:00
keyan 51299820b9 fix module issues when running worker 2023-09-26 20:33:54 -05:00
rleed 2a7267a35a
Add OpenSearch to docker setup for development (#509)
* add containers for OpenSearch

* switch OpenSearch Dashboards to http

* add script to take care of index/mapping on first run

* limit mount in opensearch container to only the necessary scope

* handle both docker and non-docker dev setups

* cleanup

* make opensearch work in docker dev

---------

Co-authored-by: rleed <rleed1@pm.me>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-09-24 18:24:04 -05:00
Jo Wo bf4b8714fe
Render images without markdown and use image proxy (#245)
* Parse image links during markdown rendering

* Use imgproxy to replace links

* Add healthcheck

See https://docs.imgproxy.net/healthcheck

* Enable WebP and animation support

* Only replace image URLs

* Replace all occurrences

* Fix creating posts with no text

* Embed image on link posts where link is image

---------

Co-authored-by: ekzyis <ek@stacker.news>
2023-07-12 19:10:01 -05:00
ekzyis 422b2ce8b6
Use postgres:13.2 (#348)
Co-authored-by: ekzyis <ek@stacker.news>
2023-07-07 08:44:23 -05:00
ekzyis 3738f08ac2
Use docker volume for db data (#315)
Co-authored-by: ekzyis <ek@stacker.news>
2023-06-12 20:22:10 -05:00
keyan 1a271432c7 replace docker wait-for-it with long form of depends on 2023-04-26 13:02:42 -05:00
mvpratt 70551706d7 dont run npm install twice on `docker compose up` 2023-04-26 13:02:42 -05:00
austinkelsay d2f76a0c43 Created new image for worker, running work script on startup 2022-10-06 15:33:18 -05:00
keyan 68ddd0f86b sort by top posts 2021-10-21 17:05:06 -05:00
keyan 50477c1b65 dockerize dev env 2021-10-20 14:57:11 -05:00