Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.

Commit 63decbc

Browse files
committed
switch to postgres
1 parent 8b11c7b commit 63decbc

File tree

4 files changed

+152
-75
lines changed

4 files changed

+152
-75
lines changed

publish-backend/.env.example

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ ADMIN_JWT_SECRET=tobemodified
66
TRANSFER_TOKEN_SALT=tobemodified
77
JWT_SECRET=tobemodified
88

9-
# Database
9+
# Database (Postgres)
1010
DATABASE_HOST=localhost
11-
DATABASE_PORT=3306
11+
DATABASE_PORT=5432
1212
DATABASE_NAME=strapi
1313
DATABASE_USERNAME=strapi
1414
DATABASE_PASSWORD=password
1515
NODE_ENV=development
16-
DATABASE_CLIENT=mysql
16+
DATABASE_CLIENT=postgres
1717

1818
# i18n
1919
STRAPI_PLUGIN_I18N_INIT_LOCALE_CODE=en

publish-backend/docker-compose.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,17 @@ services:
3636
platform: linux/amd64 #for platform error on Apple M1 chips
3737
restart: unless-stopped
3838
env_file: .env
39-
image: mysql:8.0
40-
command: --default-authentication-plugin=mysql_native_password
39+
image: postgres:14-alpine
4140
environment:
42-
MYSQL_USER: ${DATABASE_USERNAME}
43-
MYSQL_ROOT_PASSWORD: ${DATABASE_PASSWORD}
44-
MYSQL_PASSWORD: ${DATABASE_PASSWORD}
45-
MYSQL_DATABASE: ${DATABASE_NAME}
41+
POSTGRES_USER: ${DATABASE_USERNAME}
42+
POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
43+
POSTGRES_DB: ${DATABASE_NAME}
4644
volumes:
47-
- ./data:/var/lib/mysql # use a bind folder ./data
45+
- strapi-data:/var/lib/postgresql/data/ #using a volume
46+
# - ./data:/var/lib/postgresql/data/ # if you want to use a bind folder
47+
4848
ports:
49-
- "3306:3306"
49+
- "5432:5432"
5050
networks:
5151
- strapi
5252

publish-backend/package-lock.json

+140-63
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

publish-backend/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"better-sqlite3": "8.5.0",
2121
"eleventy-plugin-error-overlay": "^1.0.0",
2222
"html-minifier": "^4.0.0",
23-
"mysql": "^2.18.1",
23+
"pg": "^8.11.2",
2424
"strapi-plugin-config-sync": "^1.1.2"
2525
},
2626
"author": {

0 commit comments

Comments
 (0)