This project requires an environment that enables you to build and share containerized applications and microservices, such as Docker Desktop or Minikube.
Ruby 3
Rails 7
Docker Compose
mySQL
Solr
git clone [email protected]:harvard-lts/GeoBlacklightDockerized
- Make a copy of the config example file
./env-example.txt
- Rename the file to
.env
- Replace placeholder values as necessary
Note: The config file
.env
is specifically excluded in.gitignore
and.dockerignore
. Since it contains credentials, it should NEVER be committed to any repository.
Run docker compose build (may not be necessary but I like to do this)
This command builds all images and runs all containers specified in the docker-compose-local.yml configuration.
This command uses the docker-compose.yml
file to build the Dockerfile
image --build
and also starts the containers up
in background mode -d
.
docker-compose -f docker-compose.yml up -d --build --force-recreate
To restart the containers later without a full rebuild, the options --build
and --force-recreate
can be omitted after the images are built already.
When this finishes, and the database is up and migrations are done (takes about 3-5 minutes), geoblacklight should be available at https://localhost:21800/
To run commands inside a running container, execute a shell using the exec
command. This same technique can be used to run commands in any container that is running already.
docker exec -it <containerID> bash
This has been configured to use MySQL/MariaDB by default (see env-example.txt
), but if you prefer PostgreSQL, you can use the env-psql.txt
by replacing the config/database.yml
file with with the config/database.yml.postgres
file, uncomment the pg gem
line, and rebuild using the docker-compose-psql.yml
file (which uses the DockerfilePostgres file).
This only runs in development mode, to avoid committing a junk master.key
and credentials set (in case someone uses this and forgets to put that in .gitignore
later). To run in another mode you can generate a new master.key
and credentials pair locally.