Skip to content

Commit

Permalink
Merge pull request #1 from archival/alternative-proposal
Browse files Browse the repository at this point in the history
Update examples for alternative model proposal
  • Loading branch information
anarchivist authored Nov 16, 2017
2 parents e91c13e + e7a8222 commit 8de4ddc
Show file tree
Hide file tree
Showing 7 changed files with 135 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.git
.gitignore
93 changes: 93 additions & 0 deletions Docker-deploy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Deploying a local test environment with Docker

This guide describes deploying a local Docker container which can run the
build.sh validation script, compile the Jekyll templates to HTML, and serve the
rendered HTML pages with Jekyll's simple web server.

**N.B. This Docker image is not intended for deployment in a public network and
has not been audited for security.**

The Docker image is based on the official
[Jekyll Docker image](https://hub.docker.com/r/jekyll/jekyll/) and runs
[Alpine Linux](https://alpinelinux.org/).

## Step 1: Download Docker CE

Follow the [installation instructions](https://docs.docker.com/engine/installation/)
on the Docker website.

**Note:** [Docker for Windows](https://docs.docker.com/docker-for-windows/) is
the recommended Docker environment for Windows, but it requires Windows 10 Pro,
Enterprise, or Education versions. If you have Windows 10 Home, or an earlier
version of Windows, try
[Docker Toolbox](https://www.docker.com/products/docker-toolbox) instead.

## Step 2: Clone the Github repository

Clone a local working copy of the ```dev/alt-docker``` branch of
[artefactual-labs/schema-org](https://github.com/artefactual-labs/schema-org/tree/dev/alt-docker)
(forked from [archival/schema-org](https://github.com/archival/schema-org)).

```
git clone -b dev/alt-docker git@github.com:artefactual-labs/schema-org.git
cd schema-org
```

The ```dev/alt-docker``` branch is based on the ```alternative-proposal```
branch.

## Step 3: Build the Docker image

**Note**: You will need to perform an additional step in Linux to
[run docker as a non-root user](https://docs.docker.com/engine/installation/linux/linux-postinstall/#manage-docker-as-a-non-root-user).
Otherwise, use ```sudo docker``` to run docker commands.

To build the docker image using the local ```Dockerfile```:

```
docker build -t schema-arc .
```

## Step 4: Docker commands

A sampling of Docker commands to help you get started. See the
[Docker CLI reference](https://docs.docker.com/engine/reference/commandline/cli/)
for a comprehensive list of docker commands and options.

### Build Jekyll HTML and serve at http://127.0.0.1:4000/schema-org/

```
docker run -p 127.0.0.1:4000:4000 --rm --name jekyll-serve schema-arc
```

| Option | Description
| -----------------------|------------
| -p 127.0.0.1:4000:4000 | Bind container port 4000 (Jekyll server) to host address 127.0.0.1:4000
| --rm | Destroy the container after it exits
| --name jekyll-serve | Name the running container "jekyll-serve"
| schema-arc | Use docker image "schema-arc"

Press ```CTRL-C``` to stop the Jekyll server and destroy the Docker container.

### Run build validation script

```
docker run --rm schema-arc bash build.sh
```

The container will automatically stop after ```./build.sh``` exits.

### Open a bash terminal on a running container

```
docker exec -it jekyll-serve bash
```

## Notes

* Your local git working directory (this directory) is copied into the docker
image when it is built. To update the Jekyll template files in the image,
make the changes locally, then rebuild the Docker image. This workflow
doesn't require opening a shell into the container to make changes. It also
doesn't require copying ssh keys into the image, or using ssh-agent, to push
commits to a private git repository.
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM jekyll/jekyll:latest

# Bundle install first to prevent reinstall on each code change, see:
# https://medium.com/@fbzga/how-to-cache-bundle-install-with-docker-7bed453a5800
COPY Gemfile* /tmp/
WORKDIR /tmp
RUN bundle install

# Add current host dir contents to image
COPY . /srv/jekyll
WORKDIR /srv/jekyll

EXPOSE 4000

CMD ["bundle","exec","jekyll","serve","--host","0.0.0.0","--port","4000"]
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ exclude:
- vendor/cache/
- vendor/gems/
- vendor/ruby/
- Dockerfile
6 changes: 3 additions & 3 deletions _examples/emory/civil-war-collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ source: Emory University
{
"@context": "http://schema.org/",
"@id": "https://findingaids.library.emory.edu/documents/civilwar20/",
"@type": "ArchiveCollection",
"@type": ["Collection", "ArchiveComponent"],
"about": [
"http://id.loc.gov/authorities/names/n50057060",
"http://id.loc.gov/authorities/subjects/sh93000143"
Expand All @@ -14,9 +14,9 @@ source: Emory University
"Unrestricted access.",
"All requests subject to limitations noted in departmental policies on reproduction."
],
"archive": {
"holdingArchive": {
"@id": "http://id.loc.gov/authorities/names/no2015136078",
"@type": "LocalBusiness",
"@type": ["Archive", "LocalBusiness"],
"address": "232 Asbury Drive, Atlanta, Georgia 30032",
"name": "Stuart A. Rose Manuscript, Archives, and Rare Book Library",
"telephone": "404-727-6887",
Expand Down
10 changes: 8 additions & 2 deletions _examples/rice/houston-folk-music.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ title: Houston Folk Music collection
source: Rice University
---
{
"@id": "http://archives.library.rice.edu/repositories/2/resources/1038",
"url": "http://archives.library.rice.edu/repositories/2/resources/1038",
"@context": "http://schema.org/",
"@type": "ArchiveCollection",
"@type": ["Collection", "ArchiveComponent"],
"name": "Houston Folk Music collection",
"itemLocation": "http://archives.library.rice.edu/repositories/2/resources/1038",
"inLanguage": "EN",
"holdingArchive": {
"name": "Woodson Research Center Special Collections & Archives",
"address": "Fondren Library, Rice University, 6100 Main, Houston, TX 77005",
"url": "http://library.rice.edu/woodson/"
},
"creator": [
{
"@type": "person",
Expand Down
15 changes: 13 additions & 2 deletions _examples/un/commission-for-india-and-pakistan-plebiscite.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ source: United Nations
---
{
"@context": "http://schema.org/",
"@id": "https://search.archives.un.org/subject-files-0204-116",
"@type": "ArchiveCollection",
"@id": "https://search.archives.un.org/subject-files-united-nations-plebiscite-administrator-for-jammu-and-kashmir",
"url": "https://search.archives.un.org/subject-files-united-nations-plebiscite-administrator-for-jammu-and-kashmir",
"@type": ["Collection", "ArchiveComponent"],
"identifier": "S-0692",
"holdingArchive": {
"name": "United Nations Archives",
"url": "https://archives.un.org/",
"email": "arms@un.org"
},
"accessAndUse": "No restrictions on access",
"creator": {
"@id": "https://search.archives.un.org/united-nations-commission-for-india-and-pakistan",
Expand All @@ -22,6 +28,11 @@ source: United Nations
"legalName": "United Nations Office for Special Political Affairs"
}
},
"isPartOf": {
"@type": ["Collection", "ArchiveComponent"],
"url": "https://search.archives.un.org/united-nations-commission-for-india-and-pakistan-uncip-1948-1950",
"name": "United Nations Commission for India and Pakistan (UNCIP) fonds (1948-1950)"
},
"dateCreated": "July 1948 to November 1950",
"description": "Series Includes correspondence and memoranda concerning plans for the plebiscite, the government of Kashmir, minorities in India and Pakistan, refugees in Kashmir, and other matters concerning the situation in Jammu and Kashmir, and the operation - plebiscite.",
"endDate": "1950-11-24",
Expand Down

0 comments on commit 8de4ddc

Please sign in to comment.