Fix listening ports. Add swarm mode and update instructions on README.md

This commit is contained in:
Tha14 2022-12-13 20:28:55 +02:00
parent 6f38a09dc0
commit 9a7cc49cee
No known key found for this signature in database
GPG Key ID: C2B875C3A9D53CFC
4 changed files with 85 additions and 2 deletions

View File

@ -1,6 +1,7 @@
# Run UAM in a Docker container # Run UAM in a Docker container
## How to use ## How to use
### Single UAM instance
1. Make sure you have docker and docker-compose installed on your host. 1. Make sure you have docker and docker-compose installed on your host.
2. Clone this repository. 2. Clone this repository.
3. Add your Public Key by editing the docker-compose.yml file. Add it to the variable named `PBKEY` without spaces. 3. Add your Public Key by editing the docker-compose.yml file. Add it to the variable named `PBKEY` without spaces.
@ -8,6 +9,15 @@
```docker-compose up -d``` ```docker-compose up -d```
### UAM Swarm
1. Make sure you have docker and docker-compose installed on your host.
2. Clone this repository.
3. Add your Public Key by editing the docker-compose.yml file. Add it to the variable named `PBKEY` without spaces for each service.
4. Optionally, add or remove services according to your needs. You can copy and paste the existing services and modify the names, paths, and ports for each.
5. Execute the following command in terminal while being in the `uam-swarm` directory of this repository:
```docker-compose up -d```
## Information ## Information
This container will download the latest version of uam every time it is started. This container will download the latest version of uam every time it is started and will install apt packages so keep that in mind.
The http service is enabled for 127.0.0.1:17099. The http service for uam is enabled and listening on http://127.0.0.1:17099 for the single instance. For the UAM swarm you need to define the listening port for each instance.

View File

@ -0,0 +1,59 @@
version: '3.3'
services:
uam_1:
image: debian:bullseye-slim
container_name: uam_1
hostname: uam_1
restart: unless-stopped
stop_grace_period: 5s
ulimits:
rtprio: 95
memlock: -1
volumes:
- "./entrypoint.sh:/opt/entrypoint.sh"
- "/opt/uam_data/uam_1:/root/.uam"
command: /bin/sh -c "chmod +x /opt/entrypoint.sh && /opt/entrypoint.sh $${PBKEY}"
ports:
- "127.0.0.1:17100:17099"
- "4160:4160"
environment:
- PBKEY=
uam_2:
image: debian:bullseye-slim
container_name: uam_2
hostname: uam_2
restart: unless-stopped
stop_grace_period: 5s
ulimits:
rtprio: 95
memlock: -1
volumes:
- "./entrypoint.sh:/opt/entrypoint.sh"
- "/opt/uam_data/uam_2:/root/.uam"
command: /bin/sh -c "chmod +x /opt/entrypoint.sh && /opt/entrypoint.sh $${PBKEY}"
ports:
- "127.0.0.1:17101:17099"
- "4161:4160"
environment:
- PBKEY=
uam_3:
image: debian:bullseye-slim
container_name: uam_3
hostname: uam_3
restart: unless-stopped
stop_grace_period: 5s
ulimits:
rtprio: 95
memlock: -1
volumes:
- "./entrypoint.sh:/opt/entrypoint.sh"
- "/opt/uam_data/uam_3:/root/.uam"
command: /bin/sh -c "chmod +x /opt/entrypoint.sh && /opt/entrypoint.sh $${PBKEY}"
ports:
- "127.0.0.1:17102:17099"
- "4162:4160"
environment:
- PBKEY=

11
uam-swarm/entrypoint.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
cd /tmp
apt update && apt -yq install wget libglib2.0-0 ca-certificates dnsmasq
update-ca-certificates
wget https://update.u.is/downloads/uam/linux/uam-latest_amd64.deb
dpkg -i uam-latest_amd64.deb
cd /opt/uam/
echo "[net]" >> /root/.uam/uam.ini
container_ip="$(hostname -i)"
echo "listens=[${container_ip}]:4160" >> /root/.uam/uam.ini
./uam --pk $1 --http [0.0.0.0]:17099 --no-ui

View File

@ -5,4 +5,7 @@ update-ca-certificates
wget https://update.u.is/downloads/uam/linux/uam-latest_amd64.deb wget https://update.u.is/downloads/uam/linux/uam-latest_amd64.deb
dpkg -i uam-latest_amd64.deb dpkg -i uam-latest_amd64.deb
cd /opt/uam/ cd /opt/uam/
echo "[net]" >> /root/.uam/uam.ini
container_ip="$(hostname -i)"
echo "listens=[${container_ip}]:4156" >> /root/.uam/uam.ini
./uam --pk $1 --http [0.0.0.0]:17099 --no-ui ./uam --pk $1 --http [0.0.0.0]:17099 --no-ui