@cyberskill/shared 1.165.0 → 1.167.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,27 @@
1
+ ## ✅ Bước 1: Cài đặt node (nếu chưa cài)
2
+
3
+ [Xem tại đây](./setup-node.md)
4
+
5
+ ## ✅ Bước 2: Cài đặt pm2
6
+
7
+ ```
8
+ npm install pm2 -g
9
+ ```
10
+
11
+ ## ✅ Bước 3: Chạy pm2
12
+
13
+ Chạy bằng node mặc định
14
+
15
+ ```
16
+ pm2 start tên-file.js --name tên-app
17
+ ```
18
+
19
+ > ⚠️ Lưu ý: ví dụ `pm2 start index.js --name cyberskill-example`
20
+
21
+ Đối với dự án có script chạy từ package.json
22
+
23
+ ```
24
+ pm2 start pnpm --name tên-app -- run tên-script-chạy
25
+ ```
26
+
27
+ > ⚠️ Lưu ý: ví dụ `pm2 start pnpm --name cyberskill-example -- run start`
@@ -0,0 +1,17 @@
1
+ ## ✅ Bước 1: Cài đặt homebrew (nếu chưa cài)
2
+
3
+ ```
4
+ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
5
+ ```
6
+
7
+ ## ✅ Bước 2: Cài đặt redis
8
+
9
+ ```
10
+ brew install redis
11
+ ```
12
+
13
+ ## ✅ Bước 3: Chạy redis
14
+
15
+ ```
16
+ brew services start redis
17
+ ```
@@ -0,0 +1,102 @@
1
+ ## ✅ Bước 1: Cài đặt certbot
2
+
3
+ ```
4
+ sudo apt update
5
+ ```
6
+
7
+ ```
8
+ sudo apt install certbot python3-certbot-nginx
9
+ ```
10
+
11
+ ## ✅ Bước 2: Chạy certbot
12
+
13
+ ```
14
+ sudo certbot --nginx -d tên-miền
15
+ ```
16
+
17
+ > ⚠️ Lưu ý: nếu có nhiều tên miền có thể ghi liên tục, ví dụ `sudo certbot --nginx -d cyberskill.example -d api.cyberskill.example -d www.cyberskill.example`
18
+
19
+ Nếu hiện như sau là cấu hình ok
20
+ `Successfully received certificate.`
21
+ `Certificate is saved at: đường-dẫn/fullchain.pem`
22
+ `Key is saved at: đường-dẫn/privkey.pem`
23
+ `This certificate expires on năm-tháng-ngày.`
24
+ `These files will be updated when the certificate renews.`
25
+ `Certbot has set up a scheduled task to automatically renew this certificate in the background.`
26
+
27
+ ## ✅ Bước 3: Cập nhật cấu hình nginx
28
+
29
+ Ví dụ cho cấu hình Backend và Frontend
30
+
31
+ ```
32
+ server {
33
+ listen 80 default_server;
34
+ listen [::]:80 default_server;
35
+
36
+ server_name cyberskill.example www.cyberskill.example api.cyberskill.example;
37
+
38
+ return 301 https://$host$request_uri;
39
+ }
40
+
41
+ server {
42
+ listen 443 ssl;
43
+ listen [::]:443 ssl;
44
+
45
+ server_name cyberskill.example www.cyberskill.example;
46
+
47
+ ssl_certificate /etc/letsencrypt/live/cyberskill.example/fullchain.pem;
48
+ ssl_certificate_key /etc/letsencrypt/live/cyberskill.example/privkey.pem;
49
+ include /etc/letsencrypt/options-ssl-nginx.conf;
50
+ ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
51
+
52
+ location / {
53
+ proxy_pass http://localhost:port-frontend;
54
+ proxy_http_version 1.1;
55
+ proxy_set_header Upgrade $http_upgrade;
56
+ proxy_set_header Connection 'upgrade';
57
+ proxy_set_header Host $host;
58
+ proxy_cache_bypass $http_upgrade;
59
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
60
+ proxy_set_header X-Forwarded-Proto $scheme;
61
+ }
62
+ }
63
+
64
+ server {
65
+ listen 443 ssl;
66
+ listen [::]:443 ssl;
67
+
68
+ server_name api.cyberskill.example;
69
+
70
+ ssl_certificate /etc/letsencrypt/live/cyberskill.example/fullchain.pem;
71
+ ssl_certificate_key /etc/letsencrypt/live/cyberskill.example/privkey.pem;
72
+ include /etc/letsencrypt/options-ssl-nginx.conf;
73
+ ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
74
+
75
+ location / {
76
+ proxy_pass http://localhost:port-backend;
77
+ proxy_http_version 1.1;
78
+ proxy_set_header Upgrade $http_upgrade;
79
+ proxy_set_header Connection 'upgrade';
80
+ proxy_set_header Host $host;
81
+ proxy_cache_bypass $http_upgrade;
82
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
83
+ proxy_set_header X-Forwarded-Proto $scheme;
84
+ }
85
+ }
86
+ ```
87
+
88
+ ## ✅ Bước 4: Kiểm tra cấu hình
89
+
90
+ ```
91
+ sudo nginx -t
92
+ ```
93
+
94
+ Nếu hiện như sau là cấu hình ok
95
+ `nginx: the configuration file /etc/nginx/nginx.conf syntax is ok`
96
+ `nginx: configuration file /etc/nginx/nginx.conf test is successful`
97
+
98
+ ## ✅ Bước 5: Khởi động lại nginx với cấu hình mới
99
+
100
+ ```
101
+ sudo nginx -s reload
102
+ ```