The build instructions in the documentation are tested for a native Linux
Machine. For MacOS or Windows consider creating a docker container build. One
of the developers uses the following devcontainer.json build environment:
Both components run in a Docker container. The Leshan server is running in a
openjdk:17-slim container and the Django server is running in a
python:3.11-slim container. This allows for an easy and reproducible setup
of the server.
Both components running in one machine using Docker Compose#
The following diagram shows the Docker Compose environment. The file
docker-compose.yml defines the services and their configuration. The file
Dockerfile.leshan defines the Leshan container and the file
Dockerfile.django defines the Django container.
Warning
Make sure to change the password to the admin console as well as other
settings like SECRET_KEY, DEBUG flag in a production environment!
The container can be build and started with the following commands:
host:~/workspace/flownexus/server$ dockercomposeup
[+] Running 2/0 ✔ Container server-leshan-1 Created 0.0s ✔ Container server-django-1 Created 0.0sAttaching to django-1, leshan-1[..]django-1 | Starting development server at http://0.0.0.0:8000/leshan-1 | [main] INFO org.eclipse.leshan.server.LeshanServer - CoAP over UDP endpoint based on Californium library available at coap://0.0.0.0:5683.leshan-1 | LeshanServer started^CGracefully stopping... (press Ctrl+C again to force)[+] Stopping 2/2 ✔ Container server-django-1 Stopped 10.3s ✔ Container server-leshan-1 Stopped 10.5s
flownexus can be deployed to a virtual server. This chapter explains a basic
setup of a virtual server with a domain name. A requirement is to have a Linux
server and a domain name. The domain name must point to the server, e.g. via a
A/AAAA-Record.
The setup has been tested with a Debian 12 server with a 1C/1GB RAM
configuration.
Leshan and the HTTPs download server for firware binaries use self-signed
certificates. The flownexus frontend uses certificates that have been issued
via Let’s Encrypt. The following commands create a self-signed certificate for
the domain flownexus.org:
Create a Certificate Authority (CA)
Generate the CA Private Key:
opensslecparam-genkey-nameprime256v1-outca.key
Create a Self-Signed CA Certificate with 100 years validity:
The following steps show how to configure Nginx as a reverse proxy for the
flownexus server. The Nginx server listens on port 443 and forwards the
requests to the Django server running on port 8000:
If you have setup an A/AAAA-Record, you can now test the download server. It is
available at https://fw.flownexus.org/binaries. If you uncomment the option
autoindexon; in the Nginx config, you can list the files in the directory.
After the setup, download flownexus and start it with using docker compose in
detached mode. Make sure to change the DEPLOY_SECRET_KEY and DEBUG flag
in the settings.py file before deploying.:
Consider
enabling the firewall and only keep required ports open:
Port 80, TCP: HTTP
Port 443, TCP: HTTPS
Port 22, TCP: SSH
Port 5683, UDP: CoAP
Warning
flownexus is not production ready. This server setup is only intended for
testing purposes.
The current flownexus configuration uses the default Django
DEPLOY_SECRET_KEY and enables the DEBUG flag. This is a security risk
and must be change before deploying.
Currently, the default django inbuild webserver is used. This is not
recommended for production use. Consider using a production-ready webserver
like Nginx or Apache.