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

Commit 7f9ae3c

Browse files
committed
Merge branch 'develop'
2 parents 55581e6 + 8768e9e commit 7f9ae3c

File tree

3 files changed

+159
-2
lines changed

3 files changed

+159
-2
lines changed

.github/README-vi.md

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
# oanhnn/laravel-echo-server
2+
3+
Alpine based [Laravel Echo Server](https://github.com/tlaverdure/laravel-echo-server) image.
4+
5+
> [English](README.md)
6+
7+
[![Build Status](https://github.com/oanhnn/docker-laravel-echo-server/workflows/CI/badge.svg)](https://github.com/oanhnn/docker-laravel-echo-server/actions)
8+
[![Software License](https://img.shields.io/github/license/oanhnn/docker-laravel-echo-server.svg)](https://github.com/oanhnn/docker-laravel-echo-server/blob/master/LICENSE)
9+
10+
## Tính năng
11+
12+
- [x] Được tạo từ Docker image gốc của NodeJS
13+
- [x] Cài đặt bản `laravel-echo-server` mới nhất
14+
- [x] Gắn nhãn theo quy định [sermatic version](https://semver.org/spec/v2.0.0.html)
15+
- [x] Tự động tạo tệp cấu hình
16+
- [x] Tự động tạo Docker image và đẩy lên Docker hub bằng GitHub Workflow
17+
18+
## Nhãn
19+
20+
Image `oanhnn/laravel-echo-server`
21+
22+
- `X.Y.Z` - the PATH version (git tag `vX.Y.Z`)
23+
- `X.Y` - the MINOR version
24+
- `X` - the MAJOR version
25+
- `latest` - the latest version
26+
27+
Image `ghcr.io/oanhnn/laravel-echo-server`
28+
29+
- `edge` - the edge version, được tạo từ code mới nhất của nhánh `master`
30+
- `nightly` - the nightly version, Được tạo hàng ngày từ code mới nhất của nhánh `master` vào 8:20 AM UTC
31+
32+
> CHÚ Ý: Hãy sử dụng sermatic version cho sản phẩm (VD: `3.1`)
33+
34+
## Yêu cầu
35+
36+
- Docker Engine 1.13+
37+
38+
## Cách sử dụng
39+
40+
### Chạy laravel-echo-server
41+
42+
Bạn có thể chạy `laravel-echo-server` như bản cài đặt bằng `npm` trên máy bởi lệnh
43+
44+
```bash
45+
$ docker run -d -p 6001:6001 -v $(pwd):/app oanhnn/laravel-echo-server
46+
```
47+
48+
49+
### Chạy lệnh con của laravel-echo-server
50+
51+
Bạn có thể chạy các lệnh con của `laravel-echo-server` như sau
52+
53+
```bash
54+
$ docker run --rm -it -v $(pwd):/app oanhnn/laravel-echo-server init
55+
$ docker run --rm -it -v $(pwd):/app oanhnn/laravel-echo-server start
56+
$ docker run --rm -it -v $(pwd):/app oanhnn/laravel-echo-server client:add
57+
$ docker run --rm -it -v $(pwd):/app oanhnn/laravel-echo-server client:remove
58+
```
59+
60+
### Chạy với docker-compose
61+
62+
Bạn có thể xem một số tệp cấu hình docker-compose mẫu trong thư mục `examples`.
63+
64+
65+
### Tự động tạo tệp cấu hình
66+
67+
Trong khi khởi chạy, container sẽ kiểm tra tệp `/app/laravel-echo-server.json` đã tồn tại chưa (có được mount vào không)?
68+
69+
- Nếu tệp `/app/laravel-echo-server.json` đã tồn tại thì nó sẽ được sử dụng.
70+
- Nếu tệp `/app/laravel-echo-server.json` không tồn tại thì nó sẽ được tạo tự đồng từ [cấu hình mặc định của laravel-echo-server](https://github.com/tlaverdure/laravel-echo-server/blob/master/README.md#configurable-options).
71+
- Nếu tệp `/app/laravel-echo-server.json` không tồn tại và bạn muốn tạo nó bằng một tiến trình khác, bạn hãy thiết lập biến môi trường `LARAVEL_ECHO_SERVER_GENERATE_CONFIG` bằng `false` (mặc định là `true`).
72+
73+
```bash
74+
$ docker run -d -p 6001:6001 -v $(pwd):/app -e "LARAVEL_ECHO_SERVER_GENERATE_CONFIG=false" oanhnn/laravel-echo-server
75+
```
76+
77+
78+
### Cấu hình cở sở dữ liệu
79+
80+
Cở sở dữ liệu có thể là `redis` hoặc `sqlite`.
81+
Nó có thể được cấu hình thông qua biến môi trường `LARAVEL_ECHO_SERVER_DB` (mạc định là `redis`).
82+
83+
84+
- Bởi mặc đinh, Redis sẽ được sử dụng. Bạn có thể cấu hình Redis bởi các biến môi trường:
85+
86+
```json
87+
"databaseConfig": {
88+
"redis": {
89+
"host": "REDIS_HOST",
90+
"port": "REDIS_PORT",
91+
"password": "REDIS_PASSWORD",
92+
"keyPrefix": "REDIS_PREFIX",
93+
"options": {
94+
"db": "REDIS_DB"
95+
}
96+
}
97+
},
98+
```
99+
100+
| Biến môi trường | Giá trị mặc định |
101+
|:---------------------|:--------------------|
102+
| `REDIS_HOST` | `redis` |
103+
| `REDIS_PORT` | `6379` |
104+
| `REDIS_PASSWORD` | `NULL` |
105+
| `REDIS_PREFIX` | `laravel_database_` |
106+
| `REDIS_DB` | `0` |
107+
108+
> CHÚ Ý: Các biến môi trường này chỉ dùng khi tạo tệp cấu hình cho `laravel-echo-server`. Bạn cũng có thể sử dụng các biến môi trường để ghi đè các thiết lập của tệp cấu hình bằng các biến môi trường ở phần sau.
109+
110+
- Bạn có thể dử dụng SQLite làm cơ sở dữ liệu bởi thiết lập biến môi trường `LARAVEL_ECHO_SERVER_DB` thành `sqlite`.
111+
Lúc này cở sở dữ liệu sẽ được lưu trowng thư mục `/app/database/` của container.
112+
113+
```bash
114+
$ docker run -d -p 6001:6001 -v $(pwd):/app -e "LARAVEL_ECHO_SERVER_DB=sqlite" oanhnn/laravel-echo-server
115+
```
116+
117+
118+
### Ghi đè các thiết lập của tệp cấu hình bằng các biến môi trường
119+
120+
Một số biến môi trường khi tồn tại (kể cả tải từ tệp `/app/.env`), nó sẽ ghi đè các thiết lập của tập cấu hình theo như bảng sau:
121+
122+
| Biến môi trường | Cấu hình bị ghi đè | Chú ý |
123+
|:-------------------------------------|:--------------------------------|:-----|
124+
| `LARAVEL_ECHO_SERVER_AUTH_HOST` | `authHost` | Nếu không tồn tại nó sẽ nhận giá trị từ biến `LARAVEL_ECHO_SERVER_HOST` nếu được thiết lập |
125+
| `LARAVEL_ECHO_SERVER_HOST` | `host` | |
126+
| `LARAVEL_ECHO_SERVER_PORT` | `port` | |
127+
| `LARAVEL_ECHO_SERVER_DEBUG` | `devMode` | |
128+
| `LARAVEL_ECHO_SERVER_REDIS_HOST` | `databaseConfig.redis.host` | |
129+
| `LARAVEL_ECHO_SERVER_REDIS_PORT` | `databaseConfig.redis.port` | |
130+
| `LARAVEL_ECHO_SERVER_REDIS_PASSWORD` | `databaseConfig.redis.password` | |
131+
| `LARAVEL_ECHO_SERVER_PROTO` | `protocol` | |
132+
| `LARAVEL_ECHO_SERVER_SSL_KEY` | `sslKeyPath` | |
133+
| `LARAVEL_ECHO_SERVER_SSL_CERT` | `sslCertPath` | |
134+
| `LARAVEL_ECHO_SERVER_SSL_PASS` | `sslPassphrase` | |
135+
| `LARAVEL_ECHO_SERVER_SSL_CHAIN` | `sslCertChainPath` | |
136+
137+
Bạn có thể xem thêm thông tin về ghi đè thiết lập cấu hình bằng biến môi trường ở [đây](https://github.com/tlaverdure/laravel-echo-server/blob/master/README.md#dotenv)
138+
139+
140+
## Đóng góp
141+
142+
Mọi mã nguồn đóng góp phải thông qua một pull request và được đồng ý bởi một trong các người phát triển chính trước khi được hợp nhất.
143+
Điều này nhằm đảm bảo mọi mã nguồn đều được xem xét cẩn thận.
144+
145+
Fork dự án, tạo nhánh tính năng và gửi một pull request.
146+
147+
Nếu bạn muốn giúp đỡ, hãy tìm kiếm trong [danh sách các vấn đề](https://github.com/oanhnn/docker-laravel-echo-server/issues).
148+
149+
## Giấy phép
150+
151+
Dự án này được phát hành dưới giấy phép mã nguồn mở MIT.
152+
Bản quyền thuộc © 2020 [Oanh Nguyen](https://github.com/oanhnn)
153+
Xem file [License](https://github.com/oanhnn/docker-laravel-echo-server/blob/master/LICENSE) để biết thêm thông tin.

.github/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Alpine based [Laravel Echo Server](https://github.com/tlaverdure/laravel-echo-server) image.
44

5+
> [Tiếng Việt](README-vi.md)
6+
57
[![Build Status](https://github.com/oanhnn/docker-laravel-echo-server/workflows/CI/badge.svg)](https://github.com/oanhnn/docker-laravel-echo-server/actions)
68
[![Software License](https://img.shields.io/github/license/oanhnn/docker-laravel-echo-server.svg)](https://github.com/oanhnn/docker-laravel-echo-server/blob/master/LICENSE)
79

@@ -72,7 +74,7 @@ See some examples in `examples` folder.
7274

7375
### Configure database
7476

75-
The database may be `redis` of `sqlite`.
77+
The database may be `redis` or `sqlite`.
7678
It be configured by environment variable `LARAVEL_ECHO_SERVER_DB` (default is `redis`).
7779

7880

@@ -100,6 +102,8 @@ It be configured by environment variable `LARAVEL_ECHO_SERVER_DB` (default is `r
100102
| `REDIS_PREFIX` | `laravel_database_` |
101103
| `REDIS_DB` | `0` |
102104

105+
> NOTE: These environment variables use only when generate `laravel-echo-server.json` file. You can use environment variables to override config, please see [next section](#override-config-by-environment-variables).
106+
103107
- You can use SQLite database by set environment variable `LARAVEL_ECHO_SERVER_DB` to `sqlite`.
104108
The SQLite file will store in `/app/database/`
105109

bin/docker-entrypoint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fi
1212

1313
# laravel-echo-server <sub-command>
1414
if [[ "$1" == 'start' ]] || [[ "$1" == 'client:add' ]] || [[ "$1" == 'client:remove' ]]; then
15-
if [[ "${GENERATE_CONFIG:-true}" == "false" ]]; then
15+
if [[ "${LARAVEL_ECHO_SERVER_GENERATE_CONFIG:-true}" == "false" ]]; then
1616
# wait for another process to inject the config
1717
echo -n "Waiting for /app/laravel-echo-server.json"
1818
while [[ ! -f /app/laravel-echo-server.json ]]; do

0 commit comments

Comments
 (0)