- Muchas notas - Fran Acién

20231218 - OpenC3 (COSMOS) in the cloud

Is the same as 20231003 - COSMOS on the cloud but usint openC3 that seems to be more updated that ball cosmos.

The steps are:

  1. wget https://github.com/OpenC3/cosmos/archive/refs/tags/v5.12.0.zip

  2. unzip v5.12.0.zip

  3. It is necessary to change the endpoint of the traefik to a external one, 0.0.0.0

  4. And change the configuration file to "./cosmos-traefik/traefik-allow-http.yaml:/etc/traefik/traefik.yaml"

But basically the compose is modified a bit like this:

version: "3.5"

networks:
  default:
    name: openc3-cosmos-network

services:
  openc3-minio:
    image: "${OPENC3_REGISTRY}/${OPENC3_NAMESPACE}/openc3-minio${OPENC3_IMAGE_SUFFIX}:${OPENC3_TAG}"
    # Uncomment to run unit tests against the minio server
    # ports:
    #   - "127.0.0.1:9000:9000"
    volumes:
      - "openc3-minio-v:/data"
      - "./cacert.pem:/devel/cacert.pem:z"
    command: server --address ":9000" --console-address ":9001" /data
    restart: "unless-stopped"
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"
    environment:
      MINIO_ROOT_USER: "${OPENC3_BUCKET_USERNAME}"
      MINIO_ROOT_PASSWORD: "${OPENC3_BUCKET_PASSWORD}"
      # Domain doesn't really matter but it's required. We really want the /minio path.
      # This is handled by our traefik configuration via rule: PathPrefix(`/minio`)
      # and forwarded on to the console at http://openc3-minio:9001
      MINIO_BROWSER_REDIRECT_URL: "http://openc3.com/minio"
      SSL_CERT_FILE: "/devel/cacert.pem"
      CURL_CA_BUNDLE: "/devel/cacert.pem"
      REQUESTS_CA_BUNDLE: "/devel/cacert.pem"
      NODE_EXTRA_CA_CERTS: "/devel/cacert.pem"

  openc3-redis:
    image: "${OPENC3_REGISTRY}/${OPENC3_NAMESPACE}/openc3-redis${OPENC3_IMAGE_SUFFIX}:${OPENC3_TAG}"
    volumes:
      - "openc3-redis-v:/data"
      - "./cacert.pem:/devel/cacert.pem:z"
      - "./openc3-redis/users.acl:/config/users.acl:z"
    restart: "unless-stopped"
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"
    environment:
      SSL_CERT_FILE: "/devel/cacert.pem"
      CURL_CA_BUNDLE: "/devel/cacert.pem"
      REQUESTS_CA_BUNDLE: "/devel/cacert.pem"
      NODE_EXTRA_CA_CERTS: "/devel/cacert.pem"

  openc3-redis-ephemeral:
    image: "${OPENC3_REGISTRY}/${OPENC3_NAMESPACE}/openc3-redis${OPENC3_IMAGE_SUFFIX}:${OPENC3_TAG}"
    volumes:
      - "openc3-redis-ephemeral-v:/data"
      - "./cacert.pem:/devel/cacert.pem:z"
      - "./openc3-redis/users.acl:/config/users.acl:z"
    restart: "unless-stopped"
    command: ["redis-server", "/config/redis_ephemeral.conf"]
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"
    environment:
      SSL_CERT_FILE: "/devel/cacert.pem"
      CURL_CA_BUNDLE: "/devel/cacert.pem"
      REQUESTS_CA_BUNDLE: "/devel/cacert.pem"
      NODE_EXTRA_CA_CERTS: "/devel/cacert.pem"

  openc3-cosmos-cmd-tlm-api:
    # For rootless podman - Uncomment this user line and comment out the next
    # user: 0:0
    user: "${OPENC3_USER_ID:-1000}:${OPENC3_GROUP_ID:-1000}"
    image: "${OPENC3_REGISTRY}/${OPENC3_NAMESPACE}/openc3-cosmos-cmd-tlm-api${OPENC3_IMAGE_SUFFIX}:${OPENC3_TAG}"
    restart: "unless-stopped"
    depends_on:
      - "openc3-redis"
      - "openc3-redis-ephemeral"
      - "openc3-minio"
    volumes:
      - "openc3-gems-v:/gems"
      - "./plugins:/plugins:z"
      - "./cacert.pem:/devel/cacert.pem:z"
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"
    environment:
      RAILS_ENV: "production"
      GEM_HOME: "/gems"
      PYTHONUSERBASE: "/gems/python_packages"
      OPENC3_REDIS_USERNAME: "${OPENC3_REDIS_USERNAME}"
      OPENC3_REDIS_PASSWORD: "${OPENC3_REDIS_PASSWORD}"
      OPENC3_BUCKET_USERNAME: "${OPENC3_BUCKET_USERNAME}"
      OPENC3_BUCKET_PASSWORD: "${OPENC3_BUCKET_PASSWORD}"
      OPENC3_SERVICE_PASSWORD: "${OPENC3_SERVICE_PASSWORD}"
    env_file:
      - ".env"

  openc3-cosmos-script-runner-api:
    # For rootless podman - Uncomment this user line and comment out the next
    # user: 0:0
    user: "${OPENC3_USER_ID:-1000}:${OPENC3_GROUP_ID:-1000}"
    image: "${OPENC3_REGISTRY}/${OPENC3_NAMESPACE}/openc3-cosmos-script-runner-api${OPENC3_IMAGE_SUFFIX}:${OPENC3_TAG}"
    restart: "unless-stopped"
    depends_on:
      - "openc3-redis"
      - "openc3-redis-ephemeral"
      - "openc3-minio"
    volumes:
      - "openc3-gems-v:/gems:ro"
      - "./plugins:/plugins:z"
      - "./cacert.pem:/devel/cacert.pem:z"
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"
    environment:
      RAILS_ENV: "production"
      GEM_HOME: "/gems"
      PYTHONUSERBASE: "/gems/python_packages"
      OPENC3_REDIS_USERNAME: "${OPENC3_REDIS_USERNAME}"
      OPENC3_REDIS_PASSWORD: "${OPENC3_REDIS_PASSWORD}"
      OPENC3_BUCKET_USERNAME: "${OPENC3_BUCKET_USERNAME}"
      OPENC3_BUCKET_PASSWORD: "${OPENC3_BUCKET_PASSWORD}"
      OPENC3_SR_REDIS_USERNAME: "${OPENC3_SR_REDIS_USERNAME}"
      OPENC3_SR_REDIS_PASSWORD: "${OPENC3_SR_REDIS_PASSWORD}"
      OPENC3_SR_BUCKET_USERNAME: "${OPENC3_SR_BUCKET_USERNAME}"
      OPENC3_SR_BUCKET_PASSWORD: "${OPENC3_SR_BUCKET_PASSWORD}"
      OPENC3_SERVICE_PASSWORD: "${OPENC3_SERVICE_PASSWORD}"
    env_file:
      - ".env"

  openc3-operator:
    # For rootless podman - Uncomment this user line and comment out the next
    # user: 0:0
    user: "${OPENC3_USER_ID:-1000}:${OPENC3_GROUP_ID:-1000}"
    image: "${OPENC3_REGISTRY}/${OPENC3_NAMESPACE}/openc3-operator${OPENC3_IMAGE_SUFFIX}:${OPENC3_TAG}"
    restart: "unless-stopped"
    ports:
      - "127.0.0.1:8002:8002" # Open port for incoming telemetry
    depends_on:
      - "openc3-redis"
      - "openc3-redis-ephemeral"
      - "openc3-minio"
    volumes:
      - "openc3-gems-v:/gems:ro"
      - "./plugins:/plugins:z"
      - "./cacert.pem:/devel/cacert.pem:z"
      # Add access to the entire C drive on Windows
      # - "/c:/c"
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"
    environment:
      GEM_HOME: "/gems"
      PYTHONUSERBASE: "/gems/python_packages"
      OPENC3_REDIS_USERNAME: "${OPENC3_REDIS_USERNAME}"
      OPENC3_REDIS_PASSWORD: "${OPENC3_REDIS_PASSWORD}"
      OPENC3_BUCKET_USERNAME: "${OPENC3_BUCKET_USERNAME}"
      OPENC3_BUCKET_PASSWORD: "${OPENC3_BUCKET_PASSWORD}"
      OPENC3_SERVICE_PASSWORD: "${OPENC3_SERVICE_PASSWORD}"
    env_file:
      - ".env"
    extra_hosts:
      - host.docker.internal:host-gateway

  openc3-traefik:
    image: "${OPENC3_REGISTRY}/${OPENC3_NAMESPACE}/openc3-traefik${OPENC3_IMAGE_SUFFIX}:${OPENC3_TAG}"
    volumes:
      - "./cacert.pem:/devel/cacert.pem:z"
      # - "./openc3-traefik/traefik.yaml:/etc/traefik/traefik.yaml:z"
      - "./openc3-traefik/traefik-allow-http.yaml:/etc/traefik/traefik.yaml:z"
      # - "./openc3-traefik/traefik-ssl.yaml:/etc/traefik/traefik.yaml:z"
      # - "./openc3-traefik/traefik-letsencrypt.yaml:/etc/traefik/traefik.yaml:z"
      # - "./openc3-traefik/cert.key:/etc/traefik/cert.key:z"
      # - "./openc3-traefik/cert.crt:/etc/traefik/cert.crt:z"
    ports:
      - "0.0.0.0:2900:80"
      - "0.0.0.0:2943:443"
      # - "80:80"
      # - "443:443"
    restart: "unless-stopped"
    depends_on:
      - "openc3-redis"
      - "openc3-redis-ephemeral"
      - "openc3-minio"
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"
    environment:
      SSL_CERT_FILE: "/devel/cacert.pem"
      CURL_CA_BUNDLE: "/devel/cacert.pem"
      REQUESTS_CA_BUNDLE: "/devel/cacert.pem"
      NODE_EXTRA_CA_CERTS: "/devel/cacert.pem"

  openc3-cosmos-init:
    # For rootless podman - Uncomment this user line and comment out the next
    # user: 0:0
    user: "${OPENC3_USER_ID:-1000}:${OPENC3_GROUP_ID:-1000}"
    image: "${OPENC3_REGISTRY}/${OPENC3_NAMESPACE}/openc3-cosmos-init${OPENC3_IMAGE_SUFFIX}:${OPENC3_TAG}"
    restart: on-failure
    depends_on:
      - "openc3-traefik"
      - "openc3-redis"
      - "openc3-redis-ephemeral"
      - "openc3-minio"
    volumes:
      - "openc3-gems-v:/gems"
      - "./plugins:/plugins:z"
      - "./cacert.pem:/devel/cacert.pem:z"
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"
    environment:
      GEM_HOME: "/gems"
      PYTHONUSERBASE: "/gems/python_packages"
      OPENC3_REDIS_USERNAME: "${OPENC3_REDIS_USERNAME}"
      OPENC3_REDIS_PASSWORD: "${OPENC3_REDIS_PASSWORD}"
      OPENC3_BUCKET_USERNAME: "${OPENC3_BUCKET_USERNAME}"
      OPENC3_BUCKET_PASSWORD: "${OPENC3_BUCKET_PASSWORD}"
      OPENC3_SR_BUCKET_USERNAME: "${OPENC3_SR_BUCKET_USERNAME}"
      OPENC3_SR_BUCKET_PASSWORD: "${OPENC3_SR_BUCKET_PASSWORD}"
    env_file:
      - ".env"

volumes:
  openc3-redis-v: {}
  openc3-redis-ephemeral-v: {}
  openc3-minio-v: {}
  openc3-gems-v: {}

How send telemetry with the server as a server example

In this example I am going to create a tcp_server for the telemetry in the openc3 (cosmos). The steps are the above.

  1. Check that in the operator I opened the port 8002
  2. Then import the next plugin
  3. And then run the next script in the machine:
import socket

# Create a TCP/IP socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

# Connect the socket to the server and port
server_address = ('localhost', 8002)
sock.connect(server_address)

try:
    # Prepare the binary data
    message = bytes([3, 1, 250])

    # Send data
    print('sending {!r}'.format(message))
    sock.sendall(message)

finally:
    # Close the socket
    print('closing socket')
    sock.close()

How to deploy this in the cloud with Ansible in InsightSat servers

The steps are going to be:

  1. Create a ansible proxy server to the ports of the program (2900)
  2. Modify iptables to accept connections to a port that is going to be used for the telemetry and telecommand. This port is going to be 4375.
  3. Create the file structure
  4. Add the configuration files to the file structure 5. ./cacert.pem 6. ./openc3-redis/users.acl 7. ./plugins 8. ./openc3-traefik/traefik-allow-http.yaml
  5. Deploy the openc3 with portainer, but without the cosmos-openc3-cosmos-init-1

The next code is not working yet:

version: "3.5"

networks:
  default:
    name: openc3-cosmos-network

services:
  openc3-minio:
    image: "${OPENC3_REGISTRY}/${OPENC3_NAMESPACE}/openc3-minio${OPENC3_IMAGE_SUFFIX}:${OPENC3_TAG}"
    # Uncomment to run unit tests against the minio server
    # ports:
    #   - "127.0.0.1:9000:9000"
    volumes:
      - "openc3-minio-v:/data"
      - "${CONF_CACERT}:/devel/cacert.pem:z"
    command: server --address ":9000" --console-address ":9001" /data
    restart: "unless-stopped"
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"
    environment:
      MINIO_ROOT_USER: "${OPENC3_BUCKET_USERNAME}"
      MINIO_ROOT_PASSWORD: "${OPENC3_BUCKET_PASSWORD}"
      # Domain doesn't really matter but it's required. We really want the /minio path.
      # This is handled by our traefik configuration via rule: PathPrefix(`/minio`)
      # and forwarded on to the console at http://openc3-minio:9001
      MINIO_BROWSER_REDIRECT_URL: "http://openc3.com/minio"
      SSL_CERT_FILE: "/devel/cacert.pem"
      CURL_CA_BUNDLE: "/devel/cacert.pem"
      REQUESTS_CA_BUNDLE: "/devel/cacert.pem"
      NODE_EXTRA_CA_CERTS: "/devel/cacert.pem"

  openc3-redis:
    image: "${OPENC3_REGISTRY}/${OPENC3_NAMESPACE}/openc3-redis${OPENC3_IMAGE_SUFFIX}:${OPENC3_TAG}"
    volumes:
      - "openc3-redis-v:/data"
      - "${CONF_CACERT}:/devel/cacert.pem:z"
      - "${CONF_USERS}:/config/users.acl:z"
    restart: "unless-stopped"
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"
    environment:
      SSL_CERT_FILE: "/devel/cacert.pem"
      CURL_CA_BUNDLE: "/devel/cacert.pem"
      REQUESTS_CA_BUNDLE: "/devel/cacert.pem"
      NODE_EXTRA_CA_CERTS: "/devel/cacert.pem"

  openc3-redis-ephemeral:
    image: "${OPENC3_REGISTRY}/${OPENC3_NAMESPACE}/openc3-redis${OPENC3_IMAGE_SUFFIX}:${OPENC3_TAG}"
    volumes:
      - "openc3-redis-ephemeral-v:/data"
      - "${CONF_CACERT}:/devel/cacert.pem:z"
      - "${CONF_USERS}:/config/users.acl:z"
    restart: "unless-stopped"
    command: ["redis-server", "/config/redis_ephemeral.conf"]
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"
    environment:
      SSL_CERT_FILE: "/devel/cacert.pem"
      CURL_CA_BUNDLE: "/devel/cacert.pem"
      REQUESTS_CA_BUNDLE: "/devel/cacert.pem"
      NODE_EXTRA_CA_CERTS: "/devel/cacert.pem"

  openc3-cosmos-cmd-tlm-api:
    # For rootless podman - Uncomment this user line and comment out the next
    # user: 0:0
    user: "${OPENC3_USER_ID:-1000}:${OPENC3_GROUP_ID:-1000}"
    image: "${OPENC3_REGISTRY}/${OPENC3_NAMESPACE}/openc3-cosmos-cmd-tlm-api${OPENC3_IMAGE_SUFFIX}:${OPENC3_TAG}"
    restart: "unless-stopped"
    depends_on:
      - "openc3-redis"
      - "openc3-redis-ephemeral"
      - "openc3-minio"
    volumes:
      - "openc3-gems-v:/gems"
      - "openc3-plugins-v:/plugins:z"
      - "${CONF_CACERT}:/devel/cacert.pem:z"
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"
    environment:
      RAILS_ENV: "production"
      GEM_HOME: "/gems"
      PYTHONUSERBASE: "/gems/python_packages"
      OPENC3_REDIS_USERNAME: "${OPENC3_REDIS_USERNAME}"
      OPENC3_REDIS_PASSWORD: "${OPENC3_REDIS_PASSWORD}"
      OPENC3_BUCKET_USERNAME: "${OPENC3_BUCKET_USERNAME}"
      OPENC3_BUCKET_PASSWORD: "${OPENC3_BUCKET_PASSWORD}"
      OPENC3_SERVICE_PASSWORD: "${OPENC3_SERVICE_PASSWORD}"
    env_file: "/data/cosmos/conf/.env"

  openc3-cosmos-script-runner-api:
    # For rootless podman - Uncomment this user line and comment out the next
    # user: 0:0
    user: "${OPENC3_USER_ID:-1000}:${OPENC3_GROUP_ID:-1000}"
    image: "${OPENC3_REGISTRY}/${OPENC3_NAMESPACE}/openc3-cosmos-script-runner-api${OPENC3_IMAGE_SUFFIX}:${OPENC3_TAG}"
    restart: "unless-stopped"
    depends_on:
      - "openc3-redis"
      - "openc3-redis-ephemeral"
      - "openc3-minio"
    volumes:
      - "openc3-gems-v:/gems:ro"
      - "openc3-plugins-v:/plugins:z"
      - "${CONF_CACERT}:/devel/cacert.pem:z"
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"
    environment:
      RAILS_ENV: "production"
      GEM_HOME: "/gems"
      PYTHONUSERBASE: "/gems/python_packages"
      OPENC3_REDIS_USERNAME: "${OPENC3_REDIS_USERNAME}"
      OPENC3_REDIS_PASSWORD: "${OPENC3_REDIS_PASSWORD}"
      OPENC3_BUCKET_USERNAME: "${OPENC3_BUCKET_USERNAME}"
      OPENC3_BUCKET_PASSWORD: "${OPENC3_BUCKET_PASSWORD}"
      OPENC3_SR_REDIS_USERNAME: "${OPENC3_SR_REDIS_USERNAME}"
      OPENC3_SR_REDIS_PASSWORD: "${OPENC3_SR_REDIS_PASSWORD}"
      OPENC3_SR_BUCKET_USERNAME: "${OPENC3_SR_BUCKET_USERNAME}"
      OPENC3_SR_BUCKET_PASSWORD: "${OPENC3_SR_BUCKET_PASSWORD}"
      OPENC3_SERVICE_PASSWORD: "${OPENC3_SERVICE_PASSWORD}"
    env_file: "/data/cosmos/conf/.env"

  openc3-operator:
    # For rootless podman - Uncomment this user line and comment out the next
    # user: 0:0
    user: "${OPENC3_USER_ID:-1000}:${OPENC3_GROUP_ID:-1000}"
    image: "${OPENC3_REGISTRY}/${OPENC3_NAMESPACE}/openc3-operator${OPENC3_IMAGE_SUFFIX}:${OPENC3_TAG}"
    restart: "unless-stopped"
    ports:
      - "0.0.0.0:8002:8002" # Open port for example
    depends_on:
      - "openc3-redis"
      - "openc3-redis-ephemeral"
      - "openc3-minio"
    volumes:
      - "openc3-gems-v:/gems:ro"
      - "openc3-plugins-v:/plugins:z"
      - "${CONF_CACERT}:/devel/cacert.pem:z"
      # Add access to the entire C drive on Windows
      # - "/c:/c"
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"
    environment:
      GEM_HOME: "/gems"
      PYTHONUSERBASE: "/gems/python_packages"
      OPENC3_REDIS_USERNAME: "${OPENC3_REDIS_USERNAME}"
      OPENC3_REDIS_PASSWORD: "${OPENC3_REDIS_PASSWORD}"
      OPENC3_BUCKET_USERNAME: "${OPENC3_BUCKET_USERNAME}"
      OPENC3_BUCKET_PASSWORD: "${OPENC3_BUCKET_PASSWORD}"
      OPENC3_SERVICE_PASSWORD: "${OPENC3_SERVICE_PASSWORD}"
    extra_hosts:
      - host.docker.internal:host-gateway
    env_file: "/data/cosmos/conf/.env"

  openc3-traefik:
    image: "${OPENC3_REGISTRY}/${OPENC3_NAMESPACE}/openc3-traefik${OPENC3_IMAGE_SUFFIX}:${OPENC3_TAG}"
    volumes:
      - "${CONF_CACERT}:/devel/cacert.pem:z"
      # - "./openc3-traefik/traefik.yaml:/etc/traefik/traefik.yaml:z"
      - "${CONF_TRAEFIK}:/etc/traefik/traefik.yaml:z"
      # - "./openc3-traefik/traefik-ssl.yaml:/etc/traefik/traefik.yaml:z"
      # - "./openc3-traefik/traefik-letsencrypt.yaml:/etc/traefik/traefik.yaml:z"
      # - "./openc3-traefik/cert.key:/etc/traefik/cert.key:z"
      # - "./openc3-traefik/cert.crt:/etc/traefik/cert.crt:z"
    ports:
      - "0.0.0.0:2900:80"
      - "0.0.0.0:2943:443"
      # - "80:80"
      # - "443:443"
    restart: "unless-stopped"
    depends_on:
      - "openc3-redis"
      - "openc3-redis-ephemeral"
      - "openc3-minio"
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"
    environment:
      SSL_CERT_FILE: "/devel/cacert.pem"
      CURL_CA_BUNDLE: "/devel/cacert.pem"
      REQUESTS_CA_BUNDLE: "/devel/cacert.pem"
      NODE_EXTRA_CA_CERTS: "/devel/cacert.pem"
    env_file: "/data/cosmos/conf/.env"

  openc3-cosmos-init:
    # For rootless podman - Uncomment this user line and comment out the next
    # user: 0:0
    user: "${OPENC3_USER_ID:-1000}:${OPENC3_GROUP_ID:-1000}"
    image: "${OPENC3_REGISTRY}/${OPENC3_NAMESPACE}/openc3-cosmos-init${OPENC3_IMAGE_SUFFIX}:${OPENC3_TAG}"
    restart: on-failure
    depends_on:
      - "openc3-traefik"
      - "openc3-redis"
      - "openc3-redis-ephemeral"
      - "openc3-minio"
    volumes:
      - "openc3-gems-v:/gems"
      - "openc3-plugins-v:/plugins:z"
      - "${CONF_CACERT}:/devel/cacert.pem:z"
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"
    environment:
      GEM_HOME: "/gems"
      PYTHONUSERBASE: "/gems/python_packages"
      OPENC3_REDIS_USERNAME: "${OPENC3_REDIS_USERNAME}"
      OPENC3_REDIS_PASSWORD: "${OPENC3_REDIS_PASSWORD}"
      OPENC3_BUCKET_USERNAME: "${OPENC3_BUCKET_USERNAME}"
      OPENC3_BUCKET_PASSWORD: "${OPENC3_BUCKET_PASSWORD}"
      OPENC3_SR_BUCKET_USERNAME: "${OPENC3_SR_BUCKET_USERNAME}"
      OPENC3_SR_BUCKET_PASSWORD: "${OPENC3_SR_BUCKET_PASSWORD}"
    env_file: "/data/cosmos/conf/.env"

volumes:
  openc3-redis-v:
    driver: local
    driver_opts:
      type: none
      o: bind
      device: /data/cosmos/redis
  openc3-redis-ephemeral-v:
    driver: local
    driver_opts:
      type: none
      o: bind
      device: /data/cosmos/redis-ephemeral
  openc3-minio-v:
    driver: local
    driver_opts:
      type: none
      o: bind
      device: /data/cosmos/minio
  openc3-gems-v:
    driver: local
    driver_opts:
      type: none
      o: bind
      device: /data/cosmos/gems
  openc3-plugins-v:
    driver: local
    driver_opts:
      type: none
      o: bind
      device: /data/cosmos/plugins
OPENC3_REGISTRY=docker.io
OPENC3_NAMESPACE=openc3inc
OPENC3_IMAGE_SUFFIX=
OPENC3_TAG=5.12.0
OPENC3_BUCKET_USERNAME=openc3minio
OPENC3_BUCKET_PASSWORD=openc3miniopassword
OPENC3_USER_ID=1000
OPENC3_GROUP_ID=1000
OPENC3_REDIS_USERNAME=openc3
OPENC3_REDIS_PASSWORD=openc3password
OPENC3_SERVICE_PASSWORD=openc3service
OPENC3_SR_REDIS_USERNAME=scriptrunner
OPENC3_SR_REDIS_PASSWORD=scriptrunnerpassword
OPENC3_SR_BUCKET_USERNAME=scriptrunnerminio
OPENC3_SR_BUCKET_PASSWORD=scriptrunnerminiopassword
CONF_CACERT=/data/cosmos/conf/cacert.pem
CONF_TRAEFIK=/data/cosmos/conf/traefik-allow-http.yaml
CONF_USERS=/data/cosmos/conf/users.acl

Startup logs

cosmos-5120-openc3-redis-ephemeral-1           | 1:C 18 Dec 2023 13:59:03.504 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
cosmos-5120-openc3-redis-ephemeral-1           | 1:C 18 Dec 2023 13:59:03.504 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
cosmos-5120-openc3-redis-ephemeral-1           | 1:C 18 Dec 2023 13:59:03.504 * Redis version=7.2.3, bits=64, commit=00000000, modified=0, pid=1, just started
cosmos-5120-openc3-redis-ephemeral-1           | 1:C 18 Dec 2023 13:59:03.504 * Configuration loaded
cosmos-5120-openc3-redis-ephemeral-1           | 1:M 18 Dec 2023 13:59:03.505 * monotonic clock: POSIX clock_gettime
cosmos-5120-openc3-redis-ephemeral-1           | 1:M 18 Dec 2023 13:59:03.506 * Running mode=standalone, port=6380.
cosmos-5120-openc3-redis-ephemeral-1           | 1:M 18 Dec 2023 13:59:03.508 * Server initialized
cosmos-5120-openc3-redis-ephemeral-1           | 1:M 18 Dec 2023 13:59:03.508 * Ready to accept connections tcp
cosmos-5120-openc3-redis-1                     | 1:C 18 Dec 2023 13:59:03.750 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
cosmos-5120-openc3-redis-1                     | 1:C 18 Dec 2023 13:59:03.750 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
cosmos-5120-openc3-redis-1                     | 1:C 18 Dec 2023 13:59:03.750 * Redis version=7.2.3, bits=64, commit=00000000, modified=0, pid=1, just started
cosmos-5120-openc3-redis-1                     | 1:C 18 Dec 2023 13:59:03.750 * Configuration loaded
cosmos-5120-openc3-redis-1                     | 1:M 18 Dec 2023 13:59:03.750 * monotonic clock: POSIX clock_gettime
cosmos-5120-openc3-redis-1                     | 1:M 18 Dec 2023 13:59:03.751 * Running mode=standalone, port=6379.
cosmos-5120-openc3-redis-1                     | 1:M 18 Dec 2023 13:59:03.764 * Server initialized
cosmos-5120-openc3-redis-1                     | 1:M 18 Dec 2023 13:59:03.764 * Loading RDB produced by version 7.2.3
cosmos-5120-openc3-redis-1                     | 1:M 18 Dec 2023 13:59:03.764 * RDB age 1395 seconds
cosmos-5120-openc3-redis-1                     | 1:M 18 Dec 2023 13:59:03.764 * RDB memory usage when created 1.27 Mb
cosmos-5120-openc3-redis-1                     | 1:M 18 Dec 2023 13:59:03.765 * Done loading RDB, keys loaded: 17, keys expired: 0.
cosmos-5120-openc3-redis-1                     | 1:M 18 Dec 2023 13:59:03.765 * DB loaded from disk: 0.000 seconds
cosmos-5120-openc3-redis-1                     | 1:M 18 Dec 2023 13:59:03.765 * Ready to accept connections tcp
cosmos-5120-openc3-minio-1                     | MinIO Object Storage Server
cosmos-5120-openc3-minio-1                     | Copyright: 2015-2023 MinIO, Inc.
cosmos-5120-openc3-minio-1                     | License: GNU AGPLv3 <https://www.gnu.org/licenses/agpl-3.0.html>
cosmos-5120-openc3-minio-1                     | Version: RELEASE.2023-10-07T15-07-38Z (go1.21.1 linux/amd64)
cosmos-5120-openc3-minio-1                     | 
cosmos-5120-openc3-minio-1                     | Status:         1 Online, 0 Offline. 
cosmos-5120-openc3-minio-1                     | S3-API: http://172.21.0.3:9000  http://127.0.0.1:9000 
cosmos-5120-openc3-minio-1                     | Console: http://openc3.com/minio 
cosmos-5120-openc3-minio-1                     | 
cosmos-5120-openc3-minio-1                     | Documentation: https://min.io/docs/minio/linux/index.html
cosmos-5120-openc3-minio-1                     | Warning: The standard parity is set to 0. This can lead to data loss.
cosmos-5120-openc3-minio-1                     | 
cosmos-5120-openc3-minio-1                     |  You are running an older version of MinIO released 2 months before the latest release 
cosmos-5120-openc3-minio-1                     |  Update: Run `mc admin update` 
cosmos-5120-openc3-minio-1                     | 
cosmos-5120-openc3-minio-1                     | 
cosmos-5120-openc3-cosmos-init-1               | Mon Dec 18 13:59:05 UTC 2023

Working buuuut I get one error

The basic functionality is working.… buuuuuut there is a problem with the socket that needs to be fixed.

1d4ebd0ac515c2582c864c3cbc58abd6.png

The problem seems to be that there is no connection to the socket.… why?

However, if I access through the wireguard to 10.10.0.1:2900 (that is the service over the internal network). Then it works, or at least I dont have that error.

The problem was that the nginx + traefik is giving some problem, and is necessary to do the next thing:

server {
  listen 443 ssl http2;

  server_name cosmos.insightsat.com;

  client_max_body_size 50M;

  ssl_certificate /etc/letsencrypt/live/cosmos.insightsat.com/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/cosmos.insightsat.com/privkey.pem;

  location / {
    proxy_pass http://127.0.0.1:2900;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;


    # enables WS support
    location /openc3-api/cable {
      proxy_pass http://127.0.0.1:2900;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
    }
  }

}

Known errors

  • The data is not stored after rebooting it. Only saved the interface, but not the data.
    • It seems that everything is saved it in minio volume, but i dont know how to get the data back
    • It is fixed, it was not correctly configure the user in redis

Interface

The new interface for the server to hear the data is like this:

# Set VARIABLEs here to allow variation in your plugin
# See https://cosmosc2.com/docs/v5/plugins for more information
VARIABLE simple_tcp_target_name SIMPLE_TCP

# Modify this according to your actual target connection
# See https://cosmosc2.com/docs/v5/interfaces for more information
TARGET SIMPLE_TCP <%= simple_tcp_target_name %>
INTERFACE <%= simple_tcp_target_name %>_INT tcpip_server_interface.rb 8002 8002 10.0 nil LENGTH 0 8 0 1
  MAP_TARGET <%= simple_tcp_target_name %>

I modified the working open day interface to accept cloud traffic, so i added the line from the previous script.