Compare commits

..

8 Commits

5 changed files with 38 additions and 22 deletions

View File

@ -1,34 +1,36 @@
# Run UAM in a Docker container # Run UAM in a Docker container
[![run-docker-compose-workflow](https://github.com/Tha14/uam-docker/actions/workflows/push.yml/badge.svg)](https://github.com/Tha14/uam-docker/actions/workflows/push.yml) [![Donate CRP](https://img.shields.io/badge/Donate-CRP-blue.svg)](https://cutt.ly/C2MoaCU) [![run-docker-compose-workflow](https://github.com/Tha14/uam-docker/actions/workflows/push.yml/badge.svg)](https://github.com/Tha14/uam-docker/actions/workflows/push.yml)
##### If you find this project helpful you are welcome to make a donation.
## How to use: ## How to use:
### Single UAM instance ### 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. If you're on windows or macos, in the docker-compose.yml file, make sure you change the volume path `/opt/uam_data` to something that works on your OS. For example: on Windows something like `c/uam_data`, on macOS `${HOME}/uam_data`.
4. If you're on windows or macos, make sure you change the volume path `/opt/uam_data` to something that works on your OS. 4. Execute the following command in terminal while being in the `uam` directory of this repository:
5. Execute the following command in terminal while being in the `uam` directory of this repository:
```PBKEY={YOURKEYHERE} docker-compose up -d``` ```PBKEY={YOURKEYHERE} docker-compose up -d```
### UAM Swarm ### UAM Swarm
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 for each service. 3. If you're on windows or macos, in the docker-compose.yml file, make sure you change the volume path `/opt/uam_data/uam_` to something that works on your OS. For example: on Windows something like `c/uam_data/uam_`, on macOS `${HOME}/uam_data/uam_`.
4. If you're on windows or macos, make sure you change the volume path `/opt/uam_data/uam_` to something that works on your OS. 4. Optionally, add or remove services according to your needs. You can copy and paste the existing services and incement the names, paths, and ports for each of them.
5. 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 of them. 5. Execute the following command in terminal while being in the `uam-swarm` directory of this repository:
6. Execute the following command in terminal while being in the `uam-swarm` directory of this repository:
```PBKEY={YOURKEYHERE} docker-compose up -d``` ```PBKEY={YOURKEYHERE} docker-compose up -d```
## Information ## Important information:
1. This container will download the latest version of uam every time it is started and will install apt packages so keep that in mind. 1. This container will download the latest version of uam every time it is started and will install apt packages so keep that in mind.
2. 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. 2. 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.
3. Make sure you port forward manually as upnp will most likely not work. 3. Make sure you port forward manually as upnp will most likely not work.
4. You can adjust the maximum upload and download bandwidth of uam by changing the `NETLIMUP` and `NETLIMDOWN` env variables. 4. You can adjust the maximum upload and download bandwidth of uam by changing the `NETLIMUP` and `NETLIMDOWN` env variables.
5. I suggest using [lazydocker](https://github.com/jesseduffield/lazydocker) to control and see the status of your containers.
6. You can disable wondershaper(traffic shaping) if you're experiencing problems by setting `ENABLE_WONDERSHAPER` to `false`.
## ToDo: ## Requirements per thread:
- [x] Add CI tests to make sure the scripts work. * 4300MB free ram RAM
- [x] Make PBKEY a required variable to avoid running uam without it. * 4 CPU cores
- [x] Include wondershaper or sch_cake in `apt install` and environment configuration parameters for it. * 10Mbps upload and download bandwidth
- [ ] See if it's possible to automatically increment port numbers for the swarm script. * 100MB disk space
* 32CRP held in your wallet or delegated to you

View File

@ -12,16 +12,19 @@ services:
memlock: -1 memlock: -1
oom_score_adj: -700 oom_score_adj: -700
mem_swappiness: 10 mem_swappiness: 10
cap_add:
- NET_ADMIN
volumes: volumes:
- "./entrypoint.sh:/opt/entrypoint.sh" - "./entrypoint.sh:/opt/entrypoint.sh"
- "/opt/uam_data/uam_1:/root/.uam" - "/opt/uam_data/uam_1:/root/.uam"
command: /bin/sh -c "chmod +x /opt/entrypoint.sh && /opt/entrypoint.sh $${PBKEY} $${PPORT} $${NETLIMUP} $${NETLIMDOWN}" command: /bin/sh -c "chmod +x /opt/entrypoint.sh && /opt/entrypoint.sh $${PBKEY} $${PPORT} $${NETLIMUP} $${NETLIMDOWN} $${ENABLE_WONDERSHAPER}"
ports: ports:
- "127.0.0.1:17100:17099" - "127.0.0.1:17100:17099"
- "4160:4160" - "4160:4160"
environment: environment:
- PBKEY=${PBKEY?err} - PBKEY=${PBKEY?err}
- PPORT=4160 - PPORT=4160
- ENABLE_WONDERSHAPER=true
- NETLIMUP=10000 - NETLIMUP=10000
- NETLIMDOWN=18000 - NETLIMDOWN=18000
@ -36,16 +39,19 @@ services:
memlock: -1 memlock: -1
oom_score_adj: -700 oom_score_adj: -700
mem_swappiness: 10 mem_swappiness: 10
cap_add:
- NET_ADMIN
volumes: volumes:
- "./entrypoint.sh:/opt/entrypoint.sh" - "./entrypoint.sh:/opt/entrypoint.sh"
- "/opt/uam_data/uam_2:/root/.uam" - "/opt/uam_data/uam_2:/root/.uam"
command: /bin/sh -c "chmod +x /opt/entrypoint.sh && /opt/entrypoint.sh $${PBKEY} $${PPORT} $${NETLIMUP} $${NETLIMDOWN}" command: /bin/sh -c "chmod +x /opt/entrypoint.sh && /opt/entrypoint.sh $${PBKEY} $${PPORT} $${NETLIMUP} $${NETLIMDOWN} $${ENABLE_WONDERSHAPER}"
ports: ports:
- "127.0.0.1:17101:17099" - "127.0.0.1:17101:17099"
- "4161:4161" - "4161:4161"
environment: environment:
- PBKEY=${PBKEY?err} - PBKEY=${PBKEY?err}
- PPORT=4161 - PPORT=4161
- ENABLE_WONDERSHAPER=true
- NETLIMUP=10000 - NETLIMUP=10000
- NETLIMDOWN=18000 - NETLIMDOWN=18000
@ -60,15 +66,18 @@ services:
memlock: -1 memlock: -1
oom_score_adj: -700 oom_score_adj: -700
mem_swappiness: 10 mem_swappiness: 10
cap_add:
- NET_ADMIN
volumes: volumes:
- "./entrypoint.sh:/opt/entrypoint.sh" - "./entrypoint.sh:/opt/entrypoint.sh"
- "/opt/uam_data/uam_3:/root/.uam" - "/opt/uam_data/uam_3:/root/.uam"
command: /bin/sh -c "chmod +x /opt/entrypoint.sh && /opt/entrypoint.sh $${PBKEY} $${PPORT} $${NETLIMUP} $${NETLIMDOWN}" command: /bin/sh -c "chmod +x /opt/entrypoint.sh && /opt/entrypoint.sh $${PBKEY} $${PPORT} $${NETLIMUP} $${NETLIMDOWN} $${ENABLE_WONDERSHAPER}"
ports: ports:
- "127.0.0.1:17102:17099" - "127.0.0.1:17102:17099"
- "4162:4162" - "4162:4162"
environment: environment:
- PBKEY=${PBKEY?err} - PBKEY=${PBKEY?err}
- PPORT=4162 - PPORT=4162
- ENABLE_WONDERSHAPER=true
- NETLIMUP=10000 - NETLIMUP=10000
- NETLIMDOWN=18000 - NETLIMDOWN=18000

View File

@ -1,12 +1,14 @@
#!/bin/sh #!/bin/bash
cd /tmp cd /tmp
apt update && apt -yq install wget libglib2.0-0 ca-certificates dnsmasq wondershaper apt update && apt -yq install wget libglib2.0-0 ca-certificates dnsmasq wondershaper
update-ca-certificates update-ca-certificates
wondershaper eth0 $3 $4 &
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 echo "[net]" >> /root/.uam/uam.ini
container_ip="$(hostname -i)" container_ip="$(hostname -i)"
echo "listens=[${container_ip}]:$2" >> /root/.uam/uam.ini echo "listens=[${container_ip}]:$2" >> /root/.uam/uam.ini
if [[ "$5" == "true" ]]; then
wondershaper eth0 $3 $4 &
fi
./uam --pk $1 --http [0.0.0.0]:17099 --no-ui ./uam --pk $1 --http [0.0.0.0]:17099 --no-ui

View File

@ -17,11 +17,12 @@ services:
volumes: volumes:
- "./entrypoint.sh:/opt/entrypoint.sh" - "./entrypoint.sh:/opt/entrypoint.sh"
- "/opt/uam_data:/root/.uam" - "/opt/uam_data:/root/.uam"
command: /bin/sh -c "chmod +x /opt/entrypoint.sh && /opt/entrypoint.sh $${PBKEY} $${NETLIMUP} $${NETLIMDOWN}" command: /bin/sh -c "chmod +x /opt/entrypoint.sh && /opt/entrypoint.sh $${PBKEY} $${NETLIMUP} $${NETLIMDOWN} $${ENABLE_WONDERSHAPER}"
ports: ports:
- "127.0.0.1:17099:17099" - "127.0.0.1:17099:17099"
- "4156:4156" - "4156:4156"
environment: environment:
- PBKEY=${PBKEY?err} - PBKEY=${PBKEY?err}
- ENABLE_WONDERSHAPER=true
- NETLIMUP=10000 - NETLIMUP=10000
- NETLIMDOWN=18000 - NETLIMDOWN=18000

View File

@ -1,12 +1,14 @@
#!/bin/sh #!/bin/bash
cd /tmp cd /tmp
apt update && apt -yq install wget libglib2.0-0 ca-certificates dnsmasq wondershaper apt update && apt -yq install wget libglib2.0-0 ca-certificates dnsmasq wondershaper
update-ca-certificates update-ca-certificates
wondershaper eth0 $2 $3 &
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 echo "[net]" >> /root/.uam/uam.ini
container_ip="$(hostname -i)" container_ip="$(hostname -i)"
echo "listens=[${container_ip}]:4156" >> /root/.uam/uam.ini echo "listens=[${container_ip}]:4156" >> /root/.uam/uam.ini
if [[ "$4" == "true" ]]; then
wondershaper eth0 $2 $3 &
fi
./uam --pk $1 --http [0.0.0.0]:17099 --no-ui ./uam --pk $1 --http [0.0.0.0]:17099 --no-ui