-
Notifications
You must be signed in to change notification settings - Fork 60
CCFE (Dev Mode) Docker
Naresh Kumar Vudutha edited this page Mar 11, 2019
·
2 revisions
This document explains how to run CCFE (in development mode) with Docker
- Docker environment up & Running
At the end of this exercise, you will have a CCFE running in dev mode under docker on your localhost on 8090 port
- Get the source code of CCFE
[nareshv@localhost Opensource]$ git clone https://github.com/linkedin/cruise-control-ui
Cloning into 'cruise-control-ui'...
remote: Enumerating objects: 37, done.
remote: Counting objects: 100% (37/37), done.
remote: Compressing objects: 100% (29/29), done.
remote: Total 128 (delta 16), reused 14 (delta 6), pack-reused 91
Receiving objects: 100% (128/128), 1.98 MiB | 3.83 MiB/s, done.
Resolving deltas: 100% (32/32), done.
- Create
Dockerfile
(if not in repo)
[nareshv@localhost Opensource]$ cd cruise-control-ui/
[nareshv@localhost cruise-control-ui]$ vi Dockerfile
FROM node:10
WORKDIR /opt/cruise-control-ui
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 8090
CMD [ "npm", "run", "dev" ]
- Create
.dockerignore
(if not in repo)
[nareshv@localhost cruise-control-ui]$ vim .dockerignore
node_modules
npm-debug.log
- Build the image from local source code
[nareshv@localhost cruise-control-ui]$ docker build -t nareshv/cruise-control-ui .
Sending build context to Docker daemon 5.148 MB
Step 1/7 : FROM node:10
Trying to pull repository docker.io/library/node ...
sha256:af3c419f9939f241c89db419e2e2741d5ae87269464d20cbefaf563561dbfbf0: Pulling from docker.io/library/node
22dbe790f715: Pull complete
0250231711a0: Pull complete
6fba9447437b: Pull complete
c2b4d327b352: Pull complete
270e1baa5299: Pull complete
08ba2f9dd763: Pull complete
c5e50fc67865: Pull complete
63de957fae37: Pull complete
Digest: sha256:af3c419f9939f241c89db419e2e2741d5ae87269464d20cbefaf563561dbfbf0
Status: Downloaded newer image for docker.io/node:10
---> 8c10e6cc3f51
Step 2/7 : WORKDIR /opt/cruise-control-ui
---> 891f786d8938
Removing intermediate container 960588fb06a4
Step 3/7 : COPY package*.json ./
---> b855a761ca1c
Removing intermediate container fceb2077c58a
Step 4/7 : RUN npm install
---> Running in 3cce770bc79b
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
added 1136 packages from 641 contributors and audited 8411 packages in 33.132s
found 1 low severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details
---> 637e3da4cbd1
Removing intermediate container 3cce770bc79b
Step 5/7 : COPY . .
---> a77230c4167f
Removing intermediate container df1e2f4287e1
Step 6/7 : EXPOSE 8090
---> Running in 0fd5bbe18920
---> 7b122b104b8c
Removing intermediate container 0fd5bbe18920
Step 7/7 : CMD npm run dev
---> Running in 08ba71a2d3bf
---> a0f7040619b5
Removing intermediate container 08ba71a2d3bf
Successfully built a0f7040619b5
- Verify the image thats just built
[U@localhost cruise-control-ui]$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nareshv/cruise-control-ui latest a0f7040619b5 19 seconds ago 1.06 GB
docker.io/node 10 8c10e6cc3f51 2 days ago 899 MB
- Start the CCFE (dev mode)
[nareshv@localhost cruise-control-ui]$ docker run -p 8090:8090 -d nareshv/cruise-control-ui
0302d941b5d3a61990ed00038ba69f357b4705fdc6eb9164e99bd7d790852528
[nareshv@localhost cruise-control-ui]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0302d941b5d3 nareshv/cruise-control-ui "npm run dev" 3 seconds ago Up 2 seconds 0.0.0.0:8090->8090/tcp serene_goodall
- Verify the app by fetching config
[nareshv@localhost cruise-control-ui]$ curl http://localhost:8090/static/config.csv
dev,dev,/kafkacruisecontrol/
- Open CCFE in browser
Open http://localhost:8090 and you should see CCFE running.
NOTE: As part of the build step-4, please create appropriate static/config.csv
URL contents which has right CC REST API values.
NOTE (Reverse Proxy): This example doesn't work with Reverse proxy method as we are running CCFE in Development mode within Docker
NOTE (CORS): Please use absolute URLS in static/config.csv
. This also requires additional setup of CC as mentioned in wiki