---
# System prepended metadata

title: Optimade MC steps

---

# Optimade MC steps

Running a mongo on container by following https://www.optimade.org/optimade-python-tools/latest/deployment/container/

```
docker network create -d bridge optimade
docker volume create mongodb-persist-optimade
# `mongo` will be the host name in the docker network, using `--name`.
docker run \
    --detach \
    --name mongo \
    --volume mongodb-persist-optimade:/data/db \
    --network optimade \
    -p 27017:27017 \
    docker.io/library/mongo:latest
```

Then import data to the test mongo db:

```
python mc_optimade/src/jsonl_server/load_data.py
```

By using MongoDB Compass GUI it is quite easy to see all data in the DB.

Start the optimade server with:

```
docker run \
    --rm \
    --detach \
    --publish 8081:5000 \
    --env MAIN=main \
    --name mc-archive-optimade \
    --network optimade \
    --env OPTIMADE_CONFIG_FILE= \
    --env optimade_insert_test_data=false \
    --env optimade_database_backend=mongodb \
    --env optimade_mongo_uri=mongodb://mongo:27017 \
    --env optimade_mongo_database=mc_optimade \
    --env optimade_structures_collection=structures \
    --env optimade_page_limit=25 \
    --env optimade_page_limit_max=100 \
    --env optimade_base_url=http://localhost:8081 \
    --env optimade_index_base_url=http://localhost:8080 \
    --env optimade_provider="{\"prefix\":\"myorg\",\"name\":\"My Organization\",\"description\":\"Short description for My Organization\",\"homepage\":\"https://example.org\"}" \
    ghcr.io/materials-consortia/optimade:latest
```


Convert between json (as DB) and jsonl (as middle format)
https://zzz.buzz/2020/05/11/convert-between-json-and-json-lines-using-jq/