Обновить README.md
This commit is contained in:
parent
ba744770f1
commit
f14bb9995c
1 changed files with 87 additions and 1 deletions
86
README.md
86
README.md
|
|
@ -1,3 +1,89 @@
|
||||||
# ParleyChat
|
# ParleyChat
|
||||||
|
|
||||||
простой чат, можно обмениваться только текстом
|
простой чат, можно обмениваться только текстом
|
||||||
|
|
||||||
|
### Рекомендации
|
||||||
|
- настроить админа в бд в методе initDB()
|
||||||
|
- очиститьь переменные на всякий случай
|
||||||
|
```bash
|
||||||
|
$env:GOOS = "linux"
|
||||||
|
$env:GOARCH = "amd64"
|
||||||
|
$env:CGO_ENABLED = "0"
|
||||||
|
```
|
||||||
|
- сбилдить бинарник
|
||||||
|
```bash
|
||||||
|
go build -o parley main.go
|
||||||
|
```
|
||||||
|
|
||||||
|
- положить на сервер
|
||||||
|
- сделать его исполняемым
|
||||||
|
- написать к нему сервис и сделать enabled(см. сервис)
|
||||||
|
- настроить nginx(конфиг)
|
||||||
|
- дать nginx разрешение на чтение файлов фронта (в зависимости от того где лежит приложение - ```sudo chmod -R 755 /opt/parley/static/ и sudo chown -R www-data:www-data /opt/parley/static/ ```)
|
||||||
|
- установить sqlite: apt-get install -y sqlite3
|
||||||
|
- начать использвать
|
||||||
|
|
||||||
|
### конфиги
|
||||||
|
#### nginx /etc/nginx/sites-available/default
|
||||||
|
- СДЕЛАЙ БЭКАП ПРЕЖДЕ ЧЕМ ЧТО-ТО ДЕЛАТЬ!!!!!
|
||||||
|
```bash
|
||||||
|
# --- PARLEY CHAT ---
|
||||||
|
location = /parley {
|
||||||
|
return 301 /parley/;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /parley/ {
|
||||||
|
proxy_pass http://127.0.0.1:3100/parley/;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header X-Forwarded-Prefix /parley;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /parley/static/ {
|
||||||
|
alias /opt/parley/static/;
|
||||||
|
expires 30d;
|
||||||
|
add_header Cache-Control "public, immutable";
|
||||||
|
}
|
||||||
|
# --- PARLEY CHAT END ---
|
||||||
|
```
|
||||||
|
- проверь что изменения в nginx применились успешно и перезагрузи
|
||||||
|
```bash
|
||||||
|
sudo nginx -t
|
||||||
|
sudo systemctl reload nginx
|
||||||
|
```
|
||||||
|
#### сервис
|
||||||
|
```bash
|
||||||
|
sudo nano /etc/systemd/system/parley.service
|
||||||
|
```
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[Unit]
|
||||||
|
Description=Parley Chat Service
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
User=root
|
||||||
|
WorkingDirectory=/opt/parley
|
||||||
|
Environment="BASE_PATH=/parley"
|
||||||
|
ExecStart=/opt/parley/parley
|
||||||
|
Restart=always
|
||||||
|
RestartSec=5
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
```
|
||||||
|
##### запуск сервиса
|
||||||
|
```bash
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
sudo systemctl enable parley
|
||||||
|
sudo systemctl start parley
|
||||||
|
sudo systemctl status parley
|
||||||
|
|
||||||
|
# проверим что слушает порт
|
||||||
|
sudo netstat -tlnp | grep 3100
|
||||||
|
```
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue