126 lines
3.0 KiB
Markdown
126 lines
3.0 KiB
Markdown
---
|
|
tags:
|
|
- upnote-import
|
|
---
|
|
|
|
# AppFlowy Web
|
|
|
|
# Build
|
|
|
|
Ubuntu auf Windows -> /mnt/c/work/chrka/appflowy/AppFlowy-Web
|
|
|
|
code ausführen für VS-Code auf Linux
|
|
|
|
Anleitung:
|
|
|
|
## 1\. Configuation anpassen
|
|
|
|
.env File:
|
|
|
|
```
|
|
AF_BASE_URL=https://notes.straso.com
|
|
AF_GOTRUE_URL=https://notes.straso.com/gotrue
|
|
AF_WS_URL=wss://notes.straso.com/ws/v1
|
|
# If you are using HTTPS, use wss instead of ws.
|
|
# AF_WS_URL=wss://your-domain/ws/v1
|
|
```
|
|
|
|
## 2\. Zertifikate / SSL
|
|
|
|
Dateien in Depoly Ordner kopieren:
|
|
|
|

|
|
|
|
Dockerfile um Zertifikatsdateien erweitert:
|
|
|
|
```
|
|
COPY certificate.crt /etc/nginx/ssl/certificate.crt
|
|
COPY private_key.key /etc/nginx/ssl/private_key.key
|
|
```
|
|
|
|
Zertifikate und ssl Port in nginx.conf aufnehmen:
|
|
|
|
```
|
|
# Existing server block for HTTP
|
|
server {
|
|
ssl_certificate /etc/nginx/ssl/certificate.crt;
|
|
ssl_certificate_key /etc/nginx/ssl/private_key.key;
|
|
|
|
listen 80;
|
|
listen 443 ssl;
|
|
server_name localhost;
|
|
|
|
location / {
|
|
proxy_pass http://localhost:3000;
|
|
```
|
|
|
|
## 3\. Skript-Datei anpassen
|
|
|
|
Skript-Datei start.sh für Linux kompatibel machen, indem CR LF durch LF ersetzt wird. Notpad++ \\r ersetzen durch nichts
|
|
|
|
anderfalls tritt ein Bash Fehler beim Ausführen von supervisord. Siehe Logfile supervisord /var/log/bun.err.log
|
|
|
|
# Update
|
|
|
|
```
|
|
git pull
|
|
|
|
make image
|
|
|
|
# nur image bauen:
|
|
docker build -t appflowy-web-app:latest deploy
|
|
|
|
docker run -d -p 80:80 -p 443:443 --name appflowy-web-app appflowy-web-app
|
|
```
|
|
|
|
### tag and push image
|
|
|
|
Um ein lokales Image hochzuladen, muss es entsprechend getaggt werden.
|
|
|
|
```
|
|
docker tag appflowy-web-app:latest pakabu/appflowy-web-app:latest
|
|
docker push pakabu/appflowy-web-app:latest
|
|
```
|
|
|
|
Repository auf Docker-Hub: [https://hub.docker.com/repository/docker/pakabu/appflowy-web-app/general](https://hub.docker.com/repository/docker/pakabu/appflowy-web-app/general)
|
|
|
|
# Deployment auf remote Server (Amazon)
|
|
|
|
1. Docker an Dockerhub anmelden
|
|
|
|
```
|
|
docker login
|
|
```
|
|
|
|
2. docker-compose.yaml
|
|
|
|
```
|
|
version: '3.8'
|
|
services:
|
|
app:
|
|
image: pakabu/appflowy-web-app
|
|
```
|
|
|
|
# CORS Problem
|
|
|
|
Damit af.straso.com (AppFloyWeb) auf korrekt auf notes.straso.com (AppFlowyCloud) zugreifen kann, müssen die erlauben Origins in der Cloud-Config erweitert werden.
|
|
|
|
Fehler:
|
|
|
|
> Access to XMLHttpRequest at from origin has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value 'null' that is not equal to the supplied origin.
|
|
|
|
Folgende Zeile erlaubt alle subdomains von straso.com:
|
|
|
|
> ~^https?://(.\*.)?straso.com(:\\d+)?$ $http\_origin;
|
|
|
|
```
|
|
map $http_origin $cors_origin {
|
|
# AppFlowy Web origin
|
|
~^https?://(.*\.)?straso.com(:\d+)?$ $http_origin;
|
|
"~^http://localhost:3000$" $http_origin;
|
|
default "null";
|
|
}
|
|
```
|
|
|
|
NGinx-Config: [https://github.com/AppFlowy-IO/AppFlowy/issues/5920](https://github.com/AppFlowy-IO/AppFlowy/issues/5920)
|