Skip to content

Starting with Docker Image Using SQL Server as Database

Overview

This guide explains how to start Pleasanter from the official Docker image with SQL Server as the database.

  1. SQL Server is used as the database.
  2. The timezone is set to Japan and the language to Japanese. Please modify as needed.

Prerequisites

This procedure assumes you can start Pleasanter using the official Docker image and modify parameter files according to the following two manuals. Database creation is not required.

  1. Launch with Docker
  2. Use a Docker Image and Start It by Changing the Parameters from the Default

If you haven't read them yet, please refer to the above manuals and confirm that you can start Pleasanter using the official Docker image with modified parameter files.

Procedure

1. Arrange Files

Configure folders and arrange files as follows:

.
|-- compose.yml
|
+-- app_data_parameters
|   +-- Rds.json
|   +-- Service.json
|
+-- CodeDefiner
|   +-- Dockerfile
|
+-- Pleasanter
|   +-- Dockerfile
|
+-- SQLServer
    +-- Dockerfile

Parameter Files

The minimum required changes are as follows:

  1. Rds.json
  2. Set the value of the "Dbms" key to "SQLServer".
  3. Edit the values of the "SaConnectionString", "OwnerConnectionString", and "UserConnectionString" keys, and set PWD=null.

    "Dbms": "SQLServer",
    (omitted)
    "SaConnectionString": "Server=localhost;Database=master;UID=sa;PWD=null;",
    "OwnerConnectionString": "Server=localhost;Database=#ServiceName#;UID=#ServiceName#_Owner;PWD=null;",
    "UserConnectionString": "Server=localhost;Database=#ServiceName#;UID=#ServiceName#_User;PWD=null;",
    (continued)
    

  4. Service.json

  5. Set the value of the "TimeZoneDefault" key to "Asia/Tokyo". This is because the SQL Server base image is Linux, and you need to set the Linux timezone.
  6. Set the value of the "DefaultLanguage" key to "ja" (Japanese).
    "TimeZoneDefault": "Asia/Tokyo",
    (omitted)
    "DefaultLanguage": "ja",
    (continued)
    

compose.yml

Create compose.yml with the following content:

services:
  pleasanter:
    build:
      context: .
      dockerfile: ./Pleasanter/Dockerfile
      args:
        - VERSION=${PLEASANTER_VER}
    container_name: pleasanter_${PLEASANTER_VER}
    environment:
      Implem.Pleasanter_Rds_SaConnectionString: ${Implem_Pleasanter_Rds_SQLServer_SaConnectionString}
      Implem.Pleasanter_Rds_OwnerConnectionString: ${Implem_Pleasanter_Rds_SQLServer_OwnerConnectionString}
      Implem.Pleasanter_Rds_UserConnectionString: ${Implem_Pleasanter_Rds_SQLServer_UserConnectionString}
      TZ: ${TZ}
    ports:
      - '8881:8080'
    networks:
      - default
  codedefiner:
    build:
      context: .
      dockerfile: ./CodeDefiner/Dockerfile
    container_name: codedefiner
    environment:
      Implem.Pleasanter_Rds_SaConnectionString: ${Implem_Pleasanter_Rds_SQLServer_SaConnectionString}
      Implem.Pleasanter_Rds_OwnerConnectionString: ${Implem_Pleasanter_Rds_SQLServer_OwnerConnectionString}
      Implem.Pleasanter_Rds_UserConnectionString: ${Implem_Pleasanter_Rds_SQLServer_UserConnectionString}
      TZ: ${TZ}
    networks:
      - default
    stdin_open: true
  db:
    build:
      context: .
      dockerfile: ./SQLServer/Dockerfile
    container_name: sqldb
    environment:
      ACCEPT_EULA: 'Y'
      MSSQL_SA_PASSWORD: ${SA_PASSWORD}
      TZ: ${TZ}
    ports:
      - '11433:1433'
    networks:
      - default
    volumes:
      - sqlvolume:/var/opt/mssql

volumes:
  sqlvolume:

networks:
  default:
    name: pleasanter_prod_network

SQLServer/Dockerfile

To enable full-text search, use the SQL Server image as base and install full-text search.

FROM mcr.microsoft.com/mssql/server:2019-latest

USER root

RUN apt-get update && apt-get install -yq gnupg gnupg2 gnupg1 curl apt-transport-https
RUN curl https://packages.microsoft.com/keys/microsoft.asc -o /var/opt/mssql/ms-key.cer \
  && apt-key add /var/opt/mssql/ms-key.cer \
  && curl https://packages.microsoft.com/config/ubuntu/20.04/mssql-server-2019.list -o /etc/apt/sources.list.d/mssql-server-2019.list \
  && apt-get update
RUN apt-get install -y mssql-server-fts
# Cleanup
RUN apt-get clean && rm -rf /var/lib/apt/lists

EXPOSE 1433
USER mssql
ENTRYPOINT [ "/opt/mssql/bin/sqlservr" ]

Environment Variable Settings

Set the following environment variables. Please change passwords as appropriate.

PLEASANTER_VER=1.4.15.0
SA_PASSWORD=****
Implem_Pleasanter_Rds_SQLServer_SaConnectionString='Server=db;Database=master;UID=sa;PWD=****'
Implem_Pleasanter_Rds_SQLServer_OwnerConnectionString='Server=db;Database=#ServiceName#;UID=#ServiceName#_Owner;PWD=****'
Implem_Pleasanter_Rds_SQLServer_UserConnectionString='Server=db;Database=#ServiceName#;UID=#ServiceName#_User;PWD=****'
TZ=Asia/Tokyo
Environment Variable Description
SA_PASSWORD Specify the SQL Server SA password.
SaConnectionString Specify the same password as SA_PASSWORD.
TZ Specify the Linux timezone.

2. Build Container Images

Build each service.

docker compose build --pull pleasanter codedefiner db

By specifying --pull, you can check for image updates and get the latest images.

3. Start Containers

Once the image build is complete, start the containers.

Start the SQL Server container.

docker compose up -d db

Start the CodeDefiner container and initialize.

docker compose run --rm codedefiner _rds

Since timezone and language are already set in Service.json, /l and /z are not required. For automation, add /y.

4. Start Pleasanter

Start Pleasanter Container

Start the Pleasanter container.

docker compose up -d pleasanter

Verification

  1. Access the following from a browser:
    http://localhost:8881
    
  2. On the login screen, enter as follows:

    Login ID Password
    Administrator pleasanter
  3. After login, you will be prompted to change the password, so please set an appropriate password.

Connecting to SQL Server

You can connect from SSMS or other compatible tools via port 11433 on the host. According to compose.yml, it is mapped to SQL Server (port 1433) inside the container.

5. Stopping and Removing Containers

Stop Containers

To stop containers, execute the following command:

docker compose stop

Stopping containers does not delete database data.

Restart Stopped Containers

To restart stopped containers, execute the following command:

docker compose start

Stopping containers does not delete database data. When restarting, the data can be used as is.

Remove Containers

To remove containers, execute the following command. Removing containers does not delete database data (volumes).

docker compose down

Recreate Containers

Note that once containers are removed, they cannot be restarted.

If you want to start them, create containers with the following command. This will also create the database container, and you can use the remaining database data as is.

docker compose up -d pleasanter

Remove Data When Removing Containers

To delete data (volumes) at the same time as removing containers, execute with the option to remove volumes (-v).

docker compose down -v

Launch with Docker
Use a Docker Image and Start It by Changing the Parameters from the Default
Upgrade the Docker Image of Pleasanter