rename brf_books > brf, set up production and use brf.lkm.nu mail domain

This commit is contained in:
Linus Miller 2025-12-20 20:18:32 +01:00
parent 5af010f3af
commit 195fccefe6
14 changed files with 48 additions and 26 deletions

View File

@ -1,16 +1,16 @@
NODE_ENV=development NODE_ENV=development
DOMAIN=bitmill.io DOMAIN=brf.lkm.nu
PROTOCOL=https PROTOCOL=https
HOSTNAME=brf.local HOSTNAME=brf.local
PORT=null PORT=null
FASTIFY_HOST=0.0.0.0 FASTIFY_HOST=0.0.0.0
FASTIFY_PORT=1337 FASTIFY_PORT=3080
LOG_LEVEL=debug LOG_LEVEL=debug
LOG_STREAM=console LOG_STREAM=console
PGHOST=postgres PGHOST=postgres
PGPORT=5432 PGPORT=5432
PGDATABASE=brf_books PGDATABASE=brf
PGUSER=brf_books PGUSER=brf
PGPASSWORD=brf_books PGPASSWORD=brf
REDIS_HOST=redis REDIS_HOST=redis
VITE_HMR_PROXY=true VITE_HMR_PROXY=true

13
.env.production Normal file
View File

@ -0,0 +1,13 @@
NODE_ENV=production
DOMAIN=brf.lkm.nu
PROTOCOL=https
HOSTNAME=brf.lkm.nu
PORT=null
FASTIFY_HOST=localhost
FASTIFY_PORT=3080
LOG_LEVEL=debug
LOG_STREAM=console
PGHOST=/run/postgresql
PGDATABASE=brf
REDIS_HOST=/run/redis/redis.sock
VITE_HMR_PROXY=false

View File

@ -1,5 +1,5 @@
NODE_ENV=testing NODE_ENV=testing
DOMAIN=bitmill.io DOMAIN=brf.lkm.nu
PROTOCOL=https PROTOCOL=https
HOSTNAME=brf.local HOSTNAME=brf.local
PORT=null PORT=null
@ -9,9 +9,9 @@ LOG_LEVEL=debug
LOG_STREAM=console LOG_STREAM=console
PGHOST=localhost PGHOST=localhost
PGPORT=5432 PGPORT=5432
PGDATABASE=brf_books PGDATABASE=brf
PGUSER=brf_books PGUSER=brf
PGPASSWORD=brf_books PGPASSWORD=brf
REDIS_HOST=null REDIS_HOST=null
VITE_HMR_PROXY=false VITE_HMR_PROXY=false
MAILGUN_API_KEY=not_a_valid_key MAILGUN_API_KEY=not_a_valid_key

View File

@ -13,8 +13,8 @@ RUN groupmod -g $GID node
RUN usermod -u $UID -g node node RUN usermod -u $UID -g node node
USER node USER node
RUN mkdir /home/node/brf_books RUN mkdir /home/node/brf
WORKDIR /home/node/brf_books WORKDIR /home/node/brf
COPY --chown=node pnpm-lock.yaml package.json . COPY --chown=node pnpm-lock.yaml package.json .
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile

View File

@ -21,9 +21,9 @@ services:
image: postgres:18-alpine image: postgres:18-alpine
restart: always restart: always
environment: environment:
- POSTGRES_DB=brf_books - POSTGRES_DB=brf
- POSTGRES_USER=brf_books - POSTGRES_USER=brf
- POSTGRES_PASSWORD=brf_books - POSTGRES_PASSWORD=brf
volumes: volumes:
- ./docker/postgres:/docker-entrypoint-initdb.d - ./docker/postgres:/docker-entrypoint-initdb.d
- postgres:/var/lib/postgresql/data - postgres:/var/lib/postgresql/data

View File

@ -8,3 +8,10 @@ services:
service: postgres service: postgres
ports: ports:
- ${PG_EXTERNAL_PORT-5432}:5432 - ${PG_EXTERNAL_PORT-5432}:5432
redis:
extends:
file: docker-compose.base.yml
service: redis
ports:
- ${PG_EXTERNAL_PORT-6379}:6379

View File

@ -15,14 +15,15 @@ services:
ports: ports:
- 24678:24678 - 24678:24678
volumes: volumes:
- ./client:/home/node/brf_books/client - ./client:/home/node/brf/client
- ./server:/home/node/brf_books/server - ./server:/home/node/brf/server
- ./uploads:/home/node/brf_books/uploads - ./uploads:/home/node/brf/uploads
depends_on: depends_on:
- postgres - postgres
- redis - redis
env_file: env_file:
- ./.env.development - ./.env.development
- ./.env.secrets
caddy: caddy:
extends: extends:

View File

@ -8,7 +8,7 @@ brf.local {
} }
reverse_proxy @ws node:24678 reverse_proxy @ws node:24678
reverse_proxy node:1337 { reverse_proxy node:3080 {
lb_try_duration 30s lb_try_duration 30s
lb_try_interval 1s lb_try_interval 1s
} }

View File

@ -45,7 +45,7 @@ parser.add_argument('--accounting', action='store_true')
parser.add_argument('tables', type=str, nargs='*', help='The tables to dump') parser.add_argument('tables', type=str, nargs='*', help='The tables to dump')
args = parser.parse_args() args = parser.parse_args()
command = ['docker-compose', 'exec', '-T', 'postgres', 'pg_dump', '-U', 'brf_books', '-d', 'brf_books', '-O'] command = ['docker-compose', 'exec', '-T', 'postgres', 'pg_dump', '-U', 'brf', '-d', 'brf', '-O']
for enabled, tables in [ for enabled, tables in [
(args.tables, args.tables), (args.tables, args.tables),

View File

@ -1,15 +1,15 @@
{ {
"name": "brf_books", "name": "brf",
"version": "0.0.1", "version": "0.0.1",
"main": "server/index.js", "main": "server/index.js",
"type": "module", "type": "module",
"repository": "git@git.bitmill.io:bitmill/brf_books.git", "repository": "git@git.bitmill.io:lkm/brf.git",
"author": "Linus Miller <linus.miller@bitmill.io>", "author": "Linus Miller <linus.miller@bitmill.io>",
"license": "MIT", "license": "MIT",
"private": true, "private": true,
"scripts": { "scripts": {
"build": "pnpm run build:client && pnpm run build:server", "build": "pnpm run build:client && pnpm run build:server",
"build:client": "vite build", "build:client": "VITE_ENTRY=public vite build && VITE_ENTRY=admin vite build",
"build:server": "vite build --ssr", "build:server": "vite build --ssr",
"clean": "rm -r dist", "clean": "rm -r dist",
"format": "prettier --write .", "format": "prettier --write .",

View File

@ -1,6 +1,6 @@
import env from '../env.ts' import env from '../env.ts'
export default { export default {
url: 'https://api.mailgun.net/v3/mg.bitmill.io/messages', url: 'https://api.eu.mailgun.net/v3/mg.lkm.nu/messages',
key: env.MAILGUN_API_KEY, key: env.MAILGUN_API_KEY,
} }

View File

@ -15,7 +15,7 @@ export default {
return `${this.protocol}://${this.host}/` return `${this.protocol}://${this.host}/`
}, },
emails: { emails: {
robot: `no-reply@bitmill.io`, robot: `no-reply@${env.DOMAIN}`,
info: 'contact@bitmill.io', info: `contact@${env.DOMAIN}`,
}, },
} }

View File

@ -16,6 +16,7 @@ export default async function viteProduction(fastify: FastifyInstance, config: P
fastify.register(fstatic, { fastify.register(fstatic, {
root: viteConfig.build.outDir, root: viteConfig.build.outDir,
wildcard: false, wildcard: false,
decorateReply: false,
}) })
fastify.decorateReply('ctx', null) fastify.decorateReply('ctx', null)

View File

@ -23,7 +23,7 @@ export default defineConfig(({ isSsrBuild }) => {
}, },
server: { server: {
allowedHosts: ['brf.local'], allowedHosts: ['brf.local'],
port: 1338, port: 3081,
hmr: process.env.VITE_HMR_PROXY hmr: process.env.VITE_HMR_PROXY
? { ? {
clientPort: 443, clientPort: 443,