Skip to content
This repository was archived by the owner on Mar 7, 2023. It is now read-only.

Using Docker

Ben Mitchinson edited this page Mar 11, 2020 · 2 revisions

Installation

The application runs on docker, which can be installed here. If you're a linux user, you'll also need to install docker-compose separately. Otherwise, it's included in the Mac and PC versions of "Docker Desktop"

Usage / Helpful Commands

  • docker-compose up Will start each listed service within the docker-compose.yml.
    • docker-compose down (from the root directory) will bring down, "stop" each service.
    • the --build flag of docker-compose will rebuild each container before starting it in a process.
    • the file flag -f {....yml} allows you specify a different compose yaml file. This is useful when starting up alternative configurations, like a production config.
  • docker ps lists all active docker processes.
    • docker stop {first 3 chars of container_id} will attempt to stop the process, kill will force it.
    • you could also use "docker_pwa" (the container name, as specified in the yaml), in place of the container_id
    • `docker ps -f "status=exited" will reveal past processes, sometimes these are helpful to remove.
  • docker image ls, docker container ls, docker volume ls, will list the respective items. Since containers are built out of layered images, you'll notice that you have a both a "node" image, and a "haiti_pwa" image (which includes the node image within it as a base). Deleting the node image docker image rm node is almost never useful, but you might need to remove "haiti_pwa" -> docker image rm haiti_pwa to force a new build, if docker-compose --build doesn't see that through.
  • docker exec -it {container name/id} bash will open an Interactive bash Terminal (-it) for you to interface with the inside of your container.
    • Things like installing a new node package are required to be done within the container.

Using an external storage solution

If the database is growing too large for your internal storage, you can mount an external drive and tell docker to use it for hosting.

  • Mount the external drive to a location where you won't run into permission issues, such as /mnt/external-drive/docker-storage
  • update ownership of that location to be sure with: chown -R root:root /mnt/external-drive/docker-storage and chmod 701 /mnt/external-drive/docker-storage.
  • Create /etc/docker/daemon.json with the contents:
{
    "graph": "/mnt/external-drive/docker-storage"
}
  • Edit the dockerfile volumes to utilize instead of their defaults /mnt/external-drive/docker-volumes.
  • Restart the docker service

After docker build or running the entire compose, the external drive will receive all of the contents.

Clone this wiki locally