Skip to content

Commit

Permalink
Add cloud demo server.
Browse files Browse the repository at this point in the history
Signed-off-by: Achim Kraus <achim.kraus@cloudcoap.net>
  • Loading branch information
boaks committed Jun 3, 2024
1 parent 9f7d5df commit cfffbd1
Show file tree
Hide file tree
Showing 44 changed files with 8,663 additions and 0 deletions.
408 changes: 408 additions & 0 deletions demo-apps/cf-cloud-demo-server/README.md

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions demo-apps/cf-cloud-demo-server/docs/cloudcoap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
92 changes: 92 additions & 0 deletions demo-apps/cf-cloud-demo-server/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?xml version='1.0' encoding='UTF-8'?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.eclipse.californium</groupId>
<artifactId>demo-apps</artifactId>
<version>3.12.0-SNAPSHOT</version>
</parent>
<artifactId>cf-cloud-demo-server</artifactId>
<packaging>jar</packaging>

<name>Cf-CloudDemoServer</name>
<description>Californium (Cf) Cloud Demo server</description>

<properties>
<assembly.mainClass>org.eclipse.californium.cloud.DemoServer</assembly.mainClass>
<skipNexusStagingDeployMojo>false</skipNexusStagingDeployMojo>
<skipStaging>false</skipStaging>
<maven.javadoc.skip>false</maven.javadoc.skip>
</properties>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>californium-core</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>scandium</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>cf-unix-health</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>info.picocli</groupId>
<artifactId>picocli</artifactId>
</dependency>
<dependency>
<groupId>com.upokecenter</groupId>
<artifactId>cbor</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>

<!-- runtime dependencies -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>demo-certs</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<!-- inherit configuration from parent POM -->
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-installed</id>
<?m2e ignore?>
<phase>install</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>cf-encrypt</artifactId>
<version>${project.version}</version>
<type>${project.packaging}</type>
</artifactItem>
</artifactItems>
<outputDirectory>target</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
66 changes: 66 additions & 0 deletions demo-apps/cf-cloud-demo-server/service/cali.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#/*******************************************************************************
# * Copyright (c) 2024 Contributors to the Eclipse Foundation.
# *
# * See the NOTICE file(s) distributed with this work for additional
# * information regarding copyright ownership.
# *
# * This program and the accompanying materials
# * are made available under the terms of the Eclipse Public License v2.0
# * and Eclipse Distribution License v1.0 which accompany this distribution.
# *
# * The Eclipse Public License is available at
# * http://www.eclipse.org/legal/epl-v20.html
# * and the Eclipse Distribution License is available at
# * http://www.eclipse.org/org/documents/edl-v10.html.
# *
# * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
# *
# ******************************************************************************/
#
# To install, cp <file> to /etc/systemd/system
#
# The value of "TasksMax" is increasing with the numbers of connectors
# according the used networkconfig.
#
# Use
# top -H
#
# to see the number of threads
#
# In order to update the service, cp the new .jar to
# /home/cali/cf-cloud-demo-server-update.jar
#
# on
# systemctl restart cali
#
# that file is copied to cf-cloud-demo-server.jar and executed.
# If cf-cloud-demo-server.jar is updated inplace when running,
# that my cause unintended exceptions, which prevents Californium
# from successfully gracefull-restart of the dtls state.
#

[Unit]
Description=Californium Cloud Demo Server
BindsTo=network-online.target
After=network-online.target
RequiresMountsFor=/home

[Service]
Type=simple
TasksMax=256
User=cali
WorkingDirectory=/home/cali
Environment="JAR=cf-cloud-demo-server.jar"
Environment="OPTS=-XX:MaxRAMPercentage=75 -Dlogback.configurationFile=./logback.xml"
Environment="ARGS1=--no-loopback --store-file=connections.bin --store-max-age=72 --store-password64=TDNLOmJTWi13JUs/YGdvNA=="
Environment="ARGS2=--device-file=demo-devices.txt --coaps-credentials ."
Environment="HTTPS_ARGS=--https-port=8080"
Environment="HTTPS_CERT_ARGS=--https-credentials=/etc/letsencrypt/live/<domain>"
ExecStartPre=/bin/cp -u cf-cloud-demo-server-update.jar ${JAR}
ExecStart=/usr/bin/java $OPTS -jar ${JAR} $ARGS1 $ARGS2 $HTTPS_ARGS $HTTPS_CERT_ARGS
RestartSec=10
Restart=always
OOMPolicy=stop

[Install]
WantedBy=multi-user.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#cloud-config

#/*******************************************************************************
# * Copyright (c) 2024 Contributors to the Eclipse Foundation.
# *
# * See the NOTICE file(s) distributed with this work for additional
# * information regarding copyright ownership.
# *
# * This program and the accompanying materials
# * are made available under the terms of the Eclipse Public License v2.0
# * and Eclipse Distribution License v1.0 which accompany this distribution.
# *
# * The Eclipse Public License is available at
# * http://www.eclipse.org/legal/epl-v20.html
# * and the Eclipse Distribution License is available at
# * http://www.eclipse.org/org/documents/edl-v10.html.
# *
# * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
# *
# ******************************************************************************/
#
# cloud-init configuration to deploy local artefacts with deploy-dev.sh

package_upgrade: true

packages:
# java - runtime for java application
- openjdk-17-jre-headless
# fail2ban - network protection
- fail2ban

snap:
commands:
- snap refresh
# public x509 certificate / letsencrypt
- snap install --classic certbot

disable_root: false

users:
- name: cali
gecos: (Cf) Californium Demo Server
lock_passwd: true

# the java application, ip-firewall and fail2ban configuration
# are applied from local storage with scp/ssh

Loading

0 comments on commit cfffbd1

Please sign in to comment.