Skip to content
This repository was archived by the owner on Jan 7, 2024. It is now read-only.

Commit 6046ab9

Browse files
authored
Merge pull request #194 from linuxserver/s6v3
2 parents 7d66005 + 5aa1ef9 commit 6046ab9

File tree

19 files changed

+59
-58
lines changed

19 files changed

+59
-58
lines changed

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# syntax=docker/dockerfile:1
22

3-
FROM ghcr.io/linuxserver/baseimage-ubuntu:focal-da661a62-ls106
3+
FROM ghcr.io/linuxserver/baseimage-ubuntu:focal
44

55
# set version label
66
ARG BUILD_DATE
@@ -33,8 +33,9 @@ RUN \
3333
fi && \
3434
mkdir -p /app && \
3535
curl -o \
36-
/app/unifi.deb -L \
36+
/tmp/unifi.deb -L \
3737
"https://dl.ui.com/unifi/${UNIFI_VERSION}/unifi_sysvinit_all.deb" && \
38+
dpkg -i /tmp/unifi.deb && \
3839
echo "**** cleanup ****" && \
3940
apt-get clean && \
4041
rm -rf \

Dockerfile.aarch64

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# syntax=docker/dockerfile:1
22

3-
FROM ghcr.io/linuxserver/baseimage-ubuntu:arm64v8-focal-da661a62-ls106
3+
FROM ghcr.io/linuxserver/baseimage-ubuntu:arm64v8-focal
44

55
# set version label
66
ARG BUILD_DATE
@@ -33,8 +33,9 @@ RUN \
3333
fi && \
3434
mkdir -p /app && \
3535
curl -o \
36-
/app/unifi.deb -L \
36+
/tmp/unifi.deb -L \
3737
"https://dl.ui.com/unifi/${UNIFI_VERSION}/unifi_sysvinit_all.deb" && \
38+
dpkg -i /tmp/unifi.deb && \
3839
echo "**** cleanup ****" && \
3940
apt-get clean && \
4041
rm -rf \

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ services:
100100
- MEM_LIMIT=1024 #optional
101101
- MEM_STARTUP=1024 #optional
102102
volumes:
103-
- <path to data>:/config
103+
- /path/to/data:/config
104104
ports:
105105
- 8443:8443
106106
- 3478:3478/udp
@@ -133,7 +133,7 @@ docker run -d \
133133
-p 8880:8880 `#optional` \
134134
-p 6789:6789 `#optional` \
135135
-p 5514:5514/udp `#optional` \
136-
-v <path to data>:/config \
136+
-v /path/to/data:/config \
137137
--restart unless-stopped \
138138
lscr.io/linuxserver/unifi-controller:latest
139139

@@ -270,6 +270,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
270270

271271
## Versions
272272

273+
* **20.02.23:** - Migrate to s6v3, install deb package on build, fix permissions.
273274
* **23.01.23:** - Exclude `run` from `/config` volume.
274275
* **30.11.22:** - Bump JRE to 11.
275276
* **01.06.22:** - Deprecate armhf.

readme-vars.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ development_versions: false
1919
param_container_name: "{{ project_name }}"
2020
param_usage_include_vols: true
2121
param_volumes:
22-
- { vol_path: "/config", vol_host_path: "<path to data>", desc: "All Unifi data stored here" }
22+
- { vol_path: "/config", vol_host_path: "/path/to/data", desc: "All Unifi data stored here" }
2323

2424
param_usage_include_ports: true
2525
param_ports:
@@ -66,6 +66,7 @@ app_setup_block: |
6666
6767
# changelog
6868
changelogs:
69+
- { date: "20.02.23:", desc: "Migrate to s6v3, install deb package on build, fix permissions."}
6970
- { date: "23.01.23:", desc: "Exclude `run` from `/config` volume."}
7071
- { date: "30.11.22:", desc: "Bump JRE to 11."}
7172
- { date: "01.06.22:", desc: "Deprecate armhf."}

root/etc/cont-init.d/15-install

Lines changed: 0 additions & 7 deletions
This file was deleted.

root/etc/cont-init.d/30-keygen

Lines changed: 0 additions & 11 deletions
This file was deleted.

root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-unifi-controller-config

Whitespace-only changes.

root/etc/s6-overlay/s6-rc.d/init-unifi-controller-config/dependencies.d/init-config

Whitespace-only changes.
Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,90 @@
11
#!/usr/bin/with-contenv bash
2+
# shellcheck shell=bash
23

34
# create our folders
45
mkdir -p \
56
/config/{data,logs}
67

7-
88
# create symlinks for config
99
symlinks=( \
1010
/usr/lib/unifi/data \
1111
/usr/lib/unifi/logs )
1212

13-
for i in "${symlinks[@]}"
14-
do
15-
[[ -L "$i" && ! "$i" -ef /config/"$(basename "$i")" ]] && unlink "$i"
16-
[[ ! -L "$i" ]] && ln -s /config/"$(basename "$i")" "$i"
13+
for i in "${symlinks[@]}"; do
14+
if [[ -L "$i" && ! "$i" -ef /config/"$(basename "$i")" ]]; then
15+
unlink "$i"
16+
fi
17+
if [[ ! -L "$i" ]]; then
18+
ln -s /config/"$(basename "$i")" "$i"
19+
fi
1720
done
1821

1922
if [[ ! -e /config/data/system.properties ]]; then
2023
cp /defaults/system.properties /config/data
2124
fi
2225

26+
# Configure memory limits
2327
if grep -q "xmx" /config/data/system.properties && grep -q "xms" /config/data/system.properties; then
24-
2528
if [[ $MEM_LIMIT == "default" ]]; then
2629
echo "*** Setting Java memory limit to default ***"
2730
sed -i "/unifi.xmx=.*/d" /config/data/system.properties
2831
elif [[ -n $MEM_LIMIT ]]; then
2932
echo "*** Setting Java memory limit to $MEM_LIMIT ***"
3033
sed -i "s/unifi.xmx=.*/unifi.xmx=$MEM_LIMIT/" /config/data/system.properties
3134
fi
32-
3335
if [[ $MEM_STARTUP == "default" ]]; then
3436
echo "*** Setting Java memory minimum to default ***"
3537
sed -i "/unifi.xms=.*/d" /config/data/system.properties
3638
elif [[ -n $MEM_STARTUP ]]; then
3739
echo "*** Setting Java memory minimum to $MEM_STARTUP ***"
3840
sed -i "s/unifi.xms=.*/unifi.xms=$MEM_STARTUP/" /config/data/system.properties
3941
fi
40-
4142
elif grep -q "xmx" /config/data/system.properties; then
42-
4343
if [[ $MEM_LIMIT == "default" ]]; then
4444
echo "*** Setting Java memory limit to default ***"
4545
sed -i "/unifi.xmx=.*/d" /config/data/system.properties
4646
elif [[ -n $MEM_LIMIT ]]; then
4747
echo "*** Setting Java memory limit to $MEM_LIMIT ***"
4848
sed -i "s/unifi.xmx=.*/unifi.xmx=$MEM_LIMIT/" /config/data/system.properties
4949
fi
50-
5150
if [[ -n $MEM_STARTUP ]]; then
5251
echo "*** Setting Java memory minimum to $MEM_STARTUP ***"
5352
echo "unifi.xms=$MEM_STARTUP" >> /config/data/system.properties
5453
fi
55-
5654
elif grep -q "xms" /config/data/system.properties; then
57-
5855
if [[ $MEM_STARTUP == "default" ]]; then
5956
echo "*** Setting Java memory minimum to default ***"
6057
sed -i "/unifi.xms=.*/d" /config/data/system.properties
6158
elif [[ -n $MEM_STARTUP ]]; then
6259
echo "*** Setting Java memory minimum to $MEM_STARTUP ***"
6360
sed -i "s/unifi.xms=.*/unifi.xms=$MEM_STARTUP/" /config/data/system.properties
6461
fi
65-
6662
if [[ -n $MEM_LIMIT ]]; then
6763
echo "*** Setting Java memory limit to $MEM_LIMIT ***"
6864
echo "unifi.xmx=$MEM_LIMIT" >> /config/data/system.properties
6965
fi
70-
7166
else
72-
7367
if [[ -n $MEM_LIMIT ]]; then
7468
echo "*** Setting Java memory limit to $MEM_LIMIT ***"
7569
echo "unifi.xmx=$MEM_LIMIT" >> /config/data/system.properties
7670
fi
77-
7871
if [[ -n $MEM_STARTUP ]]; then
7972
echo "*** Setting Java memory minimum to $MEM_STARTUP ***"
8073
echo "unifi.xms=$MEM_STARTUP" >> /config/data/system.properties
8174
fi
75+
fi
8276

77+
# generate key
78+
if [[ ! -f /config/data/keystore ]]; then
79+
keytool -genkey -keyalg RSA -alias unifi -keystore /config/data/keystore \
80+
-storepass aircontrolenterprise -keypass aircontrolenterprise -validity 3650 \
81+
-keysize 4096 -dname "cn=unifi"
8382
fi
8483

8584
# permissions
86-
chown -R abc:abc \
85+
lsiown -R abc:abc \
8786
/config \
88-
/usr/lib/unifi \
8987
/run/unifi
88+
89+
lsiown abc:abc \
90+
/config/data/keystore
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
oneshot

0 commit comments

Comments
 (0)