x
This commit is contained in:
1 parent
938cee871d
commit
913cbef765
7 files changed
+49
-49
No files matched your search
+23
-23
@@ -5,14 +5,14 @@
|
|||||||
## Target
|
## Target
|
||||||
|
|
||||||
- Project name: `ddc`
|
- Project name: `ddc`
|
||||||
- Website: `https://ddc.kitizone.com`
|
- Website: `https://ddc.kittisak.com`
|
||||||
- SPA: `https://spa.ddc.kitizone.com`
|
- SPA: `https://spa.ddc.kittisak.com`
|
||||||
- Admin: `https://admin.ddc.kitizone.com`
|
- Admin: `https://admin.ddc.kittisak.com`
|
||||||
- API: `https://api.ddc.kitizone.com`
|
- API: `https://api.ddc.kittisak.com`
|
||||||
- Database: `ddcdb`
|
- Database: `ddcdb`
|
||||||
- Website SSR port: `3004`
|
- Website SSR port: `3004`
|
||||||
- Backend API port: `3053`
|
- Backend API port: `3053`
|
||||||
- Bare repo: `/home/ti/git/ddc.git`
|
- Bare repo: `/home/ti/git/ddc-website.git`
|
||||||
- Backend path: `/home/ti/projects/ddc-api`
|
- Backend path: `/home/ti/projects/ddc-api`
|
||||||
- Website path: `/home/ti/projects/ddc-website`
|
- Website path: `/home/ti/projects/ddc-website`
|
||||||
- SPA static path: `/home/ti/projects/MyNginxMain/nginx/html/ddc/spa`
|
- SPA static path: `/home/ti/projects/MyNginxMain/nginx/html/ddc/spa`
|
||||||
@@ -22,10 +22,10 @@
|
|||||||
|
|
||||||
- `serverinfo/ddc-post-receive`
|
- `serverinfo/ddc-post-receive`
|
||||||
- `serverinfo/ddc-backend.env.example`
|
- `serverinfo/ddc-backend.env.example`
|
||||||
- `serverinfo/ddc-nginx/ddc.kitizone.com.conf`
|
- `serverinfo/ddc-nginx/ddc.kittisak.com.conf`
|
||||||
- `serverinfo/ddc-nginx/spa.ddc.kitizone.com.conf`
|
- `serverinfo/ddc-nginx/spa.ddc.kittisak.com.conf`
|
||||||
- `serverinfo/ddc-nginx/admin.ddc.kitizone.com.conf`
|
- `serverinfo/ddc-nginx/admin.ddc.kittisak.com.conf`
|
||||||
- `serverinfo/ddc-nginx/api.ddc.kitizone.com.conf`
|
- `serverinfo/ddc-nginx/api.ddc.kittisak.com.conf`
|
||||||
|
|
||||||
## Preflight On Server
|
## Preflight On Server
|
||||||
|
|
||||||
@@ -41,8 +41,8 @@ If ports `3004` or `3053` are already used, stop and choose new ports before app
|
|||||||
## 1. Create Bare Git Repository
|
## 1. Create Bare Git Repository
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
mkdir -p /home/ti/git/ddc.git
|
mkdir -p /home/ti/git/ddc-website.git
|
||||||
cd /home/ti/git/ddc.git
|
cd /home/ti/git/ddc-website.git
|
||||||
git init --bare
|
git init --bare
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -78,10 +78,10 @@ cd /home/ti/projects/MyNginxMain
|
|||||||
docker compose stop nginx
|
docker compose stop nginx
|
||||||
|
|
||||||
docker compose run --rm certbot certonly --standalone \
|
docker compose run --rm certbot certonly --standalone \
|
||||||
-d ddc.kitizone.com \
|
-d ddc.kittisak.com \
|
||||||
-d spa.ddc.kitizone.com \
|
-d spa.ddc.kittisak.com \
|
||||||
-d admin.ddc.kitizone.com \
|
-d admin.ddc.kittisak.com \
|
||||||
-d api.ddc.kitizone.com
|
-d api.ddc.kittisak.com
|
||||||
```
|
```
|
||||||
|
|
||||||
## 6. Install Nginx Configs
|
## 6. Install Nginx Configs
|
||||||
@@ -127,20 +127,20 @@ serverinfo/ddc-post-receive
|
|||||||
To:
|
To:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
/home/ti/git/ddc.git/hooks/post-receive
|
/home/ti/git/ddc-website.git/hooks/post-receive
|
||||||
```
|
```
|
||||||
|
|
||||||
Then run:
|
Then run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
chmod +x /home/ti/git/ddc.git/hooks/post-receive
|
chmod +x /home/ti/git/ddc-website.git/hooks/post-receive
|
||||||
```
|
```
|
||||||
|
|
||||||
## 9. Deploy From Developer Machine
|
## 9. Deploy From Developer Machine
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git remote add ddc ti@kitizone.com:/home/ti/git/ddc.git
|
git remote add ddc-website ti@kitizone.com:/home/ti/git/ddc-website.git
|
||||||
git push ddc master
|
git push ddc-website master
|
||||||
```
|
```
|
||||||
|
|
||||||
## 10. Seed Database
|
## 10. Seed Database
|
||||||
@@ -160,10 +160,10 @@ Default seeded admin account is currently `admin / homaroma123`. Change it befor
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
pm2 list
|
pm2 list
|
||||||
curl -I https://ddc.kitizone.com
|
curl -I https://ddc.kittisak.com
|
||||||
curl -I https://spa.ddc.kitizone.com
|
curl -I https://spa.ddc.kittisak.com
|
||||||
curl -I https://admin.ddc.kitizone.com
|
curl -I https://admin.ddc.kittisak.com
|
||||||
curl -I https://api.ddc.kitizone.com
|
curl -I https://api.ddc.kittisak.com
|
||||||
```
|
```
|
||||||
|
|
||||||
Expected PM2 processes:
|
Expected PM2 processes:
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
PORT=3053
|
PORT=3053
|
||||||
DATABASE_URL="postgresql://postgres:password@localhost:5132/ddcdb?schema=public"
|
DATABASE_URL="postgresql://postgres:password@localhost:5132/ddcdb?schema=public"
|
||||||
NODE_ENV=production
|
NODE_ENV=production
|
||||||
APP_URL="https://api.ddc.kitizone.com"
|
APP_URL="https://api.ddc.kittisak.com"
|
||||||
BACKEND_PUBLIC_URL="https://api.ddc.kitizone.com"
|
BACKEND_PUBLIC_URL="https://api.ddc.kittisak.com"
|
||||||
CORS_ORIGIN="https://admin.ddc.kitizone.com,https://spa.ddc.kitizone.com,https://ddc.kitizone.com"
|
CORS_ORIGIN="https://admin.ddc.kittisak.com,https://spa.ddc.kittisak.com,https://ddc.kittisak.com"
|
||||||
JWT_SECRET="replace-with-ddc-production-secret"
|
JWT_SECRET="replace-with-ddc-production-secret"
|
||||||
OMISE_SECRET_KEY=""
|
OMISE_SECRET_KEY=""
|
||||||
+4
-4
@@ -1,6 +1,6 @@
|
|||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name admin.ddc.kitizone.com;
|
server_name admin.ddc.kittisak.com;
|
||||||
|
|
||||||
location /.well-known/acme-challenge/ {
|
location /.well-known/acme-challenge/ {
|
||||||
root /var/www/certbot;
|
root /var/www/certbot;
|
||||||
@@ -12,10 +12,10 @@ server {
|
|||||||
|
|
||||||
server {
|
server {
|
||||||
listen 443 ssl;
|
listen 443 ssl;
|
||||||
server_name admin.ddc.kitizone.com;
|
server_name admin.ddc.kittisak.com;
|
||||||
|
|
||||||
ssl_certificate /etc/letsencrypt/live/admin.ddc.kitizone.com/fullchain.pem;
|
ssl_certificate /etc/letsencrypt/live/admin.ddc.kittisak.com/fullchain.pem;
|
||||||
ssl_certificate_key /etc/letsencrypt/live/admin.ddc.kitizone.com/privkey.pem;
|
ssl_certificate_key /etc/letsencrypt/live/admin.ddc.kittisak.com/privkey.pem;
|
||||||
|
|
||||||
root /usr/share/nginx/html/ddc/admin;
|
root /usr/share/nginx/html/ddc/admin;
|
||||||
index index.html index.htm;
|
index index.html index.htm;
|
||||||
+4
-4
@@ -1,6 +1,6 @@
|
|||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name api.ddc.kitizone.com;
|
server_name api.ddc.kittisak.com;
|
||||||
|
|
||||||
location /.well-known/acme-challenge/ {
|
location /.well-known/acme-challenge/ {
|
||||||
root /var/www/certbot;
|
root /var/www/certbot;
|
||||||
@@ -12,12 +12,12 @@ server {
|
|||||||
|
|
||||||
server {
|
server {
|
||||||
listen 443 ssl;
|
listen 443 ssl;
|
||||||
server_name api.ddc.kitizone.com;
|
server_name api.ddc.kittisak.com;
|
||||||
|
|
||||||
client_max_body_size 20m;
|
client_max_body_size 20m;
|
||||||
|
|
||||||
ssl_certificate /etc/letsencrypt/live/api.ddc.kitizone.com/fullchain.pem;
|
ssl_certificate /etc/letsencrypt/live/api.ddc.kittisak.com/fullchain.pem;
|
||||||
ssl_certificate_key /etc/letsencrypt/live/api.ddc.kitizone.com/privkey.pem;
|
ssl_certificate_key /etc/letsencrypt/live/api.ddc.kittisak.com/privkey.pem;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://192.168.1.167:3053;
|
proxy_pass http://192.168.1.167:3053;
|
||||||
+4
-4
@@ -1,6 +1,6 @@
|
|||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name ddc.kitizone.com;
|
server_name ddc.kittisak.com;
|
||||||
|
|
||||||
location /.well-known/acme-challenge/ {
|
location /.well-known/acme-challenge/ {
|
||||||
root /var/www/certbot;
|
root /var/www/certbot;
|
||||||
@@ -12,10 +12,10 @@ server {
|
|||||||
|
|
||||||
server {
|
server {
|
||||||
listen 443 ssl;
|
listen 443 ssl;
|
||||||
server_name ddc.kitizone.com;
|
server_name ddc.kittisak.com;
|
||||||
|
|
||||||
ssl_certificate /etc/letsencrypt/live/ddc.kitizone.com/fullchain.pem;
|
ssl_certificate /etc/letsencrypt/live/ddc.kittisak.com/fullchain.pem;
|
||||||
ssl_certificate_key /etc/letsencrypt/live/ddc.kitizone.com/privkey.pem;
|
ssl_certificate_key /etc/letsencrypt/live/ddc.kittisak.com/privkey.pem;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://192.168.1.167:3004;
|
proxy_pass http://192.168.1.167:3004;
|
||||||
+4
-4
@@ -1,6 +1,6 @@
|
|||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name spa.ddc.kitizone.com;
|
server_name spa.ddc.kittisak.com;
|
||||||
|
|
||||||
location /.well-known/acme-challenge/ {
|
location /.well-known/acme-challenge/ {
|
||||||
root /var/www/certbot;
|
root /var/www/certbot;
|
||||||
@@ -12,10 +12,10 @@ server {
|
|||||||
|
|
||||||
server {
|
server {
|
||||||
listen 443 ssl;
|
listen 443 ssl;
|
||||||
server_name spa.ddc.kitizone.com;
|
server_name spa.ddc.kittisak.com;
|
||||||
|
|
||||||
ssl_certificate /etc/letsencrypt/live/spa.ddc.kitizone.com/fullchain.pem;
|
ssl_certificate /etc/letsencrypt/live/spa.ddc.kittisak.com/fullchain.pem;
|
||||||
ssl_certificate_key /etc/letsencrypt/live/spa.ddc.kitizone.com/privkey.pem;
|
ssl_certificate_key /etc/letsencrypt/live/spa.ddc.kittisak.com/privkey.pem;
|
||||||
|
|
||||||
root /usr/share/nginx/html/ddc/spa;
|
root /usr/share/nginx/html/ddc/spa;
|
||||||
index index.html index.htm;
|
index index.html index.htm;
|
||||||
@@ -11,7 +11,7 @@ TARGET_BACKEND="/home/ti/projects/ddc-api"
|
|||||||
TARGET_WEBSITE="/home/ti/projects/ddc-website"
|
TARGET_WEBSITE="/home/ti/projects/ddc-website"
|
||||||
|
|
||||||
# 2. REPOSITORY CONFIG
|
# 2. REPOSITORY CONFIG
|
||||||
REPO="/home/ti/git/ddc.git"
|
REPO="/home/ti/git/ddc-website.git"
|
||||||
BRANCH="master"
|
BRANCH="master"
|
||||||
TEMP_DIR="/tmp/ddc_build_$(date +%s)"
|
TEMP_DIR="/tmp/ddc_build_$(date +%s)"
|
||||||
|
|
||||||
@@ -23,8 +23,8 @@ PM2_NAME_WEBSITE="ddc-website"
|
|||||||
export PATH="$PATH:/home/ti/.bun/bin:/home/ti/.nvm/versions/node/v22.17.1/bin"
|
export PATH="$PATH:/home/ti/.bun/bin:/home/ti/.nvm/versions/node/v22.17.1/bin"
|
||||||
|
|
||||||
# 4. BUILD ENVIRONMENT
|
# 4. BUILD ENVIRONMENT
|
||||||
export VITE_API_URL="https://api.ddc.kitizone.com/api"
|
export VITE_API_URL="https://api.ddc.kittisak.com/api"
|
||||||
export NEXT_PUBLIC_API_URL="https://api.ddc.kitizone.com/api"
|
export NEXT_PUBLIC_API_URL="https://api.ddc.kittisak.com/api"
|
||||||
|
|
||||||
# Customer-specific values. Fill these in on the server if enabled.
|
# Customer-specific values. Fill these in on the server if enabled.
|
||||||
export VITE_LIFF_ID="${VITE_LIFF_ID:-}"
|
export VITE_LIFF_ID="${VITE_LIFF_ID:-}"
|
||||||
@@ -150,7 +150,7 @@ rm -rf $TEMP_DIR
|
|||||||
echo "------- ALL DEPLOYMENTS COMPLETED SUCCESSFULLY -------"
|
echo "------- ALL DEPLOYMENTS COMPLETED SUCCESSFULLY -------"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Service Summary:"
|
echo "Service Summary:"
|
||||||
echo " Website (SSR) -> https://ddc.kitizone.com (PM2: $PM2_NAME_WEBSITE, Port: $SSR_PORT)"
|
echo " Website (SSR) -> https://ddc.kittisak.com (PM2: $PM2_NAME_WEBSITE, Port: $SSR_PORT)"
|
||||||
echo " SPA -> https://spa.ddc.kitizone.com"
|
echo " SPA -> https://spa.ddc.kittisak.com"
|
||||||
echo " Admin Panel -> https://admin.ddc.kitizone.com"
|
echo " Admin Panel -> https://admin.ddc.kittisak.com"
|
||||||
echo " API Backend -> https://api.ddc.kitizone.com (PM2: $PM2_NAME_BACKEND, Port: $BACKEND_PORT)"
|
echo " API Backend -> https://api.ddc.kittisak.com (PM2: $PM2_NAME_BACKEND, Port: $BACKEND_PORT)"
|
||||||
Reference in new issue
Block a user