Skip to content

Commit

Permalink
Postgres bug fixes (#33)
Browse files Browse the repository at this point in the history
* Setup ssl for postgres

* Update .env.default

* Rename db_server to db_name
  • Loading branch information
shaynethiessen authored Jun 26, 2024
1 parent ba38c7f commit 7114f90
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/deploy/server-release/server/.env.default
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ API_VERSION='0.0.1'
DB_USERNAME=postgres
DB_PASSWORD=
DB_DOMAIN=localhost
DB_SERVER=hh
DB_NAME=hh
DB_PORT=5432
DB_REJECT_UNAUTHORIZED=false
DB_LOGGING=true
DB_LOGGING=false

DEBUG=hh.*
12 changes: 12 additions & 0 deletions packages/deploy/server-setup/historyhall.org
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ server {
proxy_set_header X-Forwarded-Proto $scheme;
}
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name db.historyhall.org www.db.historyhall.org;
location / {
proxy_pass http://localhost:5432;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
server {
listen 443 ssl;
listen [::]:443 ssl;
Expand Down
1 change: 1 addition & 0 deletions packages/deploy/server-setup/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ sudo systemctl restart nginx
sudo certbot --nginx -d historyhall.org -d www.historyhall.org
sudo certbot --nginx -d registry.historyhall.org -d www.registry.historyhall.org
sudo certbot --nginx -d api.historyhall.org -d www.api.historyhall.org
sudo certbot --nginx -d db.historyhall.org -d db.api.historyhall.org

# Docker Registry
sudo mkdir -p /srv/docker-registry/registry;
Expand Down
2 changes: 1 addition & 1 deletion packages/migrate/.env.default
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
DB_USERNAME=postgres
DB_PASSWORD=
DB_DOMAIN=localhost
DB_SERVER=hh
DB_NAME=hh
DB_PORT=5432
DB_REJECT_UNAUTHORIZED=false
DB_LOGGING=true
Expand Down
2 changes: 1 addition & 1 deletion packages/migrate/src/core/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const environment = {
dbUsername: process.env.DB_USERNAME,
dbPassword: process.env.DB_PASSWORD,
dbDomain: process.env.DB_DOMAIN || 'localhost',
dbServer: process.env.DB_SERVER || 'hh',
dbName: process.env.DB_NAME || 'hh',
dbPort: process.env.DB_PORT || '5432',
dbRejectUnauthorized: process.env.DB_REJECT_UNAUTHORIZED === 'true',
dbLogging: process.env.DB_LOGGING === 'true',
Expand Down
2 changes: 1 addition & 1 deletion packages/migrate/src/core/mikro-orm.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {PostgreSqlDriver} from "@mikro-orm/postgresql";

const config = {
entities,
clientUrl: `postgres://${environment.dbUsername}:${environment.dbPassword}@${environment.dbDomain}:${environment.dbPort}/${environment.dbServer}`,
clientUrl: `postgres://${environment.dbUsername}:${environment.dbPassword}@${environment.dbDomain}:${environment.dbPort}/${environment.dbName}`,
debug: environment.dbLogging,
discovery: {
disableDynamicFileAccess: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/server/.env.default
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ API_VERSION='0.0.1'
DB_USERNAME=postgres
DB_PASSWORD=
DB_DOMAIN=localhost
DB_SERVER=hh
DB_NAME=hh
DB_PORT=5432
DB_REJECT_UNAUTHORIZED=false
DB_LOGGING=true
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/core/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const environment = {
dbUsername: process.env.DB_USERNAME,
dbPassword: process.env.DB_PASSWORD,
dbDomain: process.env.DB_DOMAIN || 'localhost',
dbServer: process.env.DB_SERVER || 'hh',
dbName: process.env.DB_NAME || 'hh',
dbPort: process.env.DB_PORT || '5432',
dbRejectUnauthorized: process.env.DB_REJECT_UNAUTHORIZED === 'true',
dbLogging: process.env.DB_LOGGING === 'true',
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/core/mikro-orm.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {PostgreSqlDriver} from "@mikro-orm/postgresql";

const config = {
entities,
clientUrl: `postgres://${environment.dbUsername}:${environment.dbPassword}@${environment.dbDomain}:${environment.dbPort}/${environment.dbServer}`,
clientUrl: `postgres://${environment.dbUsername}:${environment.dbPassword}@${environment.dbDomain}:${environment.dbPort}/${environment.dbName}`,
debug: environment.dbLogging,
discovery: {
disableDynamicFileAccess: true,
Expand Down

0 comments on commit 7114f90

Please sign in to comment.