Skip to content

mlibrary/blogs.lib

Repository files navigation

Blogs at blogs.lib.umich.edu

University of Michigan Library Blogs site is a drupal application (https://www.drupal.org/).

Prerequisites

  1. If you haven't already, you will need to install Docker or Docker Desktop (https://docs.docker.com/get-docker/) and Git (https://github.com/git-guides/install-git)

  2. To start working on it in docker please contact [email protected] to obtain appropriate credentials for files and database.

  3. IMPORTANT! If you run Docker with a new non-Intel Apple chip, you may have issues! If you do and find a solution please post it in issues.

🚀 Quick start

  1. Clone blogs.lib.
git clone https://github.com/mlibrary/blogs.lib.git && cd blogs.lib
  1. Set up s3 credentials.

Add credentials for s3 (NOTE: credentials must be supplied.)

tar -zxf aws-stub && vi .aws/credentials

Add the key and secret supplied and save the credentials file

  1. Get the data from an s3 bucket (NOTE: credentials must be supplied from prior step.)
sudo docker run --rm -it -v $(pwd)/.aws:/root/.aws -v $(pwd):/aws amazon/aws-cli s3 cp s3://blogs-lib-umich-edu/ ./ --recursive
  1. Set up files and database settings.
tar -zxf files.tar.gz -C sites/default && cp sites/default/docker.settings.php sites/default/settings.php
  1. Start the server.
sudo docker-compose build && sudo docker-compose up -d
  1. Set files permissions to apache
sudo docker exec -it blogslib-drupal-1 chown -R www-data sites/default/files
  1. Import the openid config for development.
tar -zxf config-yml.tar.gz
sudo docker exec -it blogslib-drupal-1 drush config-import --partial --source=config-yml/ 
  1. Open the site. (NOTE: Takes a minute for mariadb to load up.)

Site should load at http://localhost:25647

🚀 Completely Rebuild environment

  1. Pull the latest from git.
git pull
  1. **Get fresh data from the s3 bucket (NOTE: credentials must be supplied from initial build.)
sudo docker run --rm -it -v $(pwd)/.aws:/root/.aws -v $(pwd):/aws amazon/aws-cli s3 cp s3://blogs-lib-umich-edu/ ./ --recursive
  1. Set up refreshed files. (NOTE: you may want to mv sites/default/files sites/default/files- or rm -r sites/default/files)
sudo tar -zxvf files.tar.gz -C sites/default && sudo chown -R www-data sites/default/files
  1. Rebuild docker with latest stuff.

Remove all associated volumes, images and containers. Download the latest. Note that you may have names other than blogslib-drupal-1 and blogslib-database-1.

sudo docker rm -f blogslib-database-1 && sudo docker rm -f blogslib-drupal-1 && sudo docker volume rm -f blogslib_database && sudo docker image rm -f mariadb:latest && sudo docker image rm -f blogslib_drupal:latest && sudo docker-compose build --no-cache && sudo docker-compose up -d --force-recreate
  1. Import the openid config for development. (NOTE: you need to wait for database to start up. Should go green.)
tar -zxf config-yml.tar.gz
sudo docker exec -it blogslib-drupal-1 drush config-import --partial --source=config-yml/

Other handy commands

Update composer

sudo docker exec -it blogslib-drupal-1 composer update

Run drush commands (status in example, but can be anything)

sudo docker exec -it blogslib-drupal-1 drush status