Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6058ea3

Browse files
committed
Using docker-compose
See#10
1 parent45ccc28 commit6058ea3

File tree

6 files changed

+43
-160
lines changed

6 files changed

+43
-160
lines changed

‎.gitignore‎

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1 @@
1-
/blib/
2-
/.build/
3-
_build/
4-
cover_db/
5-
inc/
6-
Build
7-
!Build/
8-
Build.bat
9-
.last_cover_stats
10-
/Makefile
11-
/Makefile.old
12-
/MANIFEST.bak
13-
/META.yml
14-
/META.json
15-
/MYMETA.*
16-
nytprof.out
17-
/pm_to_blib
18-
*.o
19-
*.bs
1+
/cpan/

‎README.md‎

Lines changed: 7 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -7,155 +7,21 @@ to be done better. Please use it and create Issues with your problems.
77

88
##Installation
99

10-
*[Install Docker](https://docs.docker.com/installation/)
10+
* You need docker and docker-compose. The simplest way to get them is to
11+
[install Docker Toolbox](https://www.docker.com/docker-toolbox)
1112
* Clone this repo
12-
* Build all images with the commands like:
13-
`cd cpan-api; docker build --tag cpan-api .`
13+
* Build and start everything with`./build && ./start`
14+
15+
Open your browser athttp://127.0.0.1:5001 and you will see metacpan web
16+
interface.
1417

1518
##System architecture
1619

1720
The system consists of several microservices that live in docker containers:
1821

19-
*`cpan_volume` — data volume container that shares directory`/cpan` with
22+
*`storage` — data volume container that shares directory`/cpan` with
2023
all other containers
2124
*`elasticsearch` — database
2225
*`cpan-api` — the main server — it uses`elasticsearch` and`/cpan`
2326
directory
2427
*`metacpan-web` — the web interface — it works with`cpan-api`
25-
26-
##cpan_volume
27-
28-
Everything starts from the volume`/cpan`.
29-
30-
First you need to create data volume container:
31-
32-
docker run --name cpan_volume --volume=/cpan ubuntu:14.04
33-
34-
Then it is possible to add some files to that volume. The simplest way is to
35-
use`orepan2` image. But there can be other ways to populate the`/cpan`
36-
volume. Here is a sample command that adds module from the big cpan to your
37-
`/cpan` volume:
38-
39-
docker run \
40-
--rm \
41-
--volumes-from=cpan_volume \
42-
orepan2 \
43-
orepan2-inject --author BESSARABV App::Stopwatch /cpan
44-
45-
One can inspect the content of the volume with one-shot container:
46-
47-
docker run \
48-
--rm \
49-
--volumes-from=cpan_volume \
50-
ubuntu:14.04 \
51-
find /cpan
52-
53-
The output will be something like:
54-
55-
/cpan
56-
/cpan/modules
57-
/cpan/modules/02packages.details.txt.gz
58-
/cpan/orepan2-cache.json
59-
/cpan/authors
60-
/cpan/authors/id
61-
/cpan/authors/id/B
62-
/cpan/authors/id/B/BE
63-
/cpan/authors/id/B/BE/BESSARABV
64-
/cpan/authors/id/B/BE/BESSARABV/App-Stopwatch-1.2.0.tar.gz
65-
66-
You also need to generate`00whois.xml` file. If you use logins from big cpan
67-
you can get that file from cpan:
68-
69-
docker run \
70-
--rm \
71-
--volumes-from=cpan_volume \
72-
orepan2 \
73-
curl -o /cpan/authors/00whois.xml cpan.cpantesters.org/authors/00whois.xml
74-
75-
After we have some data in`/cpan` it is possible to add webinterface to it.
76-
77-
##elasticsearch
78-
79-
First you need to run container with elasticsearch:
80-
81-
docker run \
82-
--detach \
83-
--publish 9200:9200 \
84-
--name elasticsearch \
85-
elasticsearch:1.7.3 \
86-
elasticsearch -Des.node.name='TestNode'
87-
88-
You can check that you have elasticsearch running with the command:
89-
90-
curl 127.0.0.1:9200
91-
92-
PS If you run docker on mac or windows you should change`127.0.0.1` to the ip
93-
address of our docker virtual machine (you can find out this ip with the
94-
`boot2docker ip`).
95-
96-
Here is the output you are expected to see:
97-
98-
{
99-
"ok" : true,
100-
"status" : 200,
101-
"name" : "Cage, Luke",
102-
"version" : {
103-
"number" : "0.90.7",
104-
"build_hash" : "36897d07dadcb70886db7f149e645ed3d44eb5f2",
105-
"build_timestamp" : "2013-11-13T12:06:54Z",
106-
"build_snapshot" : false,
107-
"lucene_version" : "4.5.1"
108-
},
109-
"tagline" : "You Know, for Search"
110-
}
111-
112-
##cpan-api
113-
114-
Next you need to run cpan-api server. This can be done with the command:
115-
116-
docker run \
117-
--detach \
118-
--volumes-from=cpan_volume \
119-
--link=elasticsearch:elasticsearch \
120-
--volume=`pwd`/configs/cpan-api/metacpan.pl:/cpan-api/etc/metacpan.pl \
121-
--volume=`pwd`/configs/cpan-api/metacpan_server.conf:/cpan-api/metacpan_server.conf \
122-
--env MINICPAN=/cpan \
123-
--publish 5000:5000 \
124-
--name cpan-api \
125-
cpan-api
126-
127-
So the server is running but you also need to run some scripts to index data.
128-
To do it you can create interactive container:
129-
130-
docker run \
131-
-it \
132-
--rm \
133-
--volumes-from=cpan_volume \
134-
--link=elasticsearch:elasticsearch \
135-
--volume=`pwd`/configs/cpan-api/metacpan.pl:/cpan-api/etc/metacpan.pl \
136-
--volume=`pwd`/configs/cpan-api/metacpan_server.conf:/cpan-api/metacpan_server.conf \
137-
--env MINICPAN=/cpan \
138-
cpan-api \
139-
bash
140-
141-
And then execute all the needed scripts:
142-
143-
carton exec bin/metacpan mapping --delete
144-
carton exec bin/metacpan release /cpan/authors/id/
145-
carton exec bin/metacpan latest --cpan /cpan/
146-
carton exec bin/metacpan author --cpan /cpan/
147-
148-
##metacpan-web
149-
150-
Then you need to run metacpan-web:
151-
152-
docker run \
153-
--detach \
154-
--publish 5001:5001 \
155-
--link=cpan-api:cpan-api \
156-
--volume=`pwd`/configs/metacpan-web/metacpan_web.conf:/metacpan-web/metacpan_web.conf \
157-
--name metacpan-web \
158-
metacpan-web
159-
160-
Open your browser athttp://127.0.0.1:5001 and you will see metacpan web
161-
interface.

‎build‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
time docker-compose build

‎docker-compose.yml‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
orepan2:
2+
build:orepan2/
3+
4+
storage:
5+
image:ubuntu:14.04.3
6+
volumes:
7+
-./cpan:/cpan
8+
9+
elasticsearch:
10+
image:elasticsearch:1.7.3
11+
ports:
12+
-"9200:9200"
13+
command:"elasticsearch -Des.node.name='TestNode'"
14+
15+
api:
16+
build:cpan-api/
17+
links:
18+
-elasticsearch
19+
environment:
20+
-MINICPAN=/cpan
21+
volumes:
22+
-./configs/cpan-api/metacpan.pl:/cpan-api/etc/metacpan.pl
23+
-./configs/cpan-api/metacpan_server.conf:/cpan-api/metacpan_server.conf \
24+
volumes_from:
25+
-storage
26+
ports:
27+
-"5000:5000"
28+
29+
web:
30+
build:metacpan-web/
31+
ports:
32+
-"5001:5001"

‎start‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
time docker-compose up -d

‎stop‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
time docker-compose stop; time docker-compose rm -f

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp