myems/docker-compose-de.md

3.7 KiB
Raw Blame History

Docker Compose

Erstellen und starten Sie alle Dienste mit einem einzigen Befehl

Voraussetzung

  • Installed docker, docker-compose, npm on a host.
  • Installed MySQL database with username 'root' and password '!MyEMS1'.
  • The MySQL database can be connected from the host where Docker is installed.

Konfiguration

Anmerkung: Der Host hier bezieht sich auf den Host, auf dem Docker installiert ist. Die IP und das Account-Passwort werden hier angenommen und verwendet, um Anweisungen anzuzeigen. Bitte ändern Sie sie entsprechend.

-- --
Host IP 192.168.0.1
Database IP 192.168.0.2
Database User root
Database Password !MyEMS1

Installation

  1. Repository klonen
git clone https://gitee.com/myems/myems.git 
  1. Datenbankschema importieren
cd myems/database/install
mysql -u root -p < myems_billing_baseline_db.sql
mysql -u root -p < myems_billing_db.sql
mysql -u root -p < myems_carbon_db.sql
mysql -u root -p < myems_energy_baseline_db.sql
mysql -u root -p < myems_energy_db.sql
mysql -u root -p < myems_energy_model_db.sql
mysql -u root -p < myems_fdd_db.sql
mysql -u root -p < myems_historical_db.sql
mysql -u root -p < myems_reporting_db.sql
mysql -u root -p < myems_system_db.sql
mysql -u root -p < myems_user_db.sql

Anmerkung: Siehe unter database/README.md

  1. Konfiguration ändern

AnmerkungenDie Host-IP hier angenommen ist 192.168.0.1, die Datenbank-IP ist 192.168.0.2, das Datenbank-Konto ist: root und das Datenbank-Passwort ist: !MyEMS1, bitte ändern Sie dies entsprechend

3.1 API-Adresse ändern in nginx.conf

cd myems
sed -i 's/127.0.0.1:8000/192.168.0.1:8000/g' admin/nginx.conf
sed -i 's/127.0.0.1:8000/192.168.0.1:8000/g' web/nginx.conf

3.2 Beispiel example.env bis .env und Datenbank-IP, Benutzername und Passwort in .env

cd myems
cp myems-aggregation/example.env myems-aggregation/.env
sed -i 's/127.0.0.1/192.168.0.2/g' myems-aggregation/.env
cp myems-api/example.env myems-api/.env
sed -i 's/127.0.0.1/192.168.0.2/g' myems-api/.env
cp myems-cleaning/example.env myems-cleaning/.env
sed -i 's/127.0.0.1/192.168.0.2/g' myems-cleaning/.env
cp myems-modbus-tcp/example.env myems-modbus-tcp/.env
sed -i 's/127.0.0.1/192.168.0.2/g' myems-modbus-tcp/.env
cp myems-normalization/example.env myems-normalization/.env
sed -i 's/127.0.0.1/192.168.0.2/g' myems-normalization/.env 

3.3 Upload-Ordner ändern in docker-compose.yml If Windows host, use c:\upload for volumes/source in api and admin services. If Linux host, use /upload for volumes/source in api and admin services. Make sure the upload folders in api and admin are same folder on host.

  1. Web UI erstellen
cd myems/web
npm i --unsafe-perm=true --allow-root --legacy-peer-deps
npm run build
  1. Befehl Docker-compose ausführen

On Windows Host:

cd myems
docker-compose -f docker-compose-on-windows.yml up -d 

On Linux Host:

cd myems
docker-compose -f docker-compose-on-linux.yml up -d 
  1. Verification
Address Erwartetes Ergebnis
web 192.168.0.1:80 Login erfolgreich durch Eingabe von Konto und Passwort
admin 192.168.0.1:8001 Login erfolgreich durch Eingabe von Konto und Passwort
api 192.168.0.1:8000/version Versionsinformationen zurückgeben

Wenn die API einen Fehler meldet, bestätigen Sie bitte, ob die Datenbank-IP, das Datenbankkonto und das Datenbankkennwort in .env sind korrekt. Wenn nicht, ändern Sie sie bitte und führen Sie

docker-compose up --build -d