sioaji2012のブログ

普段は組み込み開発でC言語のみです。主にプログラムや勉強日記です

Redmineプラグインもくもく会 山梨 #000回 開発環境

Redmineプラグインの作り方を勉強したくて、もくもくです。

普段は組み込み系のお仕事ですので、Web系(IT系?)苦手ですが、やっていこうとおもうのです。

出来れば毎週水曜日もくもく会やっていきたいな。

という事で、まずはこちら。

 

開発環境

Docker for Mac

Dockerはじめてなのですが、とにかくみんな使ってる様ですので、僕も使いたい。

Docker for Mac は以前インストールしておいたので、既に使える状態です。

・・・たぶん。

 

はじめに 

わからない事だらけですが、ぐぐってとにかくやっていくスタイルです。

ひとまず、こちら。

qiita.com

僕の大好きなテンプレートプラグインを作った方の記事。

 

準備

Dockerのファイルを置くだけっぽいので、まずディレクトリ作成します。

ターミナルでユーザーディレクトリへ移動

mbp:/ sioaji$ cd

mbp:~ sioaji$

MyDockerディレクトリ(作成ずみでした・・・)

mbp:MyDocker sioaji$

redmine_my_pluginディレクトリ(こちらも作成ずみでした。昔やろうとしたみたい・・・)

mbp:redmine_my_plugin sioaji$

 

githubからファイルをダウンロードしてみる。

GitHub - akiko-pusu/redmine_issue_badge: Plugin to show the number of assigned issues with badge on top menu.

https://raw.githubusercontent.com/akiko-pusu/redmine_issue_badge/master/Dockerfile

https://raw.githubusercontent.com/akiko-pusu/redmine_issue_badge/master/docker-compose.yml

 

 

curlでダウンロード

書式:curl -O 実際のURL(上記のURL)

mbp:redmine_my_plugin sioaji$ curl -O https://raw.githubusercontent.com/akiko-pusu/redmine_issue_badge/master/Dockerfile

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

100  1469  100  1469    0     0   2831      0 --:--:-- --:--:-- --:--:--  2835

mbp:redmine_my_plugin sioaji$ ls

Dockerfile

 

mbp:redmine_my_plugin sioaji$ curl -O https://raw.githubusercontent.com/akiko-pusu/redmine_issue_badge/master/docker-compose.yml

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

100   745  100   745    0     0   1437      0 --:--:-- --:--:-- --:--:--  1435

mbp:redmine_my_plugin sioaji$ ls

Dockerfile docker-compose.yml

 

 起動してみる

$ docker-compose build

 

なんだかエラーしてそう・・・。

 *1

# 一回ビルドすると、 redmine_sqlite3というイメージができます
# あとは docker-compose up or downで起動 / 停止

 

$ docker-compose up -d

★ブランチのクローンが出来ずエラー停止してしまう。

 

-------------------------------------------------------

 今日は、ここで終わりました。 

次回は、いきなりエラー解析から。になってしまった。がーーーん。 

-------------------------------------------------------

 

*1:

mbp:redmine_my_plugin sioaji$ docker-compose build

WARNING: The REDMINE_VERSION variable is not set. Defaulting to a blank string.

Building web

Step 1/16 : FROM ruby:2.4.2

2.4.2: Pulling from library/ruby

f49cf87b52c1: Already exists

7b491c575b06: Pull complete

b313b08bab3b: Pull complete

51d6678c3f0e: Pull complete

b7e583189d20: Pull complete

08b1585eb800: Pull complete

d111d646a1da: Pull complete

Digest: sha256:7271d0cd55da37b6f28924c9452871d77e828c4d38ef3438cfc179388209e51f

Status: Downloaded newer image for ruby:2.4.2

 ---> 2a867526d472

Step 2/16 : LABEL maintainer="AKIKO TAKANO / (Twitter: @akiko_pusu)"   description="Image to run Redmine simply with sqlite to try/review plugin."

 ---> Running in 933d9109c966

Removing intermediate container 933d9109c966

 ---> 884cc8d12364

Step 3/16 : ARG REDMINE_VERSION="3.4-stable"

 ---> Running in bef0ce914af3

Removing intermediate container bef0ce914af3

 ---> 4006a4d4df42

Step 4/16 : RUN rm /bin/sh && ln -s /bin/bash /bin/sh && echo "REDMINE_VERSION: ${REDMINE_VERSION}"

 ---> Running in 9d26600cc70c

REDMINE_VERSION: :-3.4-stable

Removing intermediate container 9d26600cc70c

 ---> 1631495b43da

Step 5/16 : RUN apt-get update

 ---> Running in 13dd1ef512d1

Get:1 http://security.debian.org jessie/updates InRelease [63.1 kB]

Ign http://deb.debian.org jessie InRelease

Get:2 http://security.debian.org jessie/updates/main amd64 Packages [644 kB]

Get:3 http://deb.debian.org jessie-updates InRelease [145 kB]

Get:4 http://deb.debian.org jessie Release.gpg [2434 B]

Get:5 http://deb.debian.org jessie Release [148 kB]

Get:6 http://deb.debian.org jessie-updates/main amd64 Packages [23.1 kB]

Get:7 http://deb.debian.org jessie/main amd64 Packages [9064 kB]

Fetched 10.1 MB in 8s (1210 kB/s)

Reading package lists...

Removing intermediate container 13dd1ef512d1

 ---> 7eef7875f956

Step 6/16 : RUN apt-get install -qq -y     git vim                sqlite3

 ---> Running in f5b0e7052dcb

debconf: delaying package configuration, since apt-utils is not installed

Selecting previously unselected package libgpm2:amd64.

(Reading database ... 21202 files and directories currently installed.)

Preparing to unpack .../libgpm2_1.20.4-6.1+b2_amd64.deb ...

Unpacking libgpm2:amd64 (1.20.4-6.1+b2) ...

Selecting previously unselected package vim-common.

Preparing to unpack .../vim-common_2%3a7.4.488-7+deb8u3_amd64.deb ...

Unpacking vim-common (2:7.4.488-7+deb8u3) ...

Selecting previously unselected package sqlite3.

Preparing to unpack .../sqlite3_3.8.7.1-1+deb8u2_amd64.deb ...

Unpacking sqlite3 (3.8.7.1-1+deb8u2) ...

Selecting previously unselected package vim-runtime.

Preparing to unpack .../vim-runtime_2%3a7.4.488-7+deb8u3_all.deb ...

Adding 'diversion of /usr/share/vim/vim74/doc/help.txt to /usr/share/vim/vim74/doc/help.txt.vim-tiny by vim-runtime'

Adding 'diversion of /usr/share/vim/vim74/doc/tags to /usr/share/vim/vim74/doc/tags.vim-tiny by vim-runtime'

Unpacking vim-runtime (2:7.4.488-7+deb8u3) ...

Selecting previously unselected package vim.

Preparing to unpack .../vim_2%3a7.4.488-7+deb8u3_amd64.deb ...

Unpacking vim (2:7.4.488-7+deb8u3) ...

Processing triggers for mime-support (3.58) ...

Processing triggers for hicolor-icon-theme (0.13-1) ...

Setting up libgpm2:amd64 (1.20.4-6.1+b2) ...

Setting up vim-common (2:7.4.488-7+deb8u3) ...

Setting up sqlite3 (3.8.7.1-1+deb8u2) ...

Setting up vim-runtime (2:7.4.488-7+deb8u3) ...

Processing /usr/share/vim/addons/doc

Setting up vim (2:7.4.488-7+deb8u3) ...

update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vim (vim) in auto mode

update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vimdiff (vimdiff) in auto mode

update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/rvim (rvim) in auto mode

update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/rview (rview) in auto mode

update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vi (vi) in auto mode

update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/view (view) in auto mode

update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/ex (ex) in auto mode

update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/editor (editor) in auto mode

Processing triggers for libc-bin (2.19-18+deb8u10) ...

Removing intermediate container f5b0e7052dcb

 ---> 08e3c2253160

Step 7/16 : RUN cd /tmp && git clone --depth 1 -b ${REDMINE_VERSION} https://github.com/redmine/redmine redmine

 ---> Running in 6f0752987467

Cloning into 'redmine'...

warning: Could not find remote branch :-3.4-stable to clone.

fatal: Remote branch :-3.4-stable not found in upstream origin

ERROR: Service 'web' failed to build: The command '/bin/sh -c cd /tmp && git clone --depth 1 -b ${REDMINE_VERSION} https://github.com/redmine/redmine redmine' returned a non-zero code: 128