---
subtitle: First Deployment
header-img: img/header_img/server.jpg
date: 2018-03-07 09:50:12
description: Spectrum Protect Server in a Docker Container - First run
related:
- { page: "index", title: "Containerising SP" }
- { page: "normalrun", title: "Normal Run of Container" }
- { page: "upgrade", title: "Upgrading SP" }
- { page: "recover", title: "Recoverying the SP Database" }
---
# First deployment of a Spectrum Protect Server (in a container)
> **NOTES**:
> * The following instructions are for a Spectrum Protect 8.1.4 instance. I used the same procedure described [here](/server) to build the Docker Image. The only difference is that I performed a new install using the installation media that would be available from Passport Advantage. (Thus it was just an install, not an 8.1.0 install and followed by a 8.1.4 upgrade).
> * Make sure you follow the guidelines for space required as presented in the [Knowledge Center](https://www.ibm.com/support/knowledgecenter/SSEQVQ_8.1.4/srv.install/t_srv_plan_capacity-linux.html).
 Our Docker Image will have the SP database in `/database`, the instance user in `/tsm` and storage pools in `/data`. Ultimately these will be volumes provisioned from the host and using host storage, or your prefered Docker persistent volume storage technology. 
> * The storage used in the example below is from the host filesystems, passed to the container with Docker's `-v` option.
> * This implementation is using DISK or CLOUD storage pool storage. While accessing tape should be possible, I havent explored what is required for that to work.

## Configuration
Our configuration will use these defaults

```bash Container Variables
TSM_DB=/srv/sp/database
TSM_USER=/srv/sp/user
TSM_DATA=/srv/sp/data
```

* **TSM_DB** is where the TSM Database will be stored on the Docker Host, and will be passed to the container with `-v $TSM_DB:/database`
* **TSM_USER** is where the TSM Instance user's home directory is on the Docker Host, and will be passed to the container with `-v $TSM_USER:/tsm`
* **TSM_DATA** is where the TSM Disk based storage pools are stored on the Docker Host, and will be passed to the container with `-v $TSM_DATA:/data`
 If data is stored in a cloud pool, then this would be where the acceleration pool is holding data before it gets sent to the cloud.

## First Run Init #1

The first init run will be to create the database layout, and to copy the initialise database (as performed when containering SP) onto our persistent storage.

`docker run --detach=false --hostname=tsm --interactive=false -v $TSM_USER:/tsm.init -v $TSM_DB:/database.init --privileged=true --rm=true --restart=no --tty=false --name=spectrumprotect ibm/spectrumprotect:8.1.4 init1`

You wont see any output, but if you look in your $TSM_USER path, you should see the familiar TSM instance owner files (like sqllib). The $TSM_DB directory should have sub directories created for the DB2 database, active and archive logs.

```bash Example
[root@d-1-1 test-sp-server]# ls -aln $TSM_DB
total 0
drwxr-xr-x 7 201 201 4096 Mar  8 14:30 .
drwxr-xr-x 5   0   0 4096 Mar  8 14:25 ..
drwxr-xr-x 2 201 201 4096 Mar  8 14:30 activelog
drwxr-xr-x 2 201 201 4096 Mar  8 14:30 archfaillog
drwxr-xr-x 2 201 201 4096 Mar  8 14:30 archlog
drwxr-xr-x 2 201 201 4096 Mar  8 14:30 mirrorlog
drwxr-xr-x 2 201 201 4096 Mar  8 14:30 tsmdb
```

<small>**NOTE**: The UID/GID should be the same as you defined in your Dockerfile</small>

## First Run Init #2 

The second init run will now run the post-install setup for a new environment (`dsmserv formatdb` and then create the ADMIN user).

`docker run --detach=false --hostname=tsm --interactive=false -v $TSM_USER:/tsm -v $TSM_DB:/database --privileged=true --rm=true --restart=no --tty=false --name=spectrumprotect ibm/spectrumprotect:8.1.4 init2`

```tsm Expected Output
ANR7800I DSMSERV generated at 16:03:41 on Nov 17 2017.

IBM Spectrum Protect for Linux/x86_64
Version 8, Release 1, Level 4.000

Licensed Materials - Property of IBM
...
ANR0916I IBM Spectrum Protect distributed by International Business Machines is
now ready for use.
ANR2068I Administrator ADMIN registered.
ANR2076I System privilege granted to administrator ADMIN.
ANR1912I Stopping the activity log because of a server shutdown.
ANR0369I Stopping the database manager because of a server shutdown.
```

<small>**NOTE**: With 8.1.4 I noticed a lot of `DBI1306N` messages floating up the screen. That doesnt appear to be an actual problem.</small>

The "Init" steps will only need to be run the once for any "new" instance of SP. Thereafter, you'll start SP using the Normal steps documented [here](normalrun.html).
