You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

So you're deploying your library's circulation manager. Awesome! If you'd like to get up and running quickly, we recommend using our Docker image.

If you're already familiar with Docker and/or would like to contribute to our Docker builds, you can find our build files at NYPL-Simplified/circulation-docker.

Step-by-step guide

  1. Prep Work

     

    1. Install Docker. Depending on your package manager, you could also install a slightly older version with: sudo apt-get install docker-ce or sudo yum install docker-ce.

      Docker has step-by-step instructions to grab its most up-to-date version. 

    2. Create any dependent, temporary containers (optional) for integrations like Elasticsearch and Postgres. We don't recommend using containers in the long-term for holding or maintaining data. However, if you just want to get a sense of how your Circulation Manager will work, containers are a quick option. Instructions for integrating Elasticsearch and Postgres via Docker can be found below.

    3. Get the Docker images for the Library Simplified Circulation Manager. Run:

      $ sudo docker pull nypl/circ-deploy && sudo docker pull nypl/circ-scripts

       

  2. Running Circulation Manager containers


    1. To deploy an app filled with your library's books, you'll need to run a number of scripts. Read the environment variable details below before running this script; you will likely need to alter it to meet your needs.

      Example Docker Run Script

      $ sudo docker run -d --name circ-scripts \
          -e TZ="US/Central" \
          -e SIMPLIFIED_DB_TASK='init' \
          -e SIMPLIFIED_PRODUCTION_DATABASE='postgres://[username]:[password]@[host]:[port]/[database_name]' \
          nypl/circ-scripts


      The example above runs this resulting container in detached mode (-d), linked to the (-eSIMPLIFIED_PRODUCTION_DATABASE and calling it "circ-scripts". With the (-e) optional argument TZ, you can pass a Debian-system timezone representing your local time zone, which will cause timed scripts to run according to your local time. If the database you've connected in your configuration has never been used before, use -e to set the optional argument SIMPLIFIED_DB_TASK to 'init'. This will keep track of the state of the database you've created and create an alias on your Elasticsearch cluster, allowing database updates to be easily managed with scripts.

      Running Scripts

      Once you've given your scripts some time to run (~30 minutes should be enough time to start having works move through the import process), you'll want to refresh your cached materialized views so they show up in your deployed app.

      ```sh
      $ sudo docker exec circ-scripts /var/www/circulation/core/bin/run refresh_materialized_views
      ```
      

      Troubleshooting

      You'll want to check the logs of your container. For example:

      # check logs of the database task and running supervisor processes
      $ sudo docker logs circ-scripts
      
      # check logs of cron and scripts
      $ sudo docker exec circ-scripts cat /var/log/cron.log | less
      $ sudo docker exec circ-scripts ls /var/log/simplified
      $ sudo docker exec circ-scripts cat /var/log/simplified/overdrive_monitor_full | less
      
      # The log directory can also be found on the production server.
      # Its location can be found using this command.
      $ sudo docker inspect circ-scripts \
        --format='{{range $mount := .Mounts}}{{if eq $mount.Destination "/var/log"}}{{$mount.Source}}{{end}}{{end}}'

      You can hop into a running container at any time with the command: $ sudo docker exec -it circ /bin/bash

      Docker has fantastic documentation to get more familiar with its command line tools, like docker exec and docker inspect. We recommend you check them out.

    2. Refresh Materialized Views

      Once you've given your scripts some time to run (~30 minutes should be enough time to start having works move through the import process), you'll want to refresh your cached materialized views so they show up in your deployed app.

      ```sh
      $ sudo docker exec circ-scripts /var/www/circulation/core/bin/run refresh_materialized_views
      ```

 

  • No labels