# Spin up the service

Full list of steps to perform before spinning up the service:

1. Extract the Terminology Server release archive to a folder. E.g. `/opt/snow-owl`
2. (Optional) Obtain an SSL certificate

   1. Make sure a DNS A record is routed to the host's public IP address
   2. Go into the folder `./snow-owl/docker/cert`
   3. Execute the `./init-certificate.sh` script:

   ```sh
   ./init-certificate.sh -d snow-owl.example.com
   ```
3. (Optional) Configure access for managed Elasticsearch Cluster (elastic.co)
4. (Optional) Extract dataset to `./snow-owl/resources` where folder structure should look like `./snow-owl/resources/indexes/nodes/0` at the end.
5. Verify file ownership to be UID=1000 and GID=0:

   ```sh
   chmod -R 1000:0 ./snow-owl/docker ./snow-owl/logs ./snow-owl/resources
   ```
6. Check any credentials or settings that need to be changed in `./snow-owl/docker/.env`
7. Authenticate with our private docker registry while in the folder `./snow-owl/docker`:

   ```sh
   cat docker_login.txt | docker login -u <username> --password-stdin https://docker.b2ihealthcare.com
   ```
8. Issue a pull (in folder `./snow-owl/docker`)

   ```sh
   docker compose pull
   ```
9. Spin up the service (in the folder `./snow-owl/docker`)

   ```sh
   docker compose up -d
   ```
10. Verify that the REST API of the Terminology Server is available at:
    1. With SSL: `https://snow-owl.example.com/snowowl`
    2. Without SSL: `http://hostname:8080/snowowl`
11. Verify that the server and cluster status is GREEN by querying the following REST API endpoint:
    1. With SSL:

       ```sh
       curl https://snow-owl.example.com/snowowl/info
       ```
    2. Without SSL:

       ```sh
       curl http://hostname:8080/snowowl/info
       ```
12. Enjoy using the Snow Owl Terminology Server :tada:
