This commit is contained in:
2024-12-23 00:48:03 +01:00
commit 7e7b0b5aca
12 changed files with 109 additions and 0 deletions

BIN
build/2/openems-edge.jar Normal file

Binary file not shown.

BIN
build/2/ui.zip Normal file

Binary file not shown.

1
build/2/version Normal file
View File

@ -0,0 +1 @@
2

BIN
build/3/openems-edge.jar Normal file

Binary file not shown.

BIN
build/3/ui.zip Normal file

Binary file not shown.

1
build/3/version Normal file
View File

@ -0,0 +1 @@
3

Binary file not shown.

BIN
build/latest/ui.zip Normal file

Binary file not shown.

1
build/latest/version Normal file
View File

@ -0,0 +1 @@
3

View File

@ -0,0 +1,76 @@
#! /bin/bash
RED='\033[0;31m'
YELLOW='\033[1;33m'
CYAN='\033[0;36m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
host=$(hostname)
read -p "Please enter the host (default: $host): " host_input
host=${host_input:-$host}
read -p "Do you want to set the UI as the default for this server? (yes/no): " ui_default
if [[ "$ui_default" =~ ^[Yy][Ee][Ss]$ ]]; then
echo -e "${YELLOW}WARNING: This will override the default nginx configuration.${NC}"
ui_default=true
else
ui_default=false
fi
echo -e "${GREEN}Summary of Configuration:${NC}"
echo -e "${CYAN}Host: $host${NC}"
echo -e "${CYAN}Set UI as default: ${ui_default}${NC}"
read -p "${CYAN}Do you want to proceed with the installation? (yes/no): ${NC}" proceed
if [[ ! "$proceed" =~ ^[Yy][Ee][Ss]$ ]]; then
echo -e "${RED}Installation aborted.${NC}"
exit 1
fi
echo -e "${GREEN}installing required packages...${NC}"
sudo apt-get update
sudo apt-get install -y openjdk-17-jdk
sudo apt-get install -y nginx
sudo apt-get install -y wget
echo -e "${GREEN}done${NC}"
echo -e "${GREEN}setting up openems system service...${NC}"
# setup openems service
sudo cp openems.service /etc/systemd/system/openems.service
# setup openems config dir
sudo mkdir -p /etc/openems.d
#fetch openems jar
wget -O /usr/lib/openems/openems.jar https://git.mumme-it.de/Mumme-IT/openems-build/raw/branch/main/latest/openems-edge.jar
# reload systemd and start service
sudo systemctl daemon-reload
sudo systemctl enable openems
sudo systemctl start openems
echo -e "${GREEN}done${NC}"
echo -e "${GREEN}setting up ui as default nginx site...${NC}"
sudo mkdir -p /var/www/openems/html
wget -O ~/openems-ui.zip https://git.mumme-it.de/Mumme-IT/openems-build/raw/branch/main/latest/ui.zip
sudo unzip -o ~/openems-ui.zip -d /var/www/openems/html
sudo rm ~/openems-ui.zip
sudo cp nginx-config /etc/nginx/sites-available/openems
sudo ln -sf /etc/nginx/sites-available/openems "/etc/nginx/sites-enabled/$host"
if $ui_default; then
sudo ln -sf /etc/nginx/sites-available/openems /etc/nginx/sites-enabled/default
fi
echo -e "${GREEN}done${NC}"

13
installation/nginx-config Normal file
View File

@ -0,0 +1,13 @@
server {
listen 80;
listen [::]:80;
root /var/www/openems/html;
index index.html;
server_name _;
location / {
try_files $uri $uri/ /index.html;
}
}

View File

@ -0,0 +1,17 @@
[Unit]
Description=OpenEMS Edge
After=network.target
[Service]
User=root
Group=root
Type=notify
WorkingDirectory=/usr/lib/openems
ExecStart=/usr/bin/java -Dfelix.cm.dir=/etc/openems.d/ -jar /usr/lib/openems/openems.jar
SuccessExitStatus=143
Restart=always
RestartSec=10
WatchdogSec=60
[Install]
WantedBy=multi-user.target