codeforpdx / PASS

PASS project - with HMIS module integration
MIT License
28 stars 25 forks source link

Enhancement: Add a Docker config to allow easy server launches #375

Closed timbot1789 closed 11 months ago

timbot1789 commented 1 year ago

Describe the Current Behavior/Feature:

Currently, the only means we provide for running PASS is to run the both the solid server and the react server directly, as separate processes. This is fine (and often preferable) for a dev environment, but becomes problematic when deploying the server in a live environment.


Proposed Behavior/Feature:

We can make a Docker container (or docker-compose system) that runs both the PASS react app and a solid server out of the box, and maintains internally all necessary configuration and data. Then we will be able to easily deploy the full app to any environment.


Rationale:

Ultimately, we will want to make it as easy as possible to set up PASS. If we have a well-written docker file, we can get a full PASS system (pod server, app, and env variables) up and running in a single command.


Proposed Implementation (if applicable):

We can have a docker-compose file that builds 2 docker containers:

  1. A pod server that runs community solid server
  2. An NGINX server that serves the built React App

Using proper port forwarding, we can set up the docker-compose file to automatically set the env variables in the NGINX server to point the react app at the Pod server. We can also have the docker-compose automatically run letsencrypt to get certs to host the servers over https. This may require a third container (I haven't looked into that too closely yet).

The end result should be a system that keeps all information stored in the docker containers, with no leakage into the host environment (or if it needs to write to the host filesystem, writes to an area reserved to that container).


Additional context:

We currently have a docker-compose file up on opencommons.net, but it is tied closely to the specifics of that droplet. It would be ideal if we can have a single, universal docker file that can be run on all systems.

timbot1789 commented 1 year ago

@pinfold Followup issue to the conversation we had at the Code for PDX meeting on Aug 9th. If we get this config written correctly, we could get it running on opencommons.net as well.

timbot1789 commented 1 year ago

We're currently using this docker-compose.yml on opencommons.net to run community solid server. Some more information is available here: https://github.com/CommunitySolidServer/CommunitySolidServer#-running-via-docker

version: '3.7'
services:
  server:
    image: solidproject/community-server:6.0.0

    # this ensures automatic container start, when host reboots
    restart: always

    # run as root so container can access letsencrypt certs
    user: root

    ports:
      - 3000:3000

    volumes:
      # mount local directories to the container
      - type: bind
        source: /home/kevin/solid-css/data
        target: /data
      - type: bind
        source: /home/kevin/solid-css/config
        target: /config

      # (!) mount existing TLS certificates, e.g. from letsencrypt
      # (!) ensure that the key and fullchain files are readable by UID 1000
      - /etc/letsencrypt:/certs

    #environment:
    #  - "CSS_BASE_URL=https://opencommons.net/"
    #  - "CSS_CONFIG=/config/pass-config.json"
    #  - "CSS_ROOT_FILE_PATH=/data"
    #  - "CSS_LOGGING_LEVEL=debug"

    command: -c /config/pass-config.json -f /data -b https://opencommons.net
timbot1789 commented 11 months ago

Closing: Complete