Skip to content

Commit 50e8a1b

Browse files
authored
Merge pull request #107 from FreeTAKTeam/bugfix/container-fixes
Fixing errors with the containers - Variables not set in scripts - Start script missing - Other various fixes that were preventing container startup
2 parents a439d20 + e4cf061 commit 50e8a1b

File tree

5 files changed

+33
-23
lines changed

5 files changed

+33
-23
lines changed

containers/compose.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,19 @@ services:
66
build:
77
context: .
88
dockerfile: core-pypi.Dockerfile
9+
ports:
10+
# DataPackagePort
11+
- 8080:8080
12+
# CoTPort
13+
- 8087:8087
14+
# SSLCoTPort
15+
- 8089:8089
16+
# SSLDataPackagePort
17+
- 8443:8443
18+
# FederationPort
19+
#- 9000:9000
20+
# APIPort - Don't expose by default
21+
#- 19023:19023
922
volumes:
1023
# Confused about the Z at the end?
1124
# on hosts with selinux, you will need this.
@@ -21,7 +34,10 @@ services:
2134
context: .
2235
dockerfile: ui-pypi.Dockerfile
2336
ports:
37+
# Web interface port
2438
- 5000:5000
39+
# API Port - probably don't need to expose if UI and Core are on same container network
40+
#- 19023:19023
2541
volumes:
2642
- ./ui-config:/home/freetak/data:rw,Z
2743
network_mode: "host"

containers/core-pypi.Dockerfile

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,14 @@ COPY --chown=freetak:freetak --chmod=774 core-run.sh ./
1313
ENV FTS_DATA_PATH = "/opt/fts/"
1414

1515
# Install pre-reqs then the base FTS
16-
# ruamel.yaml is very ornery and has to be force-reinstalled alone
16+
# ruamel.yaml is very ornery and has to be force-reinstalled alone until the pip deps are updated
1717
ENV PATH /home/freetak/.local/bin:$PATH
1818
RUN pip install --upgrade pip ; pip install --force-reinstall "ruamel.yaml<0.18"
1919
RUN pip install FreeTAKServer
2020

2121
# Provide a way to edit the configuration from outside the container
2222
# May need to be updated if the base image changes
2323
RUN cp $(python -m site --user-site)/FreeTAKServer/core/configuration/MainConfig.py $(python -m site --user-site)/FreeTAKServer/core/configuration/MainConfig.bak
24-
RUN mv $(python -m site --user-site)/FreeTAKServer/core/configuration/MainConfig.py /opt/fts/MainConfig.py
25-
RUN ln -s /opt/fts/MainConfig.py $(python -m site --user-site)/FreeTAKServer/core/configuration/MainConfig.py
26-
27-
# Open ports
28-
# note: docker compose documentation suggests that communication between
29-
# core and ui doesn't need a port explicitly exposed
30-
# DataPackagePort
31-
EXPOSE 8080
32-
# CoTPort
33-
EXPOSE 8087
34-
# SSLCoTPort
35-
EXPOSE 8089
36-
# SSLDataPackagePort
37-
EXPOSE 8443
38-
# FederationPort
39-
EXPOSE 9000
40-
# APIPort - Don't expose by default
41-
#EXPOSE 19023
4224

4325
VOLUME /opt/fts
4426

containers/core-run.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
#!/bin/bash
22

3+
PYTHON_USER_SITE=$(python -m site --user-site)
4+
# Detect and navigate to the python user site packages
5+
# Some systems use `python3` instead of `python` so this is not entirely portable
6+
cd "${PYTHON_USER_SITE}/FreeTAKServer/" || raise error "Could not navigate to the user-sites path. Are you using a distro that requires python3 instead of python?"
7+
38
# Sharing for MainConfig.py
49
if [[ ! -f "/opt/fts/MainConfig.py" ]]
510
then
611
cp ${PYTHON_USER_SITE}/FreeTAKServer/core/configuration/MainConfig.bak /opt/fts/MainConfig.py
712
fi
813
if [[ ! -f "${PYTHON_USER_SITE}/FreeTAKServer/core/configuration/MainConfig.py" ]]
914
then
10-
ln -s /opt/fts/MainConfig.py ${PYTHON_USER_SITE}/FreeTAKServer/core/configuration/MainConfig.py
15+
if [[ ! -f "/opt/fts/MainConfig.py" ]]
16+
then
17+
echo "MainConfig.py is missing from the expected volume!"
18+
else
19+
ln -s /opt/fts/MainConfig.py "${PYTHON_USER_SITE}/FreeTAKServer/core/configuration/MainConfig.py"
20+
fi
1121
fi
1222

1323
# Sharing for FTSConfig.yaml

containers/ui-pypi.Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@ FROM python:3.11
33
RUN groupadd -r freetak && useradd -m -r -g freetak freetak
44

55
RUN mkdir -p /home/freetak/data && chown -R freetak:freetak /home/freetak/data && chmod 777 -R /home/freetak/data && chmod g+s /home/freetak/data
6-
RUN ln -s /opt/FTSServer-UI.db /home/freetak/data/FTSServer-UI.db
6+
7+
# Link /opt to home data, as default configs put the db in /opt
8+
RUN ln -s /opt/ /home/freetak/data/
79

810
USER freetak
911
WORKDIR /home/freetak/data
1012

1113
# Install pre-reqs then the base FTS
1214
ENV PATH /home/freetak/.local/bin:/home/freetak/.local/lib:$PATH
1315

16+
# flask_cors is missing from the pip imports, so install it manually
1417
RUN pip install "flask_cors"
1518
RUN pip install FreeTAKServer-UI
1619

@@ -20,7 +23,5 @@ RUN mv $(python -m site --user-site)/FreeTAKServer-UI/config.py $(python -m site
2023
WORKDIR /home/freetak
2124
COPY --chown=freetak:freetak --chmod=774 ui-run.sh ./
2225

23-
EXPOSE 5000/tcp
24-
EXPOSE 19023/tcp
2526
VOLUME /home/freetak/data
2627
CMD ["/home/freetak/ui-run.sh"]

containers/ui-run.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/bash
2+
23
PYTHON_USER_SITE=$(python -m site --user-site)
34
# Detect and navigate to the python user site packages
45
# Some systems use `python3` instead of `python` so this is not entirely portable

0 commit comments

Comments
 (0)