Skip to content

Commit a1dffb1

Browse files
committed
[add] Entry Badge of GitHub codespaces & GitPod.io
[fix] some detail bugs of Deployment configuration
1 parent 5ae9bcb commit a1dffb1

File tree

8 files changed

+82
-81
lines changed

8 files changed

+82
-81
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
README.md
22
*.example
33
node_modules/
4+
.data/
45
.editorconfig
56
.eslintrc.json
67
Dockerfile

.env.example

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
HOST=0.0.0.0
2-
PORT=1337
31
APP_KEYS="toBeModified1,toBeModified2"
42
API_TOKEN_SALT=tobemodified
5-
ADMIN_JWT_SECRET=tobemodified
63
TRANSFER_TOKEN_SALT=tobemodified
74
JWT_SECRET=tobemodified
5+
ADMIN_JWT_SECRET=tobemodified
6+
87
DATABASE_URL=postgres://user:password@host:port/database

.github/workflows/deploy-production.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
- name: Pick Docker Compose
4242
run: |
4343
mkdir ./build
44-
mv ${{ env.ARTIFACT_PATH }} ./docker-compose.yml ./start.sh ./build
44+
mv ${{ env.ARTIFACT_PATH }} .env ./docker-compose.yml ./start.sh ./build
4545
4646
- name: Transport Image
4747
uses: garygrossgarten/github-action-scp@release
@@ -61,7 +61,7 @@ jobs:
6161
command: |
6262
cd /tmp/${{ env.BOX_NAME }}
6363
mkdir -p ~/${{ env.BOX_NAME }}
64-
mv docker-compose.yml start.sh ~/${{ env.BOX_NAME }}
64+
mv .env docker-compose.yml start.sh ~/${{ env.BOX_NAME }}
6565
cd ~/${{ env.BOX_NAME }}
6666
chmod +x start.sh
6767
echo '${{ secrets.SSH_KEY }}' | sudo -S ./start.sh /tmp/${{ env.BOX_NAME }}/${{ env.ARTIFACT_PATH }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ $RECYCLE.BIN/
7070
*.sql
7171
*.sqlite
7272
*.sqlite3
73+
.data/
7374

7475

7576
############################

README.md

Lines changed: 62 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,40 @@
22

33
Strapi comes with a full featured [Command Line Interface][1] (CLI) which lets you scaffold and manage your project in seconds.
44

5-
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)][2]
6-
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)][3]
5+
[![Deploy to Production environment](https://github.com/idea2app/Strapi-PNPM-Docker-ts/actions/workflows/deploy-production.yml/badge.svg)][2]
6+
7+
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)][3]
8+
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)][4]
79

810
## 🎮 Stack
911

10-
- Programming Language: [TypeScript][4] v5+
11-
- Package Manager: [PNPM][5] v7+
12-
- Headless CMS: [Strapi][6] v4+
13-
- API specification: [Swagger][7]
14-
- Deployment Engine: [Docker][8]
15-
- CI/CD platform: [GitHub actions][9]
12+
- Programming Language: [TypeScript][5] v5+
13+
- Package Manager: [PNPM][6] v7+
14+
- Headless CMS: [Strapi][7] v4+
15+
- API specification: [Swagger][8]
16+
- Deployment Engine: [Docker][9]
17+
- CI/CD platform: [GitHub actions][10]
1618

1719
## 🔌 Pre-installed plugins
1820

1921
### Back-end
2022

21-
1. [Content Type explorer][10]
22-
2. [Data transformer][11]
23-
3. [Swagger document][12]
23+
1. [Content Type explorer][11]
24+
2. [Data transformer][12]
25+
3. [Swagger document][13]
2426

2527
### Front-end
2628

27-
1. [Color picker][13]
28-
2. [Multiple selector][14]
29-
3. [React Icons picker][15]
30-
4. [CKEditor 5][16]
29+
1. [Color picker][14]
30+
2. [Multiple selector][15]
31+
3. [React Icons picker][16]
32+
4. [CKEditor 5][17]
3133

3234
## 🚀 Scripts
3335

3436
### `develop`
3537

36-
Start your Strapi application with autoReload enabled. [Learn more][17]
38+
Start your Strapi application with autoReload enabled. [Learn more][18]
3739

3840
```shell
3941
npm i pnpm -g
@@ -43,15 +45,15 @@ pnpm develop
4345

4446
### `start`
4547

46-
Start your Strapi application with autoReload disabled. [Learn more][18]
48+
Start your Strapi application with autoReload disabled. [Learn more][19]
4749

4850
```shell
4951
npm start
5052
```
5153

5254
### `build`
5355

54-
Build your admin panel. [Learn more][19]
56+
Build your admin panel. [Learn more][20]
5557

5658
```shell
5759
pnpm build
@@ -75,56 +77,57 @@ pnpm container
7577

7678
## ⚙️ Deployment
7779

78-
Strapi gives you many possible deployment options for your project including [Strapi Cloud][20]. Browse the [deployment section of the documentation][21] to find the best solution for your use case.
80+
Strapi gives you many possible deployment options for your project including [Strapi Cloud][21]. Browse the [deployment section of the documentation][22] to find the best solution for your use case.
7981

8082
## 📚 Learn more
8183

82-
- [Resource center][22] - Strapi resource center.
83-
- [Strapi documentation][23] - Official Strapi documentation.
84-
- [Strapi tutorials][24] - List of tutorials made by the core team and the community.
85-
- [Strapi blog][25] - Official Strapi blog containing articles made by the Strapi team and the community.
86-
- [Changelog][26] - Find out about the Strapi product updates, new features and general improvements.
84+
- [Resource center][23] - Strapi resource center.
85+
- [Strapi documentation][24] - Official Strapi documentation.
86+
- [Strapi tutorials][25] - List of tutorials made by the core team and the community.
87+
- [Strapi blog][26] - Official Strapi blog containing articles made by the Strapi team and the community.
88+
- [Changelog][27] - Find out about the Strapi product updates, new features and general improvements.
8789

88-
Feel free to check out the [Strapi GitHub repository][27]. Your feedback and contributions are welcome!
90+
Feel free to check out the [Strapi GitHub repository][28]. Your feedback and contributions are welcome!
8991

9092
## ✨ Community
9193

92-
- [Discord][28] - Come chat with the Strapi community including the core team.
93-
- [Forum][29] - Place to discuss, ask questions and find answers, show your Strapi project and get feedback or just talk with other Community members.
94-
- [Awesome Strapi][30] - A curated list of awesome things related to Strapi.
94+
- [Discord][29] - Come chat with the Strapi community including the core team.
95+
- [Forum][30] - Place to discuss, ask questions and find answers, show your Strapi project and get feedback or just talk with other Community members.
96+
- [Awesome Strapi][31] - A curated list of awesome things related to Strapi.
9597

9698
---
9799

98-
🤫 Psst! [Strapi is hiring][31].
100+
🤫 Psst! [Strapi is hiring][32].
99101

100102
[1]: https://docs.strapi.io/dev-docs/cli
101-
[2]: https://codespaces.new/idea2app/Strapi-PNPM-Docker-ts
102-
[3]: https://gitpod.io/?autostart=true#https://github.com/idea2app/Strapi-PNPM-Docker-ts
103-
[4]: https://www.typescriptlang.org/
104-
[5]: https://pnpm.io/
105-
[6]: https://strapi.io/
106-
[7]: https://swagger.io/
107-
[8]: https://www.docker.com/
108-
[9]: https://github.com/features/actions
109-
[10]: https://github.com/shahriarkh/strapi-content-type-explorer
110-
[11]: https://github.com/ComfortablyCoding/strapi-plugin-transformer
111-
[12]: https://github.com/strapi/strapi/tree/develop/packages/plugins/documentation
112-
[13]: https://github.com/strapi/strapi/tree/develop/packages/plugins/color-picker
113-
[14]: https://github.com/Zaydme/strapi-plugin-multi-select
114-
[15]: https://github.com/DanielPantle/strapi-plugin-react-icons
115-
[16]: https://github.com/ckeditor/strapi-plugin-ckeditor
116-
[17]: https://docs.strapi.io/dev-docs/cli#strapi-develop
117-
[18]: https://docs.strapi.io/dev-docs/cli#strapi-start
118-
[19]: https://docs.strapi.io/dev-docs/cli#strapi-build
119-
[20]: https://cloud.strapi.io/
120-
[21]: https://docs.strapi.io/dev-docs/deployment
121-
[22]: https://strapi.io/resource-center
122-
[23]: https://docs.strapi.io/
123-
[24]: https://strapi.io/tutorials
124-
[25]: https://strapi.io/blog
125-
[26]: https://strapi.io/changelog
126-
[27]: https://github.com/strapi/strapi
127-
[28]: https://discord.strapi.io/
128-
[29]: https://forum.strapi.io/
129-
[30]: https://github.com/strapi/awesome-strapi
130-
[31]: https://strapi.io/careers
103+
[2]: https://github.com/idea2app/Strapi-PNPM-Docker-ts/actions/workflows/deploy-production.yml
104+
[3]: https://codespaces.new/idea2app/Strapi-PNPM-Docker-ts
105+
[4]: https://gitpod.io/?autostart=true#https://github.com/idea2app/Strapi-PNPM-Docker-ts
106+
[5]: https://www.typescriptlang.org/
107+
[6]: https://pnpm.io/
108+
[7]: https://strapi.io/
109+
[8]: https://swagger.io/
110+
[9]: https://www.docker.com/
111+
[10]: https://github.com/features/actions
112+
[11]: https://github.com/shahriarkh/strapi-content-type-explorer
113+
[12]: https://github.com/ComfortablyCoding/strapi-plugin-transformer
114+
[13]: https://github.com/strapi/strapi/tree/develop/packages/plugins/documentation
115+
[14]: https://github.com/strapi/strapi/tree/develop/packages/plugins/color-picker
116+
[15]: https://github.com/Zaydme/strapi-plugin-multi-select
117+
[16]: https://github.com/DanielPantle/strapi-plugin-react-icons
118+
[17]: https://github.com/ckeditor/strapi-plugin-ckeditor
119+
[18]: https://docs.strapi.io/dev-docs/cli#strapi-develop
120+
[19]: https://docs.strapi.io/dev-docs/cli#strapi-start
121+
[20]: https://docs.strapi.io/dev-docs/cli#strapi-build
122+
[21]: https://cloud.strapi.io/
123+
[22]: https://docs.strapi.io/dev-docs/deployment
124+
[23]: https://strapi.io/resource-center
125+
[24]: https://docs.strapi.io/
126+
[25]: https://strapi.io/tutorials
127+
[26]: https://strapi.io/blog
128+
[27]: https://strapi.io/changelog
129+
[28]: https://github.com/strapi/strapi
130+
[29]: https://discord.strapi.io/
131+
[30]: https://forum.strapi.io/
132+
[31]: https://github.com/strapi/awesome-strapi
133+
[32]: https://strapi.io/careers

config/database.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,23 @@ export default ({ env }) => {
2424

2525
const connections = {
2626
mysql: {
27-
connection: { ...connection, port: port || 3306, connectionString },
27+
connection: connectionString
28+
? { connectionString }
29+
: { ...connection, port: port || 3306 },
2830
pool,
2931
},
3032
mysql2: {
3133
connection: { ...connection, port: port || 3306 },
3234
pool,
3335
},
3436
postgres: {
35-
connection: {
36-
...connection,
37-
port: port || 5432,
38-
connectionString,
39-
schema: env('DATABASE_SCHEMA', 'public'),
40-
},
37+
connection: connectionString
38+
? { connectionString, schema: env('DATABASE_SCHEMA', 'public') }
39+
: {
40+
...connection,
41+
port: port || 5432,
42+
schema: env('DATABASE_SCHEMA', 'public'),
43+
},
4144
pool,
4245
},
4346
sqlite: {

docker-compose.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,16 @@ services:
77
- POSTGRES_PASSWORD=${ADMIN_JWT_SECRET}
88
volumes:
99
- ./data:/var/lib/postgresql/data/
10-
ports:
11-
- 5432:5432
1210
restart: always
1311

1412
strapi-server:
1513
depends_on:
1614
- postgres-server
1715
image: idea2app/strapi-server
1816
environment:
17+
- DATABASE_CLIENT=postgres
1918
- DATABASE_URL=postgres://postgres:${ADMIN_JWT_SECRET}@postgres-server:5432/postgres
2019
- NODE_ENV=production
21-
- PORT=1337
2220
ports:
2321
- 1337:1337
2422
healthcheck:
@@ -29,10 +27,6 @@ services:
2927
labels:
3028
- autoheal=true
3129
restart: always
32-
logging:
33-
driver: json-file
34-
options:
35-
max-size: 10m
3630

3731
autoheal:
3832
image: willfarrell/autoheal:1.2.0

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@
4141
"*.{md,json,yml,js,mjs,ts,tsx}": "prettier --write"
4242
},
4343
"scripts": {
44-
"prepare": "husky install",
44+
"prepare": "husky install || true",
4545
"test": "lint-staged",
4646
"strapi": "strapi",
4747
"clean": "rm -rf .cache/ .strapi/ dist/",
4848
"develop": "npm run clean && strapi build && strapi develop",
4949
"build": "npm run clean && cross-env NODE_ENV=production strapi build",
5050
"start": "cross-env NODE_ENV=production strapi start",
51-
"pack-image": "docker build -t strapi-server:latest .",
52-
"container": "(docker rm -f strapi-server || true) && docker run --name strapi-server -p 1337:1337 -d strapi-server:latest"
51+
"pack-image": "docker build -t idea2app/strapi-server:latest .",
52+
"container": "docker rm -f strapi-server && docker run --name strapi-server -p 1337:1337 -d idea2app/strapi-server:latest"
5353
}
5454
}

0 commit comments

Comments
 (0)