# Open Content Docker

The Docker images for Open Content are primarily for development purposes, not production. So if you are a developer looking for how to start Open Content locally for integration testing or trying things out, then this is for you.

```
# create a directory where to work, in home oc-lab 
cd 
mkdir oc-lab
cd oc-lab
```

```
# Download the zip file from S3 
curl -s https://s3-eu-west-1.amazonaws.com/open-content-artifacts/opencontent-docker-configs.zip  \  
--output opencontent-docker-configs.zip
```

```
# Unzip 
unzip opencontent-docker-configs.zip
```

```
# Go to directory
cd opencontent-docker-lab
```

#### Start Open Content

```
docker-compose -f docker-compose-lab.yml up --detach
```

Wait until all containers are downloaded and started. Now there is an empty Open Content without configuration or content.

#### Logging

```
docker-compose -f docker-compose-lab.yml logs -f wildfly
```

#### Open Content UI

Configuration is done using the admin UI or the admin API. The UI can be found here <http://localhost/admin>.

Below is the menu for the Open Content admin UI.

![Open Content admin UI menu](https://blobscdn.gitbook.com/v0/b/gitbook-28427.appspot.com/o/assets%2F-LJOMI3i_1143VGtZziW%2F-LhFr22w8FHsmztFHzSY%2F-LhFrD0j_T_SJZVs5PVX%2FSka%CC%88rmavbild%202019-06-13%20kl.%2014.42.53.png?alt=media\&token=1f9ef362-f38b-4ff0-a7e6-6f52a67654f8)

## Configure Open Content <a href="#workingwithdocker-configureopencontent-1" id="workingwithdocker-configureopencontent-1"></a>

The first thing that has to be configured is storage. This can either be done in the UI at [`http://localhost/admin`](http://localhost/admin) or with this curl command:

```
curl -u admin:admin -d name=OpenContent -d path=/tmp http://localhost:8080/opencontent/admin/storage​
```

Open Content configuration in this setup is done using a local copy of our Bitbucket repository for configuration. Use the Open Content admin UI to inspect the detailed settings for the different configuration options.

Go to the **`opencontent-configuration`** directory where the configure.sh script is

```
cd ../opencontent-configs/scripts
```

Configure Open Content for public use

```
./configure.sh \
http://admin:admin@localhost:8080/opencontent \
public
```

Configure Open Content for public and app use

```
./configure.sh \
http://admin:admin@localhost:8080/opencontent \
public-app
```

Configure Open Content for editorial use

```
./configure.sh \
http://admin:admin@localhost:8080/opencontent \
editorial
```

Activation of the configuration

```
curl -u admin:admin \
-X POST "http://localhost:8080/opencontent/admin/configuration/activate" \
-H "accept: */*" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "reason=configured from script&name=$(whoami)"
```
