Skip to content

Commit

Permalink
feat: stats weekly dexes (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
pradel authored Mar 23, 2024
1 parent 93f2996 commit 256ad69
Show file tree
Hide file tree
Showing 21 changed files with 417 additions and 51 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ yarn-error.log\*
# local env files

.env\*.local
.env.keys

# vercel

Expand Down
5 changes: 5 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
NEXT_TELEMETRY_DISABLED=1
CHAINHOOKS_API_TOKEN=dev-api-token
CRON_API_TOKEN=dev-api-token
DATABASE_PATH=./sqlite.db
TWITTER_API_KEY=dev
TWITTER_API_SECRET_KEY=dev
TWITTER_ACCESS_TOKEN=dev
TWITTER_ACCESS_TOKEN_SECRET=dev

# Client environment variables
NEXT_PUBLIC_BASE_URL=http://localhost:3000
5 changes: 5 additions & 0 deletions .env.production.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# file used by the CI to build the app
NEXT_TELEMETRY_DISABLED=1
CHAINHOOKS_API_TOKEN=dev-api-token
CRON_API_TOKEN=dev-api-token
DATABASE_PATH=./sqlite.db
TWITTER_API_KEY=dev
TWITTER_API_SECRET_KEY=dev
TWITTER_ACCESS_TOKEN=dev
TWITTER_ACCESS_TOKEN_SECRET=dev
8 changes: 8 additions & 0 deletions .env.vault
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#/-------------------.env.vault---------------------/
#/ cloud-agnostic vaulting standard /
#/ [how it works](https://dotenvx.com/env-vault) /
#/--------------------------------------------------/

# production
DOTENV_VAULT_PRODUCTION="uRhaI/UpsVXjvkxWovxFhOcnZ2hhe5x6QbutGIVTs8RZZzOKTIccnRYv9q4fv2ZkQYPsQzsQS8RH8xrnsgxvv2g2PEsf3xXV93cSDDooo16gHCyYPEM0OSBQu9bakSm71V9+AfMv96Kha2hq/ThvYbZFfWvh9dZXROiZnIvjbkooyXD+yxIDbD/QVEQD8HwCm/o8LBfGsYF5NeQqs3guu3gFhxpyjhIt40zTxk2y/Qp4zoPPiqbTuVUO4DEAioXCVoRTb3IKz7lfW7zQnUvwFJkZ9bNLw2z52DcaSYJfxmwlkfgAMx2+M2ii8LK445zKCvOJ2zO6w50W+TWY1rOiyQbUb3FVqUUy+LbGWxQInTOUX4cbq2REUxEHz37iHgAAGKdwl8wbYBIzM+fVsZ9kmkKg0vneGw+vdQ7SFWNuZmpDnaG3gDOMbPmX+xNCtJvnNum6Ar24I2oyQonHJLTyO308rNpQrfIEV1JCJkrAKMl7iM/fRxCKxmVSCog+nOG66r0pGftm5JQ8fECjspzPxnihosKmvLqfrPAhboVd"

14 changes: 14 additions & 0 deletions .github/workflows/cron-weekly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: cron-weekly
on:
workflow_dispatch:
schedule:
- cron: '0 16 * * 6'
jobs:
cron:
runs-on: ubuntu-latest
steps:
- name: hourly-cron-job
run: |
curl --request GET \
--url 'https://stackspulse.com/api/cron/weekly-users' \
--header 'Authorization: Bearer ${{ secrets.CRON_API_TOKEN }}'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ yarn-error.log*

# local env files
.env*.local
.env.keys

# vercel
.vercel
Expand Down
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{
"editor.defaultFormatter": "biomejs.biome",
"editor.codeActionsOnSave": {
"source.organizeImports.biome": "explicit",
"quickfix.biome": "explicit"
},
"[typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
}
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ COPY --from=build /app/package.json ./package.json
COPY --from=build /app/scripts ./scripts
COPY --from=build /app/drizzle.config.ts ./drizzle.config.ts
COPY --from=build /app/drizzle ./drizzle
COPY --from=build /app/.env.vault ./.env.vault

COPY --from=build /app/public ./public
COPY --from=build /app/.next/standalone ./
Expand All @@ -66,4 +67,4 @@ ENV DATABASE_PATH="/data/sqlite.db"

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD pnpm db:migrate && node server.js
CMD pnpm db:migrate && pnpm dotenvx run -- node server.js
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ fly deploy --remote-only

Finally upload the chainhooks predicates file `chainhooks.production.json` to the [Hiro platform](https://platform.hiro.so/) for your project.

### Add new production environment variables

Add the variable to the `.env.production.local` file and encrypt it using the `dotenvx` command:

```bash
pnpm dotenvx encrypt --env-file .env.production.local
```

### Download the production database locally

```bash
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"dependencies": {
"@dotenvx/dotenvx": "0.26.0",
"@radix-ui/themes": "2.0.3",
"@radix-ui/themes": "3.0.0",
"@stacks/transactions": "6.13.0",
"@t3-oss/env-core": "0.9.2",
"@t3-oss/env-nextjs": "0.9.2",
Expand All @@ -37,6 +37,7 @@
"sharp": "0.33.3",
"tailwind-merge": "2.2.2",
"tailwindcss-animate": "1.0.7",
"twitter-api-v2": "1.16.1",
"zod": "3.22.4"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit 256ad69

Please sign in to comment.