redmineをdocker-composeで作る
code:docker-compose.yml
version: "3"
services:
7_mariadb:
image: mariadb
networks:
- redminenet
volumes:
- mariadbvol:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: myrootpass
MYSQL_DATABASE: redmine000db
MYSQL_USER: redmine000kun
MYSQL_PASSWORD: rkunpass
command:
- mysqld
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
- --default-authentication-plugin=mysql_native_password
7_redmine:
depends_on:
- 7_mariadb
image: redmine
networks:
- redminenet
volumes:
- redminevol:/var/www/html
ports:
- 8087:3000
restart: always
environment:
REDMINE_DB_MYSQL: 7_mariadb
REDMINE_DB_DATABASE: redmine000db
REDMINE_DB_USERNAME: redmine000kun
REDMINE_DB_PASSWORD: rkunpass
networks:
redminenet:
volumes:
redminevol:
mariadbvol:
これで実行すると、redmine側のコンテナがrestartingを繰り返す。
繰り返すということは、1回は問題なく起動しているということ。
コンテナの中のログから情報を探す
code:terminal
docker logs --tail 50 --follow --timestamps 7_redmine
redmine-7_redmine-1 | 2022-11-16T13:07:29.828246200Z Tasks: TOP => db:migrate
redmine-7_redmine-1 | 2022-11-16T13:07:29.828260300Z (See full trace by running task with --trace)
redmine-7_redmine-1 | 2022-11-16T13:07:43.165645200Z Your Gemfile lists the gem puma (>= 0) more than once.
redmine-7_redmine-1 | 2022-11-16T13:07:43.165677200Z You should probably keep only one of them.
redmine-7_redmine-1 | 2022-11-16T13:07:43.165693400Z Remove any duplicate entries and specify the gem only once.
redmine-7_redmine-1 | 2022-11-16T13:07:43.165706900Z While it's not a problem now, it could cause errors if you change the version of one of them later.
redmine-7_redmine-1 | 2022-11-16T13:07:43.241106000Z The Gemfile's dependencies are satisfied
redmine-7_redmine-1 | 2022-11-16T13:07:45.099898600Z rake aborted!
redmine-7_redmine-1 | 2022-11-16T13:07:45.099927200Z ActiveRecord::ConnectionNotEstablished: Unknown MySQL server host 'mysql000ex13' (-2)
そんなホスト無いと言われている
ymlファイル見ると確かにおかしい...修正
もう一回
code:terminal
redmine-7_redmine-1 | 2022-11-16T13:12:32.255012700Z Caused by:
redmine-7_redmine-1 | 2022-11-16T13:12:32.255024000Z Mysql2::Error::ConnectionError: Access denied for user 'redmine000kun'@'192.168.208.3' (using password: YES)
MariaDBへログインできてない
どうしてもつながらないので、mysqlに変えてみる...
code:docker-compose.yml
version: "3"
services:
7_mysql:
image: mysql
networks:
- redminenet
volumes:
- mysqlvol:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: myrootpass
MYSQL_DATABASE: redmine000db
MYSQL_USER: redmine000kun
MYSQL_PASSWORD: rkunpass
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
- --default-authentication-plugin=mysql_native_password
7_redmine:
depends_on:
- 7_mysql
image: redmine
networks:
- redminenet
volumes:
- redminevol:/var/www/html
ports:
- 8087:3000
restart: always
environment:
REDMINE_DB_MYSQL: 7_mysql
REDMINE_DB_DATABASE: redmine000db
REDMINE_DB_USERNAME: redmine000kun
REDMINE_DB_PASSWORD: rkunpass
networks:
redminenet:
volumes:
redminevol:
mysqlvol:
起動した
code:docker-compose.yml
version: "3"
services:
7_mysql:
image: mysql
networks:
- redminenet
volumes:
- mysqlvol:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: myrootpass
MYSQL_DATABASE: redmine000db
MYSQL_USER: redmine000kun
MYSQL_PASSWORD: rkunpass
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
- --default-authentication-plugin=mysql_native_password
7_redmine:
depends_on:
- 7_mysql
image: redmine
networks:
- redminenet
volumes:
- redminevol:/var/www/html
ports:
- 8087:3000 # 8087:80にすると起動しなくなる
restart: always
environment:
REDMINE_DB_MYSQL: 7_mysql
REDMINE_DB_DATABASE: redmine000db
REDMINE_DB_USERNAME: redmine000kun
REDMINE_DB_PASSWORD: rkunpass
networks:
redminenet:
volumes:
redminevol:
mysqlvol:
ポートを3000にしないと起動しないのは、ログで3000ばんで待受してますよ、としているから?
code:log
redmine-7_redmine-1 | 2022-11-16T14:19:42.653932400Z * Environment: production
redmine-7_redmine-1 | 2022-11-16T14:19:42.653953000Z * PID: 1
# ここで待ち受けてる?
redmine-7_redmine-1 | 2022-11-16T14:19:42.657930400Z Use Ctrl-C to stop
3000:3000にしたらOKだった
redmineはこういうものなのかな?
]