User Tools

Site Tools


user:jan001:nigdocu:aufbau

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
user:jan001:nigdocu:aufbau [2020/08/03 12:28] jan001user:jan001:nigdocu:aufbau [2021/08/24 17:35] (current) – external edit 127.0.0.1
Line 20: Line 20:
   - Docker   - Docker
   - Docker-Compose   - Docker-Compose
-  - Node+  - Node & npm
   - Nginx Reverse Proxy   - Nginx Reverse Proxy
  
 === Installation === === Installation ===
-  - Ordered List Item+  - Hier herunterladen: {{ :user:jan001:nigdocu:nigenv.zip |Download NIG}} 
 +  - Im Home-Verzeichnis eines sudo-Users entpacken 
 +  - bcryptjs installieren. Wird benötigt für das Passwort von nodered. <code>npm i bcryptjs</code> 
 +  - Die für die Domain in Nginx genutzte sites-available-Datei editieren. <code>nano /etc/nginx/sites-available/eolab.de</code> 
 +  - Es sollte bereits ein SSL-Zertifikat für die Domain/Subdomain existieren. 
 +  - Am unteren Ende diesen Code-Schnipsel einfügen: <code> server { 
 +  listen 443 ssl http2; 
 +  listen [::]:443 ssl http2; 
 +  server_name nig.eolab.de;
  
 +  ssl_certificate /etc/letsencrypt/live/nig.eolab.de-0001/fullchain.pem;
 +  ssl_certificate_key /etc/letsencrypt/live/nig.eolab.de-0001/privkey.pem;
 +  include snippets/ssl-params.conf;
 +
 +  include /etc/nginx/nigs/*.conf;
 +}
 +</code>
 +   - Im nginx-Ordner einen Ordner nigs erstellen. <code>mkdir /etc/nginx/nigs</code>
 +
 +==== Nutzung ====
 + Im newNIG.sh-Script einfach alle Variablen nach eigenen Vorstellungen editieren. Es muss selbst darauf geachtet werden, dass sich sowohl die Ports als auch die ROOT-Namen unterscheiden. Es wird nichts überprüft. Dies sollte in einer nächsten Version implementiert werden. Leicht planen lässt sich dies bspw. mit einer Excel Tabelle. Danach das Script mit sudo ausführen und das neue NIG wird erstellt.
  
  
-<file sh nig.sh> 
-# Define all variables 
-DOMAIN="nig.eolab.de" 
-ROOT="groupX" 
-NODE_RED_USERNAME="groupX" 
-NODE_RED_PASSWORD="password" 
-NODERED_PORT=17609 
-GRAFANA_PORT=17709 
-GRAFANA_USERNAME="groupX" 
-GRAFANA_PASSWORD="password" 
-# Generate the hash for the password 
-NODE_RED_PASSWORD=$(echo $(node -e "console.log(require('bcryptjs').hashSync(process.argv[1], 8));" $NODE_RED_PASSWORD) | sed s/[$]$ 
-# Copy all the base-nig files to a new directory 
-cp -r ./base-nig/ ./nig-environments/$ROOT/ 
-# Edit the docker-compose file for the new environment 
-sed -i "s/{{ROOT}}/$ROOT/g" ./nig-environments/$ROOT/docker-compose.yml 
-sed -i "s/{{NODE_RED_USERNAME}}/$NODE_RED_USERNAME/g" ./nig-environments/$ROOT/docker-compose.yml 
-sed -i "s|{{NODE_RED_PASSWORD}}|$NODE_RED_PASSWORD|g" ./nig-environments/$ROOT/docker-compose.yml 
-sed -i "s/{{GRAFANA_USERNAME}}/$GRAFANA_USERNAME/g" ./nig-environments/$ROOT/docker-compose.yml 
-sed -i "s/{{GRAFANA_PASSWORD}}/$GRAFANA_PASSWORD/g" ./nig-environments/$ROOT/docker-compose.yml 
-sed -i "s/{{GRAFANA_PORT}}/$GRAFANA_PORT/g" ./nig-environments/$ROOT/docker-compose.yml 
-sed -i "s/{{NODERED_PORT}}/$NODERED_PORT/g" ./nig-environments/$ROOT/docker-compose.yml 
-# Edit grafana.ini for the new environment 
-sed -i "s/{{ROOT}}/$ROOT/g" ./nig-environments/$ROOT/grafana.ini 
-sed -i "s/{{DOMAIN}}/$DOMAIN/g" ./nig-environments/$ROOT/grafana.ini 
-# Copy base-nginx config to nginx-nig folder 
-cp -r ./base-nginx/base-nig.conf "/etc/nginx/nigs/$ROOT.conf" 
-# Edit the base-nginx config 
-sed -i "s/{{ROOT}}/$ROOT/g" "/etc/nginx/nigs/$ROOT.conf" 
-sed -i "s/{{GRAFANA_PORT}}/$GRAFANA_PORT/g" "/etc/nginx/nigs/$ROOT.conf" 
-sed -i "s/{{NODERED_PORT}}/$NODERED_PORT/g" "/etc/nginx/nigs/$ROOT.conf" 
-# No need to edit the node_red settings.js -> it works with environment variables (is already modified tho) 
-# Make the data for all ubuntu-users available 
-sudo chmod -R 777 ./nig-environments/$ROOT 
-# Start the NIG-Environment 
-cd ./nig-environments/$ROOT 
-sudo docker-compose up -d 
-# The persitent volumes are now created but not accessible for docker 
-sudo docker-compose stop 
-# Otherwise the persistent storage is not available for docker 
-sudo chmod -R 777 ./ 
-# Now it has access and can be started 
-sudo docker-compose up -d 
-# Restart nginx 
-sudo systemctl restart nginx 
-# Otherwise the persistent storage is not available for docker 
-sudo chmod -R 777 ./ 
-</file> 
  
user/jan001/nigdocu/aufbau.1596450525.txt.gz · Last modified: 2021/08/24 17:34 (external edit)