feat: deployment workflows, envs, urls and configs
All checks were successful
Deploy Web to Netlify / deploy (push) Successful in 1m38s

This commit is contained in:
2025-12-24 00:19:14 -06:00
parent 267442498d
commit 008aa73567
10 changed files with 99 additions and 5 deletions

View File

@@ -0,0 +1,28 @@
name: Deploy Server
on:
push:
branches:
- main
paths:
- 'apps/server/**'
- 'packages/**'
- 'package.json'
- 'bun.lock'
- 'turbo.json'
- 'nixpacks.toml'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Trigger Deployment Webhook
run: |
curl -X 'POST' \
'https://infra.floocs.com/api/application.deploy' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'x-api-key: ${{ secrets.DOKPLOY_API_KEY }}' \
-d '{
"applicationId": "LssU_qv_pecGq2rjWMJwR"
}'

View File

@@ -0,0 +1,38 @@
name: Deploy Web to Netlify
on:
push:
branches:
- main
paths:
- 'apps/web/**'
- 'packages/**'
- 'package.json'
- 'bun.lock'
- 'turbo.json'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Build web package
run: bun run build --filter=web
env:
NODE_ENV: production
- name: Deploy to Netlify
run: |
bunx netlify-cli deploy --filter=web --dir=apps/web/dist --prod --site=${{ secrets.NETLIFY_SITE_ID }} --auth=${{ secrets.NETLIFY_AUTH_TOKEN }}

View File

@@ -7,7 +7,7 @@
"check-types": "tsc -b",
"compile": "bun build --compile --minify --sourcemap --bytecode ./src/index.ts --outfile server",
"dev": "bun run --hot src/index.ts",
"start": "bun run dist/index.js"
"start": "bun run dist/index.mjs"
},
"dependencies": {
"hono": "catalog:",

View File

@@ -1,5 +1,5 @@
import { createAuthClient } from "better-auth/react";
export const authClient = createAuthClient({
baseURL: import.meta.env.VITE_SERVER_URL,
baseURL: process.env.NODE_ENV === "production" ? "https://goitsacursos.api.floocs.com" : import.meta.env.VITE_SERVER_URL,
});

View File

@@ -21,7 +21,8 @@ export const queryClient = new QueryClient({
export const trpcClient = createTRPCClient<AppRouter>({
links: [
httpBatchLink({
url: `${import.meta.env.VITE_SERVER_URL}/trpc`,
url: `${process.env.NODE_ENV === "production" ? "https://goitsacursos.api.floocs.com" : import.meta.env.VITE_SERVER_URL}/trpc`,
fetch(url, options) {
return fetch(url, {
...options,

4
generate-db.sh Normal file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
# Push database schema in loose environment mode
bun db:push --env-mode=loose

19
nixpacks.toml Normal file
View File

@@ -0,0 +1,19 @@
[phases.setup]
nixPkgs = ["...", "nodejs_22", "bun"]
[phases.install]
cmds = ["bun install --frozen-lockfile"]
[phases.build]
cmds = [
"bun run build --filter=server",
"echo --- DEBUG ENVIRONMENT VARIABLES ---",
"echo NODE_ENV: \"$NODE_ENV\"",
"echo BETTER_AUTH_URL: \"$BETTER_AUTH_URL\"",
"echo CORS_ORIGIN: \"$CORS_ORIGIN\"",
"echo DATABASE_URL: \"$DATABASE_URL\"",
"echo ----------------------------------"
]
[start]
cmd = "bun run --filter=server start"

View File

@@ -45,5 +45,8 @@
"typescript": "catalog:",
"@types/bun": "catalog:"
},
"packageManager": "bun@1.2.22"
"packageManager": "bun@1.2.22",
"engines": {
"node": ">=20.12.0"
}
}

View File

@@ -4,6 +4,7 @@ import { betterAuth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
export const auth = betterAuth({
baseURL: process.env.BETTER_AUTH_URL,
database: drizzleAdapter(db, {
provider: "sqlite",

View File

@@ -2,7 +2,7 @@ import dotenv from "dotenv";
import { defineConfig } from "drizzle-kit";
dotenv.config({
path: "../../apps/server/.env",
path: process.env.NODE_ENV === "production" ? "../../../data/.env" : "../../apps/server/.env",
});
export default defineConfig({