Coder Social home page Coder Social logo

museum's Introduction

mลซsฤ“um ๐Ÿ›

An easy to use proxy server, orchestrator and serverless runtime for your web applications

What is mลซsฤ“um?

mลซsฤ“um (/muหหˆseห.um/) is a project from the University of Vienna to provide researchers with a simple way to archive and access old web applications. Often, in the course of a research project, web applications are created to provide a user interface for data collection or analysis or simply to share ones research. These applications are mostly developed quickly and with little regard for long-term maintenance. As a result, they are often difficult to access and maintain. mลซsฤ“um provides a simple way to archive and access these applications.

โš ๏ธ This application is WIP โš ๏ธ

Since there is only one person working on mลซsฤ“um, progress is kinda slow (relatively speaking - the working parts might not look like much but a lot of work up until now has been code infrastructure). As you can see, the roadmap is still quite long so I am happy for any contribution. We plan to go stable in 2025. Maybe sooner, maybe not. You can never know with publically funded projects. ๐Ÿคท

  • Starting and stopping applications
    • On Docker Swarm
    • On DIND
    • On K8s
  • Serverless runtime
    • JS
    • WASM
  • Proxy
    • HTTP
    • SSE
    • WS
  • Persistence
    • Resetting containers
    • Initial state
      • From NFS
      • From SMB
    • Data versioning
    • Application versioning
  • Metadata
    • OID
    • Metadata sources through NATS
  • Observability
    • Jaeger
    • Logging
  • CLI tooling
    • Creating exhibits
    • Deleting exhibits
    • Warming up exhibits
    • Stopping exhibits
  • UI
    • Loading screen
    • mลซsฤ“um UI

How does it work?

mลซsฤ“um is fully distributed by design. Under the hood, it uses etcd to store information on running applications (which also makes mลซsฤ“um distributed). Whenever there is a request for a specific application, mลซsฤ“um will check if the application is running within the Docker Swarm. If it is, it will forward the request to the application. If it is not, it will start the application, display a loading screen and forward the request to the application once it is ready.

Every application has to take out a "lease" on the application name. This lease is valid for a certain amount of time. If the application does not renew the lease (this is done every time mลซsฤ“um receives a request for the application), it will be removed from the Cluster. This ensures that applications that are not used for a long time will be removed from the Swarm.

How do I use it?

mลซsฤ“um is available as a Docker image. You can find the image on Docker Hub. To run mลซsฤ“um, you need to provide the following environment variables:

  • ETCD_HOST: The address of the etcd instance
  • ETCD_BASE_KEY: The base key to use for etcd (optional, defaults to museum)
  • NATS_HOST: The address of the NATS instance
  • NATS_BASE_KEY: The base key to use for NATS (optional, defaults to museum)
  • DOCKER_HOST: The address of the Docker Swarm (optional, defaults to unix:///var/run/docker.sock)
  • PROXY_MODE: The mode to use for the proxy (optional, defaults to swarm-ext)
    • swarm: Use the Docker Swarm to start applications (assumes that mลซsฤ“um is running in a Docker Swarm)
    • swarm-ext: Use the Docker Swarm to start applications (assumes that mลซsฤ“um is running outside the Docker Swarm)
  • HOSTNAME: The hostname of the mลซsฤ“um instance (optional, defaults to localhost)
  • PORT: The port to listen on (optional, defaults to 8080)
  • JAEGER_HOST: The address of the Jaeger instance (optional)
  • ENVIRONMENT: The environment mลซsฤ“um is running in (optional, defaults to development)

The proxy comes with a command line utility to manage applications. You can use it to start, stop and remove applications, etc.

As of right now, the proxy only supports Docker Swarm. We are working on adding support for Kubernetes.

Docker Swarm compose file

version: '3.7'
services:
  museum:
    image: museum:latest
    environment:
      ETCD_HOST: etcd
      DOCKER_HOST: unix:///var/run/docker.sock
      PROXY_MODE: swarm
      # PROXY_MODE: dind # if you want to use Docker in Docker
      HOSTNAME: museum
      PORT: 8080
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - "8080:8080"
    depends_on:
      - etcd
      - nats
  etcd:
    image: bitnami/etcd:latest
    environment:
      - ALLOW_NONE_AUTHENTICATION=yes
      - ETCD_ADVERTISE_CLIENT_URLS=http://etcd:2379
    ports:
      - "2379:2379"
  nats:
    image: nats:latest
    ports:
      - "4222:4222"
      - "6222:6222"
      - "8222:8222"

Exhibits

Applications are configured with so-called "exhibit" files. These files are simple YAML files that contain information on how to start the application.

spec: v1
name: my-research-project
expose: my-webapp
lease: 1h
objects:
  - name: my-database
    image: postgres
    label: 9.6
    environment:
      POSTGRES_PASSWORD: mysecretpassword
    livecheck:
      type: tcp
      config:
        port: 5432
    mounts:
      postgres: /var/lib/postgresql/data
    volumes:
      # these volumes are always read-only, 
      # since the applications can be really old and have several security vulnerabilities,
      # we don't want to risk them being able to write (or possibly delete) any data
      - name: postgres
        driver:
          type: local
          config:
            path: /var/lib/postgresql/data
      
  - name: my-webapp
    image: my-research-project:latest
    environment:
      DATABASE_URL: postgres://postgres:mysecretpassword@my-database:5432/postgres
    livecheck:
      type: http
      config:
        path: /health
        port: 8080
        status: 200

order:
  - my-database
  - my-webapp

You would then start the application with museum create my-exhibit.yml. This will start the application and make it available at a random path (a UUID) on the proxy. You can then access the application at http://<proxy-host>:<proxy-port>/exhibits/<path>. You can also specify a path for the application with the --path flag (this is not recommended as we want to avoid path collisions).

$ museum create my-exhibit.yml
 ๐Ÿง‘โ€๐ŸŽจ  exhibit created successfully
 ๐Ÿ‘‰  http://localhost:8080/exhibit/5b3c0e3e-1b5a-4b1f-9b1f-1b5a4b1f9b1f

Accessing the applications

To access the applications, you need to know the path of the application. You can get this path by running museum list.

$ museum list
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
๐Ÿงฎ  my-research-project
    ๐Ÿ”ด  http://localhost:8080/exhibit/908cf715-72e8-44c7-a48d-d552b7a43918
    โฐโ€Ž  Expired 1 hour 46 minutes 54 seconds ago
    ๐Ÿงบ  exhibits:
        ๐Ÿ“œ  db (postgres:9.6)
        ๐Ÿ“œ  wordpress (my-research-project:latest)
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
๐Ÿงฎ  my-other-project
    ๐Ÿ”ด  http://localhost:8080/exhibit/8122d89c-e58d-48ca-a51d-27525b1210a3
    โฐโ€Ž  Expired 12 hours 27 minutes 43 seconds ago
    ๐Ÿงบ  exhibits:
        ๐Ÿ“œ  my-perl-app (perl:5.30)
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

Manually stopping an application

$ museum stop my-research-project
 ๐Ÿ›‘  exhibit stopped successfully

Deleting an application

$ museum delete my-research-project
 ๐Ÿ—‘  exhibit deleted successfully

Renewing the lease manually

$ museum renew my-research-project 2h
 โฒ  exhibit lease renewed successfully
 ๐Ÿ‘‰  http://localhost:8080/exhibit/5b3c0e3e-1b5a-4b1f-9b1f-1b5a4b1f9b1f

Starting an application manually (hot start)

$ museum warmup my-research-project
 ๐Ÿ”ฅ  exhibit warmed up successfully
 ๐Ÿ‘‰  http://localhost:8080/exhibit/5b3c0e3e-1b5a-4b1f-9b1f-1b5a4b1f9b1f

museum's People

Contributors

azer0s avatar

Watchers

Gerhard Gonter avatar rasta avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.