Skip to content

Commit 9231172

Browse files
authored
Merge pull request #109 from fledge-iot/3.1.0RC
3.1.0RC
2 parents e088041 + e2e7f00 commit 9231172

File tree

13 files changed

+299
-174
lines changed

13 files changed

+299
-174
lines changed

docker/Dockerfile

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
ARG arch=x86_64
2+
ARG version=20.04
3+
FROM --platform=linux/${arch} ubuntu:${version}
4+
5+
LABEL maintainer="[email protected]"
6+
LABEL org.opencontainers.image.title="Fledge IIoT Platform"
7+
LABEL org.opencontainers.image.description="Fledge IIoT platform featuring secure execution for a non-root fledge user."
8+
9+
# Define build-time arguments
10+
ARG arch
11+
ARG version
12+
ARG package_version=nightly
13+
ARG default_packages="fledge fledge-gui"
14+
ARG packages=""
15+
ARG USERNAME=fledge
16+
ARG UID=1001
17+
ARG GID=1001
18+
19+
# Define environment variables
20+
ENV FLEDGE_ROOT=/usr/local/fledge \
21+
SYSLOG_UDP_ENABLED=True
22+
23+
# Set shell to bash for script compatibility
24+
SHELL ["/bin/bash", "-c"]
25+
26+
# Copy setup scripts
27+
COPY setup.sh nginx.conf /tmp/
28+
29+
# fledge packages setup
30+
RUN set -e && \
31+
os_version="ubuntu${version//./}" && \
32+
# Append user-supplied packages to default packages
33+
if [[ -n "${packages}" ]]; then \
34+
all_packages="${default_packages} ${packages}"; \
35+
else \
36+
all_packages="${default_packages}"; \
37+
fi && \
38+
/tmp/setup.sh "${USERNAME}" \
39+
"http://archives.fledge-iot.org/${package_version}/${os_version}/${arch}/" \
40+
"${UID}" "${GID}" "${all_packages}" && \
41+
rm -f /tmp/setup.sh
42+
43+
# Set user context and working directory
44+
USER ${UID}:${GID}
45+
WORKDIR /home/${USERNAME}
46+
47+
# Expose Fledge ports
48+
EXPOSE 8081 1995 8080 5140
49+
50+
# Default command
51+
CMD ["bash", "start.sh"]

docker/Dockerfile.ubuntu1804

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

docker/Dockerfile.ubuntu2004

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

docker/README.md

Lines changed: 20 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,41 @@
1-
## Installation
2-
3-
### macOS & Windows
4-
5-
Install Docker CE for Mac and Windows (http://docker.com)
6-
7-
### Ubuntu
8-
9-
To install Docker CE follow the instructions given here:
10-
11-
https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/
12-
13-
### Red Hat Enterprise Linux (RHEL)
1+
### Build Fledge image
142

153
```
16-
sudo yum install yum-utils
17-
sudo yum-config-manager --enable rhui-REGION-rhel-server-extras
18-
sudo yum install docker
19-
sudo systemctl daemon-reload
20-
sudo systemctl restart docker
4+
$ docker build --no-cache --tag fledge:latest-ubuntu2004 -f Dockerfile .
215
```
22-
### Build fledge image
6+
7+
Default will be built with the latest stable release.
238

249
```
25-
$ docker build --tag fledge:dev --build-arg FLEDGE_BRANCH=develop -f Dockerfile.ubuntu1804 .
10+
$ docker build --tag fledge:nightly-ubuntu2004-aarch64 --build-arg version=20.04 --build-arg arch=aarch64 --build-arg package_version=nightly --build-arg packages="fledge-south-lathe fledge-south-sinusoid fledge-north-http-north" -f Dockerfile .
2611
```
2712

28-
where name of the image is fledge, FLEDGE_BRANCH is the branch to build (develop, main, 1.5.2 ,etc)
13+
The image is referred to as fledge, and it is tagged as nightly-ubuntu2004-aarch64. The package_version denotes the version of the packages, such as latest, nightly, fixes/FOGL-XXXX.
2914

30-
### Run container
15+
##### Build Arguments:
3116

17+
a) **version** - The name of the Ubuntu version is either 18.04 or 20.04. By default, the version is 20.04.
3218

33-
```
34-
$ docker run -d -v ~/fledge-data:/usr/local/fledge/data --name fledge -p 8081:8081 -p 1995:1995 -p 8082:80 fledge:dev
35-
```
19+
b) **arch** - The Ubuntu architecture is designated as either x86_64 or aarch64. The default architecture is x86_64.
3620

37-
-d : run fledge container in detached mode
38-
-v : maps host volume /fledge-data to container volume /usr/local/fledge/data
39-
--name : name of the container (fledge)
40-
-p : map the port of host machine (8081) and container (:8081)
41-
fledge : name of the image created in earlier step
21+
c) **package_version** - The package version can be either the latest, nightly, or fixes/FOGL-XXXX. By default, it is set to nightly.
22+
23+
d) **packages** - A compilation of packages delineated by spaces. For instance, packages="fledge-south-lathesim fledge-south-sinusoid fledge-north-http-north".
24+
25+
e) **USERNAME** - Name of the non-root user. By default, it is fledge.
4226

43-
> To attach to a running conatiner: `docker exec -it fledge bash`
4427

45-
`--network host` mode makes the container use the host's network stack.
28+
### Run container
29+
4630

47-
### Stopping docker container
4831
```
49-
$ docker stop fledge
32+
$ docker run -d --name fledge -p 8081:8081 -p 1995:1995 -p 8082:80 fledge:nightly-ubuntu2004-aarch64
5033
```
5134

52-
> Note: The files in fledge-data directory are created by container which creates/runs them as root user. In order to read the fledge.db, you need to change the permission of fledge.db* files, sudo chmod 666 fledge.db*
53-
54-
### notes...
35+
-d : run fledge container in detached mode
36+
-p : map the ports, e.g host machine (8081) to container (:8081)
5537

56-
docker save -o fledge-dev.tar fledge:dev
5738

39+
To attach to a running container: `docker exec -it fledge bash`
5840

59-
docker load < fledge-dev.tar.gz
60-
docker load --input fledge-dev.tar.gz
6141

62-
docker run -d -v ~/fledge-data:/usr/local/fledge/data --name fledge -p 8081:8081 -p 1995:1995 -p 8082:80 fledge:dev
63-
docker run -d --name fledge -p 8081:8081 -p 1995:1995 -p 8082:80 fledge:dev

docker/nginx.conf

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Use a system-level or least-privileged user
2+
user fledge;
3+
4+
# Specify where to store the PID
5+
pid /tmp/nginx.pid;
6+
7+
# Tune worker processes (usually equal to CPU cores)
8+
worker_processes auto;
9+
10+
events {
11+
worker_connections 1024;
12+
# Consider enabling multi_accept for high-load scenarios
13+
# multi_accept on;
14+
}
15+
16+
http {
17+
include /etc/nginx/mime.types;
18+
default_type application/octet-stream;
19+
20+
# Enable access and error logs (adjust paths as needed)
21+
access_log /var/log/nginx/access.log;
22+
error_log /var/log/nginx/error.log warn;
23+
24+
# Optimize file transfer and reduce latency
25+
sendfile on;
26+
tcp_nopush on;
27+
tcp_nodelay on;
28+
29+
keepalive_timeout 65;
30+
31+
# Gzip compression for better performance
32+
gzip on;
33+
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
34+
35+
server {
36+
listen 80 default_server;
37+
server_name localhost;
38+
39+
root /var/www/html;
40+
index fledge.html;
41+
42+
location / {
43+
try_files $uri $uri/ =404;
44+
}
45+
46+
# Optional: custom error pages
47+
error_page 404 /404.html;
48+
error_page 500 502 503 504 /50x.html;
49+
50+
location = /50x.html {
51+
root /usr/share/nginx/html;
52+
}
53+
}
54+
}

0 commit comments

Comments
 (0)