diff --git a/README.md b/README.md index 800d19c..c84fb16 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Run UAM in a Docker container ## How to use +### Single UAM instance 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. @@ -8,6 +9,15 @@ ```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 -This container will download the latest version of uam every time it is started. -The http service is enabled for 127.0.0.1:17099. +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 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. diff --git a/uam-swarm/docker-compose.yml b/uam-swarm/docker-compose.yml new file mode 100644 index 0000000..a772f8d --- /dev/null +++ b/uam-swarm/docker-compose.yml @@ -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= diff --git a/uam-swarm/entrypoint.sh b/uam-swarm/entrypoint.sh new file mode 100755 index 0000000..5d2aca3 --- /dev/null +++ b/uam-swarm/entrypoint.sh @@ -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 diff --git a/uam/entrypoint.sh b/uam/entrypoint.sh index e33c745..75d97cd 100755 --- a/uam/entrypoint.sh +++ b/uam/entrypoint.sh @@ -5,4 +5,7 @@ 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}]:4156" >> /root/.uam/uam.ini ./uam --pk $1 --http [0.0.0.0]:17099 --no-ui