add unit proxy on port 80

This commit is contained in:
Siwat Sirichai 2022-04-07 22:47:54 +07:00
parent 998f9a6ad8
commit 46175997e3
3 changed files with 32 additions and 0 deletions

View File

@ -19,6 +19,11 @@ RUN apt-get update && apt-get install -y \
zlib1g-dev \ zlib1g-dev \
libjpeg-dev libjpeg-dev
RUN curl --output /usr/share/keyrings/nginx-keyring.gpg https://unit.nginx.org/keys/nginx-keyring.gpg && \
echo "deb [signed-by=/usr/share/keyrings/nginx-keyring.gpg] https://packages.nginx.org/unit/ubuntu/ hirsute unit" > /etc/apt/sources.list.d/unit.list && \
echo "deb-src [signed-by=/usr/share/keyrings/nginx-keyring.gpg] https://packages.nginx.org/unit/ubuntu/ hirsute unit" >> /etc/apt/sources.list.d/unit.list
RUN apt-get -y update && apt-get -y install unit
EXPOSE 5000 EXPOSE 5000
ARG tag=master ARG tag=master

View File

@ -1,2 +1,11 @@
#Copy over Initial Printer Config
cp -n /printer.cfg /home/octoprint/.octoprint/printer.cfg cp -n /printer.cfg /home/octoprint/.octoprint/printer.cfg
#Start Unit
unitd --no-daemon --control unix:/var/run/control-unit.sock &
#Apply Primary Full Configuration
curl -X PUT --data-binary @/unitconfig.json --unix-socket /var/run/control-unit.sock http://localhost/config
#Start OctoPrint and Klipper
python3 /start.py python3 /start.py

18
unitconfig.json Normal file
View File

@ -0,0 +1,18 @@
{
"listeners": {
"*:80": {
"pass": "routes"
}
},
"routes": [
{
"match": {
"uri": "*"
},
"action": {
"proxy": "http://127.0.0.1:5000"
}
}
]
}