Skip to content

Commit

Permalink
Dev/minimal cv manager config (#76)
Browse files Browse the repository at this point in the history
* support minimal cv-manager configuration with different database adapters

* added migrations per database adapter, added comments to example config

* add env-cmd to be able to run different database adapters locally

* provide docker compose configurations and describe setup

* renamed NEXT_PUBLIC_URL as this var get internally renamed by nextjs

* started configuration for local postgres and/or mongdb installation

* added configuration for sqlite, fixed minio integration and resolving of profile pictures when generating pdf

* added further documentation and configuration of local storage

* added separate license file

* added separate env configuration to enable or disable oauth as normals envs are not exposed on client side
  • Loading branch information
toggm authored Jan 29, 2025
1 parent 2d28c77 commit 9860629
Show file tree
Hide file tree
Showing 59 changed files with 12,113 additions and 71 deletions.
70 changes: 48 additions & 22 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,38 +1,64 @@
POSTGRES_URI=postgres://postgres:postgres@localhost:5432/tegonal-cv
# -- Require configuration

# Please specify strong secrets for the following parms
PAYLOAD_SECRET=secret
PRINTER_SECRET=secret
# Use this flag with caution. This will prevent checking existence of PRINTER_SECRET in header. Use for local debug mode only
ALLOW_UNSECURED_CV_ACCESS=false

S3_ENDPOINT=http://localhost:9000
S3_BUCKET=tegonal-cv
S3_SECRET_ACCESS_KEY=secret1234
S3_ACCESS_KEY_ID=secret1234
# Configure for you public deployment, defaults to http://localhost:3000
# Doesn't work with gotenbergs demo instance if not pointing to a public visible url
PUBLIC_URL=http://localhost:3000

# -- Optional configuration

# Generating the PDF documents relies on a running Gotenberg instance. For demo purposes there exist an online
# demo of the gotenberg project itself. Please provide your own instance (https://gotenberg.dev/docs/getting-started/installation)
# and configure it accordingly
# GOTENBERG_PDF_URL=http://localhost:3030

OPENAI_KEY=secret
DEEPL_API_KEY=secret
# Customize url from gotenberg instance to access the app to generate the PDF. Defauls to PUBLIC_URL if missing.
# Only used if gotenberg should access the cv manager on an internal interface instead
# GOTENBERG_TO_APP_URL=http://app:3000

# Provide a custom database URI. Supported protocols are
# postgres:// for Postgres databases
# mongodb:// for MongoDB databases
# file:// for SQLite databases
# Defaults to file:///tmp/cv_manager.db if not specified
# DATABASE_URI=postgres://postgres:postgres@localhost:5432/tegonal-cv

# Use this flag with caution. This will prevent checking existence of PRINTER_SECRET in header. Use for local debug mode only
# ALLOW_UNSECURED_CV_ACCESS=false

GOTENBERG_PDF_URL=http://localhost:3030
# Uncomment if you want to connect to an S3 storage to store media files
# S3_ENDPOINT=http://localhost:9000
# S3_BUCKET=tegonal-cv
# S3_SECRET_ACCESS_KEY=secret1234
# S3_ACCESS_KEY_ID=secret1234

OAUTH_CLIENT_ID=secret
OAUTH_CLIENT_SECRET=secret
OAUTH_TOKEN_ENDPOINT=http://localhost:8080/oauth/token
OAUTH_AUTHORIZE_ENDPOINT=http://localhost:8080/oauth/authorize
OAUTH_USERINFO_ENDPOINT=http://localhost:8080/oauth/userinfo
# Configure local storage location in case not attached to an S3 storage
# LOCAL_MEDIA_STORAGE_DIR=/data/media

NEXT_PUBLIC_URL=http://localhost:3000
# Uncomment if you want to configure an integration to an oauth client
# NEXT_PUBLIC_OAUTH_ENABLE=true
# OAUTH_CLIENT_ID=secret
# OAUTH_CLIENT_SECRET=secret
# OAUTH_TOKEN_ENDPOINT=http://localhost:8080/oauth/token
# OAUTH_AUTHORIZE_ENDPOINT=http://localhost:8080/oauth/authorize
# OAUTH_USERINFO_ENDPOINT=http://localhost:8080/oauth/userinfo

SMTP_FROM_ADDRESS=[email protected]
SMTP_HOST=localhost
SMTP_PORT=1025
SMTP_USER=smtpuser
SMTP_PASS=smtppwd
# Uncomment to be able to send out passwort reset emails, otherwise messages are written to the console log
# [email protected]
# SMTP_HOST=localhost
# SMTP_PORT=1025
# SMTP_USER=smtpuser
# SMTP_PASS=smtppwd

# -- PDF layouting options, only required if you're using the default layout
# Company name used in default page
DEFAULT_PAGE_COMPANY_NAME=MyCompany
DEFAULT_PAGE_COMPANY_ADDRESS=Homestreet 20
DEFAULT_PAGE_COMPANY_CITY=3000 Bern
DEFAULT_PAGE_COMPANY_URL=https://github.com/tegonal
DEFAULT_PAGE_COMPANY_URL=https://github.com/tegonal/cv-manager

# Provide custom logo in the public folder
DEFAULT_PAGE_COMPANY_LOGO=logo.png
Expand Down
18 changes: 18 additions & 0 deletions .env.local_mongodb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Minimal configuration to run against local mongodb instance
DATABASE_URI=mongodb://root:root@localhost:27017/

PAYLOAD_SECRET=secret
PRINTER_SECRET=secret

GOTENBERG_PDF_URL=http://localhost:3030

[email protected]
SMTP_HOST=localhost
SMTP_PORT=1025
SMTP_USER=smtpuser
SMTP_PASS=smtppwd

S3_ENDPOINT=http://localhost:9000
S3_BUCKET=tegonal-cv
S3_SECRET_ACCESS_KEY=secret1234
S3_ACCESS_KEY_ID=secret1234
18 changes: 18 additions & 0 deletions .env.local_postgres
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Minimal configuration to run against local postgres
DATABASE_URI=postgres://postgres:postgres@localhost:5432/cv-manager

PAYLOAD_SECRET=secret
PRINTER_SECRET=secret

GOTENBERG_PDF_URL=http://localhost:3030

[email protected]
SMTP_HOST=localhost
SMTP_PORT=1025
SMTP_USER=smtpuser
SMTP_PASS=smtppwd

S3_ENDPOINT=http://localhost:9000
S3_BUCKET=tegonal-cv
S3_SECRET_ACCESS_KEY=secret1234
S3_ACCESS_KEY_ID=secret1234
13 changes: 13 additions & 0 deletions .env.local_sqlite
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Minimal configuration to run against local posqlitestgres
DATABASE_URI=file:///tmp/cv_manager.db

PAYLOAD_SECRET=secret
PRINTER_SECRET=secret

GOTENBERG_PDF_URL=http://localhost:3030

[email protected]
SMTP_HOST=localhost
SMTP_PORT=1025
SMTP_USER=smtpuser
SMTP_PASS=smtppwd
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ yarn-error.log*
*.tsbuildinfo
next-env.d.ts

.env
/.env
!next-env.d.ts

/media
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Build main app package
FROM node:22 AS builder
ENV NEXT_TELEMETRY_DISABLED 1
ENV NEXT_TELEMETRY_DISABLED=1

WORKDIR /app
COPY ./ ./
Expand All @@ -12,7 +12,7 @@ RUN rm -rf .git

FROM node:22-slim AS runner
RUN apt-get update && apt-get install -y curl && apt-get clean && rm -rf /var/lib/apt/lists/*
ENV NEXT_TELEMETRY_DISABLED 1
ENV NEXT_TELEMETRY_DISABLED=1

WORKDIR /app

Expand Down
9 changes: 9 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) 2025 Tegonal Genossenschaft

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Loading

0 comments on commit 9860629

Please sign in to comment.