labunix's blog

labunixのラボUnix

debian buster上で、OpenProjectのdockerイメージ(コミュニティ版/英語)を試してみる。

■debian buster上で、OpenProjectのdockerイメージ(コミュニティ版/英語)を試してみる。
 基本的には以下と同じ。

 debian stretchにdockerを導入する。
 http://labunix.hateblo.jp/entry/20171230/1514570030

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 10 (buster)
Release:	10
Codename:	buster

$ docker -v
Docker version 19.03.2, build 6a30dfc

$ sudo systemctl status docker.service | cat
● docker.service - Docker Application Container Engine
   Loaded: loaded (/etc/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2019-09-22 15:04:54 JST; 1 day 23h ago
     Docs: https://docs.docker.com
 Main PID: 10670 (dockerd)
    Tasks: 17
   Memory: 19.5M
   CGroup: /system.slice/docker.service
           └─10670 /usr/bin/dockerd -H fd://

Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.

■プロキシの設定と「openproject/community」のダウンロード

 openproject/community
 https://hub.docker.com/r/openproject/community/

$ awk '/proxy/' /etc/default/docker
# If you need Docker to use an HTTP proxy, it can also be specified here.
#export http_proxy
export http_proxy="http://127.0.0.1:3128/"

$ docker pull openproject/community

■プロキシのログは「User-Agent:Go-http-client/1.1」として識別できる。

$ sudo awk -F\" '/"Go-http-client/{print $2,$6 | "sort -uV"}' /var/log/squid3/access.log.1
CONNECT auth.docker.io:443 HTTP/1.1 Go-http-client/1.1
CONNECT production.cloudflare.docker.com:443 HTTP/1.1 Go-http-client/1.1
CONNECT registry-1.docker.io:443 HTTP/1.1 Go-http-client/1.1

■起動してみる。
 コミュニティ版は日本語を選択できない。
 「OpenProject Docker」を参考にする場合は、
 「openpf/openproject:stable」を「openproject/community」に読み替える。

 OpenProject Community Edition
 https://www.openproject.org/docker/

 OpenProject Docker
 https://hub.docker.com/r/openpf/openproject/

$ sudo docker images | awk '/openproject|^[A-Z]/'
REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
openproject/community   latest              42d80ee9e303        2 months ago        1.94GB

$ sudo docker run -it -p 80:8080 -d openproject/community:latest
c5797260ddb017c7ac8adf181e5942ebd347e067eb37e46698f346006d0ab3fa

■行だと長くなるので、行列を入れ替えて表示
 sed文が1回だとダメなときがあるので2回入れている。

$ sudo docker ps | \
    sed -e 's/\([A-Za-z0-9,]\) \([A-Za-z0-9,]\)/\1__\2/g' \
        -e 's/\([A-Za-z0-9,]\) \([A-Za-z0-9,]\)/\1__\2/g' | \
    awk '{for(i=1;i<=NF;i++){a[i]=a[i]" "$i}}END{for(n in a){b=a[n];gsub("__"," ",b);print b}}'
 CONTAINER ID e2638983db9e
 IMAGE openproject/community:latest
 COMMAND "./docker/entrypoint…"
 CREATED 6 minutes ago
 STATUS Up 6 minutes
 PORTS 80/tcp, 5432/tcp, 0.0.0.0:8022->22/tcp, 0.0.0.0:80->8080/tcp
 NAMES suspicious_lehmann

■コンソールにアタッチして起動を待つ。

$ sudo docker attach c5797260ddb017c7ac8adf181e5942ebd347e067eb37e46698f346006d0ab3fa
-----> Starting the all-in-one OpenProject setup at /app/docker/supervisord...
-----> Database cluster not found. Creating a new one in /var/openproject/pgdata...
       The files belonging to this database system will be owned by user "postgres".
       This user must also own the server process.
       
       The database cluster will be initialized with locale "C".
       The default text search configuration will be set to "english".
       
       Data page checksums are disabled.
...途中省略...

[Ctrl]+[p],[Ctrl]+[q]で抜ける。

■tcp/80(http)でアクセス

$ ss -tln | grep :80
LISTEN    0         128                      *:80                     *:*       

■admin/adminのjoe passwordで初回ログイン時にパスワード変更を求められる。

$ w3m -no-proxy -dump http://127.0.0.1 | head -2
JavaScript disabled You need to activate JavaScript in order to use
OpenProject! Learn more

$ chromium http://127.0.0.1/

■停止(docker stop)

$ sudo docker stop quizzical_feynman
quizzical_feynman

■削除(docker rm)

$ sudo docker rm quizzical_feynman
quizzical_feynman