LoginSignup
2
0

DockerでPleasanterのテスト環境を構築したい

Last updated at Posted at 2024-06-05

DockerでPleasanterのテスト環境を構築したい

はじめに

今までテスト環境はVM等で構築していました。しかし、構築するまでに時間がかかってしまうというデメリットがあります。とても便利ですが・・・
それに、社内全体で利用している関係上、何でもかんでも作成したり、常時起動中にしたりすることはあまりできません。リソースが足りなくなってしまう・・・
これらの問題を解消するのはコンテナ技術である Docker の利用です。
しかし、私は Docker で Pleasanter を構築したことがなく、知識もあまりない状態でした。
したがって、今回は Docker を使ったテスト環境の構築を実践してみます!

知識がないなりにトライアンドエラーを繰り返して作成したものですので、温かい目でご参照いただけますと幸いでございます。

Pleasanterの構築:事前準備

初期状態

コンテナやイメージの初期状態です。
もちろん、空っぽです。

コンテナ

docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

イメージ

docker images
REPOSITORY          TAG       IMAGE ID       CREATED       SIZE

イメージのプル(PULL)

イメージがないとコンテナを作成できないため、イメージをプルします。

pleasanter(プリザンター)

docker pull implem/pleasanter:latest
latest: Pulling from implem/pleasanter
b0a0cf830b12: Pull complete
1919504653f5: Pull complete
1045f08c42c1: Pull complete
f5bf012875da: Pull complete
5f678ea9f2e2: Pull complete
ed17c50184b1: Pull complete
25b77292f6b9: Pull complete
c02eac1de1d6: Pull complete                                                                     4f4fb700ef54: Pull complete
be6bf49e9e12: Pull complete
Digest: sha256:821233feec1f840fe41888d7656ba3e7b4febc4ae1501e77ddcee7c272a3ad92
Status: Downloaded newer image for implem/pleasanter:latest
docker.io/implem/pleasanter:latest
イメージ
docker images
REPOSITORY          TAG       IMAGE ID       CREATED       SIZE
implem/pleasanter   latest    c09c1f426efa   2 weeks ago   466MB

CodeDifiner

docker pull implem/pleasanter:codedefiner
codedefiner: Pulling from implem/pleasanter
b0a0cf830b12: Already exists
1919504653f5: Already exists
1045f08c42c1: Already exists
f5bf012875da: Already exists
5f678ea9f2e2: Already exists
469128d1196d: Pull complete
595b9b56f5d3: Pull complete
4f4fb700ef54: Pull complete
Digest: sha256:1675169b661c5e681a529bb07aca9086a88740adddc384efc5642894f6d6e965
Status: Downloaded newer image for implem/pleasanter:codedefiner
docker.io/implem/pleasanter:codedefiner
イメージ
docker images
REPOSITORY          TAG       IMAGE ID       CREATED       SIZE
implem/pleasanter   codedefiner   ba170412239a   2 weeks ago   401MB
implem/pleasanter   latest        c09c1f426efa   2 weeks ago   466MB

PostgreSQL15

docker pull postgres:15-alpine
15-alpine: Pulling from library/postgres
d25f557d7f31: Pull complete
8a964e6803ab: Pull complete
cf9216a87d98: Pull complete
4cb066ae2a8e: Pull complete
50b14a0c89dd: Pull complete
ade7dd2c1b26: Pull complete
50c3745855d5: Pull complete
e744f3b8787a: Pull complete
d641c02837d9: Pull complete
Digest: sha256:0cec11eaf51a9af24c27a09cae9840a9234336e5bf9edc5fdf67b3174ba05210
Status: Downloaded newer image for postgres:15-alpine
docker.io/library/postgres:15-alpine
イメージ
docker images
REPOSITORY          TAG         IMAGE ID       CREATED       SIZE
postgres            15-alpine     5cc25ea17f13   11 days ago   240MB
implem/pleasanter   codedefiner   ba170412239a   2 weeks ago   401MB
implem/pleasanter   latest        c09c1f426efa   2 weeks ago   466MB

環境変数の設定

環境変数をファイルに設定しているとコマンドの実行が容易なため、HOMEディレクトリに「env-list」ファイルを作成します。

~/env-list

Implem.Pleasanter_Rds_PostgreSQL_SaConnectionString=Server=PostgreSQL15;Database=postgres;UID=postgres;PWD=<postgres password>
Implem.Pleasanter_Rds_PostgreSQL_OwnerConnectionString=Server=PostgreSQL15;Database=#ServiceName#;UID=#ServiceName#_Owner;PWD=<owner password>
Implem.Pleasanter_Rds_PostgreSQL_UserConnectionString=Server=PostgreSQL15;Database=#ServiceName#;UID=#ServiceName#_User;PWD=<user password>

Pleasanterの構築

後続の手順では、ネットワーク「pleasanter-net」を作成し、PostgreSQL, CodeDefiner, Pleasanterを pleasanter-net 内で構築します。

Dockerネットワークの作成

docker network create pleasanter-net

PostgreSQLの起動

イメージから PostgresSQL15 のコンテナを作成します。
「--network」オプションで「pleasanter-net」を指定することで pleasanter-net 内に PostgreSQL15 を構築します。

docker run --rm -d --network pleasanter-net --name PostgreSQL15 --env POSTGRES_USER=postgres --env POSTGRES_PASSWORD=<posgtresUser password> --env POSTGRES_DB=postgres postgres:15-alpine

コンテナ

docker ps
CONTAINER ID   IMAGE                COMMAND                  CREATED          STATUS          PORTS      NAMES
ff595b626df5   postgres:15-alpine   "docker-entrypoint.s…"   40 seconds ago   Up 39 seconds   5432/tcp   PostgreSQL15

DB「Implem.Pleasanter」の作成

コマンドで CodeDefiner を実行します。
「--network」オプションで「pleasanter-net」を指定することで pleasanter-net 内に CodeDefiner を構築します。

CodeDefinerの実行

docker run --rm --network pleasanter-net --name codedefiner --env-file env-list implem/pleasanter:codedefiner _rds
<INFO> RdsConfigurator.UpdateDatabase: Implem.Pleasanter
<INFO> UsersConfigurator.Execute: Implem.Pleasanter_Owner
<INFO> UsersConfigurator.Execute: Implem.Pleasanter_User
<INFO> SchemaConfigurator.Configure: public
<INFO> TablesConfigurator.ConfigureTableSet: AutoNumberings
<INFO> Tables.CreateTable: AutoNumberings
<INFO> Tables.CreateTable: AutoNumberings_deleted
<INFO> Tables.CreateTable: AutoNumberings_history
<INFO> TablesConfigurator.ConfigureTableSet: Binaries
<INFO> Tables.CreateTable: Binaries
・
・
・
<INFO> TablesConfigurator.ConfigureTableSet: Wikis
<INFO> Tables.CreateTable: Wikis
<INFO> Tables.CreateTable: Wikis_deleted
<INFO> Tables.CreateTable: Wikis_history
<INFO> PrivilegeConfigurator.Execute: Implem.Pleasanter_Owner
<INFO> PrivilegeConfigurator.Execute: Implem.Pleasanter_User
<SUCCESS> Starter.ConfigureDatabase: Database configuration has been completed.
<SUCCESS> Starter.Main: All of the processes have been completed.

Pleasanterの起動

Pleasanterを起動します。
「--network」オプションで「pleasanter-net」を指定することで pleasanter-net 内に Pleasanter を構築します。

docker run --rm --network pleasanter-net --name pleasanter --env-file env-list -p 50001:8080 implem/pleasanter
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[58]
      Creating key {4ca31a69-883b-42af-aef7-a9389ac7733a} with creation date 2024-06-03 06:40:40Z, activation date 2024-06-03 06:40:40Z, and expiration date 2024-09-01 06:40:40Z.
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://[::]:8080
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
      Content root path: /app

Pleasanterへのアクセス

http://localhost:50001/
image.png

ログインID

Administrator

パスワード

pleasanter

image.png

image.png

Pleasanterの停止

Ctrl + c
^Cinfo: Microsoft.Hosting.Lifetime[0]
      Application is shutting down...

PostgreSQLの停止

docker stop PostgreSQL15

コンテナ

docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

Dockerネットワークの削除

docker network rm pleasanter-net

おわりに

今回の記事では、Dockerを使ったPleasanterの構築手順を記載いたしました。
コンテナ技術を個人的に利用したことは初めてでしたが何とかやり遂げることができました・・・。
間違っている内容などありましたら優しくアドバイスいただけますと嬉しいです!

参考資料

  • プリザンターを公式Dockerイメージで動かす

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0