This repository bundles Suma, a webapp for facilitating performing head-counts in libraries, in a network of Docker containers, allowing it to be deployed with a single command (docker-compose up
).
Suma's documentation can be found here.
The files in this repository use docker-compose
version 3+. See here for installation instructions for docker-compose
and its dependencies (including docker
).
- Clone this repository along with its
Suma
submodule withgit clone --recurse-submodules https://github.com/USERNAME/suma-docker
(whereUSERNAME
) is replaced to match whatever fork of this repository you're using. - This Docker repository requires one minor change to be made to Suma itself, for the
zend
dependency that ships with it to work:
Inservice/web/index.php
, replace
php ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . $SUMA_SERVER_PATH . PATH_SEPARATOR . $SUMA_SERVER_PATH . '/lib/zend/library');
withphp ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . $SUMA_SERVER_PATH . '/service' . PATH_SEPARATOR . $SUMA_SERVER_PATH . '/service/lib/zend/library');
- In the
config
directory:- Copy
analysis-config_TEMPALTE.yaml
toanalysis-config.yaml
. - Copy
mysql_TEMPLATE.env
tomysql.env
. - Copy
server-config_TEMPALTE.yaml
toserver-config.yaml
. - Open the three files you created in the steps above (
analysis-config.yaml
,mysql.env
, andserver-config.yaml
) and modify them as appropriate (generating new passwords, etc.).
- Copy
- From the main directory of this repository, run
docker-compose up
, or, if you'd like to re-build the images,docker-compose up --build
. If you would like to run the containers detached from the current shell, you can add-d
:docker-compose up -d
. - To stop the container:
- If attached, you can use
Ctrl+C
. - If detached, you can use
docker-compose down
.
Volume data should persist across times you bring the containers up or down. If you would like to wipe the container data, you can usedocker-compose down --volumes
.
- If attached, you can use
- To get a shell with the html container, you can use
docker exec -i -t suma_web /bin/bash
. - To back up container data (e.g., from the
MySQL
container), you can use (while thesuma_mysql
container is running)
source config/mysql.env
docker exec suma_mysql mysqldump -u $MYSQL_USER --password=$MYSQL_PASSWORD $MYSQL_DATABASE > backup.sql 2>backup_errors
- Similarly, container data can be restored with the following (while the
suma_mysql
container is running):
source config/mysql.env
cat backup.sql | docker exec -i suma_mysql /usr/bin/mysql -u $MYSQL_USER --password=$MYSQL_PASSWORD $MYSQL_DATABASE
- To access Suma:
- The Administration interface is at http://localhost/sumaserver/admin/login.
The login credentials are set inconfig/server-config.yaml
in theadmin
section. - The data entry interface is at http://localhost/suma/web.
- The analytics interface is at http://localhost/suma/analysis/reports/.
- The Administration interface is at http://localhost/sumaserver/admin/login.
The code in this repository is released under the MIT License.
This project is a fork of https://github.com/publicus/suma-docker