Skip to content

Commit 5351d7d

Browse files
authored
Create DOCKER-README.md
1 parent 4005235 commit 5351d7d

1 file changed

Lines changed: 123 additions & 0 deletions

File tree

fri/DOCKER-README.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# Building FRI Container
2+
3+
Now, we elaborate on building FRI as a container, together with the Kong API Gateway.
4+
5+
Connect to the Server VM, assuming x.x.x.x to be the IP address of your server.
6+
````
7+
$ ssh -i "controlcore.pem" ubuntu@x.x.x.x
8+
````
9+
Perform Git clone if this is the first time you are configuring the Server
10+
````
11+
$ git clone git@github.com/ControlCore-Project/concore.git
12+
````
13+
14+
First build the Docker Container of the FRI.
15+
````
16+
$ git pull
17+
18+
$ sudo docker build -t fri .
19+
````
20+
21+
# Running Control-Core FRI with Kong as containers
22+
23+
If you are already running FRI, make sure to stop and clear existing FRI container as it is likely conflict with the port. If there is Kong gateway running in default ports, stop and clear it too.
24+
````
25+
$ docker stop fri
26+
$ docker rm fri
27+
$ docker stop kong
28+
$ docker rm kong
29+
````
30+
31+
Start and configure Cassandra container for Kong API.
32+
````
33+
$ docker run -d --name kong-database \
34+
-p 9042:9042 \
35+
cassandra:3
36+
37+
38+
$ docker run --rm \
39+
--link kong-database:kong-database \
40+
-e "KONG_DATABASE=cassandra" \
41+
-e "KONG_PG_HOST=kong-database" \
42+
-e "KONG_PG_USER=kong" \
43+
-e "KONG_PG_PASSWORD=kong" \
44+
-e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" \
45+
kong kong migrations bootstrap
46+
````
47+
48+
Start Kong
49+
````
50+
$ docker run -d --name kong \
51+
--link kong-database:kong-database \
52+
-e "KONG_DATABASE=cassandra" \
53+
-e "KONG_PG_HOST=kong-database" \
54+
-e "KONG_PG_PASSWORD=kong" \
55+
-e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" \
56+
-e "KONG_PROXY_ACCESS_LOG=/dev/stdout" \
57+
-e "KONG_ADMIN_ACCESS_LOG=/dev/stdout" \
58+
-e "KONG_PROXY_ERROR_LOG=/dev/stderr" \
59+
-e "KONG_ADMIN_ERROR_LOG=/dev/stderr" \
60+
-e "KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl" \
61+
-p 80:8000 \
62+
-p 8443:8443 \
63+
-p 8001:8001 \
64+
-p 8444:8444 \
65+
kong
66+
````
67+
68+
Start FRI container
69+
````
70+
$ nohup sudo docker run --name fri -p 8090:8081 fri > controlcore.out &
71+
````
72+
73+
Delete if there is a previously configured Kong service. If not, skip this step. First you need to find the ID-VALUE for the route with a GET command before deleting the route and service.
74+
````
75+
$ curl -X GET "http://localhost:8001/services/fri/routes"
76+
````
77+
Use the ID output from above to issue the delete command as below (issue this only if you have a previous conflicting service definiton in kong. Otherwise, skip this step):
78+
````
79+
$ curl -X DELETE "http://localhost:8001/services/fri/routes/ID-VALUE"
80+
81+
$ curl -X DELETE "http://localhost:8001/services/fri/"
82+
````
83+
84+
Define Kong Service and Route.
85+
86+
First Configure a Kong service, replacing the variable "private-ip" with the private IP address of your server below.
87+
````
88+
$ curl -i -X POST --url http://localhost:8001/services/ --data 'name=fri' --data 'url=http://private-ip:8090'
89+
````
90+
Then configure route to the service
91+
````
92+
$ curl -i -X POST --url http://localhost:8001/services/fri/routes --data 'paths=/'
93+
````
94+
95+
Now, controlcore.org is routed through the Kong APIs.
96+
97+
98+
# Troubleshooting the FRI
99+
100+
Connect to the Server VM
101+
````
102+
$ ssh -i "controlcore.pem" ubuntu@x.x.x.x
103+
````
104+
Check the Server logs.
105+
````
106+
$ tail -f controlcore.out
107+
````
108+
or
109+
````
110+
$ sudo docker logs fri -f
111+
````
112+
Find the FRI docker container
113+
````
114+
$ sudo docker ps
115+
````
116+
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
117+
dfdd3b3d3308 fri "python main.py" 38 minutes ago Up 38 minutes 0.0.0.0:80->80/tcp fri
118+
119+
Access the container
120+
````
121+
$ sudo docker exec -it dfdd /bin/bash
122+
````
123+

0 commit comments

Comments
 (0)