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
DOMAIN=bitmill.io
DOMAIN=brf.lkm.nu
PROTOCOL=https
HOSTNAME=brf.local
PORT=null
FASTIFY_HOST=0.0.0.0
FASTIFY_PORT=1337
FASTIFY_PORT=3080
LOG_LEVEL=debug
LOG_STREAM=console
PGHOST=postgres
PGPORT=5432
PGDATABASE=brf_books
PGUSER=brf_books
PGPASSWORD=brf_books
PGDATABASE=brf
PGUSER=brf
PGPASSWORD=brf
REDIS_HOST=redis
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
DOMAIN=bitmill.io
DOMAIN=brf.lkm.nu
PROTOCOL=https
HOSTNAME=brf.local
PORT=null
@ -9,9 +9,9 @@ LOG_LEVEL=debug
LOG_STREAM=console
PGHOST=localhost
PGPORT=5432
PGDATABASE=brf_books
PGUSER=brf_books
PGPASSWORD=brf_books
PGDATABASE=brf
PGUSER=brf
PGPASSWORD=brf
REDIS_HOST=null
VITE_HMR_PROXY=false
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
USER node
RUN mkdir /home/node/brf_books
WORKDIR /home/node/brf_books
RUN mkdir /home/node/brf
WORKDIR /home/node/brf
COPY --chown=node pnpm-lock.yaml package.json .
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile

View File

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

View File

@ -8,3 +8,10 @@ services:
service: postgres
ports:
- ${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:
- 24678:24678
volumes:
- ./client:/home/node/brf_books/client
- ./server:/home/node/brf_books/server
- ./uploads:/home/node/brf_books/uploads
- ./client:/home/node/brf/client
- ./server:/home/node/brf/server
- ./uploads:/home/node/brf/uploads
depends_on:
- postgres
- redis
env_file:
- ./.env.development
- ./.env.secrets
caddy:
extends:

View File

@ -8,7 +8,7 @@ brf.local {
}
reverse_proxy @ws node:24678
reverse_proxy node:1337 {
reverse_proxy node:3080 {
lb_try_duration 30s
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')
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 [
(args.tables, args.tables),

View File

@ -1,15 +1,15 @@
{
"name": "brf_books",
"name": "brf",
"version": "0.0.1",
"main": "server/index.js",
"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>",
"license": "MIT",
"private": true,
"scripts": {
"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",
"clean": "rm -r dist",
"format": "prettier --write .",

View File

@ -1,6 +1,6 @@
import env from '../env.ts'
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,
}

View File

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

View File

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

View File

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