chore: add postgres configuration

feature/blog
Näser 3 years ago
parent ee8f9a512a
commit 33f322383c

@ -1,7 +1,10 @@
export default { export default {
responses: {
privateAttributes: ['_v', 'id', 'created_at'],
},
rest: { rest: {
defaultLimit: 25, defaultLimit: 100,
maxLimit: 100, maxLimit: 250,
withCount: true, withCount: true,
}, },
}; };

@ -1,11 +1,24 @@
import path from 'path';
export default ({env}) => ({ export default ({env}) => ({
connection: { connection: {
client: 'sqlite', client: 'postgres',
connection: { connection: {
filename: path.join(__dirname, '..', '..', env('DATABASE_FILENAME', '.tmp/data.db')), host: env('DATABASE_HOST', 'localhost'),
port: env.int('DATABASE_PORT', 5432),
database: env('DATABASE_NAME', 'bank'),
user: env('DATABASE_USERNAME', 'postgres'),
password: env('DATABASE_PASSWORD', '0000'),
schema: env('DATABASE_SCHEMA', 'public'), // Not required
ssl: {
rejectUnauthorized: env.bool('DATABASE_SSL_SELF', false),
}, },
useNullAsDefault: true,
}, },
debug: false,
},
// connection: {
// client: 'sqlite',
// connection: {
// filename: path.join(__dirname, '..', '..', env('DATABASE_FILENAME', '.tmp/data.db')),
// },
// useNullAsDefault: true,
// },
}); });

File diff suppressed because it is too large Load Diff

@ -9,12 +9,16 @@
"build": "strapi build", "build": "strapi build",
"strapi": "strapi" "strapi": "strapi"
}, },
"devDependencies": {}, "overrides": {
"@strapi/strapi": "4.5.4"
},
"dependencies": { "dependencies": {
"@strapi/strapi": "4.5.4",
"@strapi/plugin-users-permissions": "4.5.4",
"@strapi/plugin-i18n": "4.5.4", "@strapi/plugin-i18n": "4.5.4",
"better-sqlite3": "7.4.6" "@strapi/plugin-users-permissions": "4.5.4",
"@strapi/strapi": "4.5.4",
"@strapi/utils": "^4.5.6",
"better-sqlite3": "7.4.6",
"strapi-plugin-menus": "^1.2.1"
}, },
"author": { "author": {
"name": "A Strapi developer" "name": "A Strapi developer"

@ -0,0 +1,20 @@
services:
gs_postgres:
image: postgres:14-alpine
container_name: gs_postgres
shm_size: '4gb'
environment:
POSTGRES_USER: ${DATABASE_USERNAME}
POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
POSTGRES_DB: ${DATABASE_NAME}
TZ: Europe/Paris
healthcheck:
test: 'PGPASSWORD="${DATABASE_PASSWORD}" psql --host ${DATABASE_HOST} --username ${DATABASE_USERNAME} --dbname ${DATABASE_NAME} -c "select 1" ; [ "0" -eq "$$?" ]; echo $$?'
interval: 30s
timeout: 10s
retries: 3
volumes:
- gs_postgres-master:/var/lib/postgresql/data:z
- ./.db/init:/docker-entrypoint-initdb.d
ports:
- ${DATABASE_PORT}:5432 # DB

@ -0,0 +1,25 @@
services:
# PostgreSQL (Database)
gs_postgres:
extends:
file: apps/backend/postgres.yml
service: gs_postgres
gs_redis:
image: "redis:alpine"
ports:
- "6379:6379"
gs_redis_commander:
image: rediscommander/redis-commander:latest
environment:
- REDIS_HOSTS=local:gs_redis:6379
ports:
- "8081:8081"
depends_on:
- gs_redis
volumes:
gs_postgres-master:
driver: local

@ -3,7 +3,10 @@
"version": "0.0.0", "version": "0.0.0",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"start:docker": "env $(cat apps/backend/.env) docker-compose up -d",
"install:backend": "cd apps/backend && npm install",
"build:backend": "cd apps/backend && npm run build", "build:backend": "cd apps/backend && npm run build",
"predevelop:backend": "npm run start:docker && npm run build:backend",
"develop:backend": "cd apps/backend && npm run develop", "develop:backend": "cd apps/backend && npm run develop",
"start": "nx serve", "start": "nx serve",
"build": "nx build", "build": "nx build",

Loading…
Cancel
Save