Skip to content

Commit

Permalink
Integrade dapp and properly set up node modules
Browse files Browse the repository at this point in the history
  • Loading branch information
tyleryasaka committed Jun 13, 2018
1 parent 38b8a2d commit 2779e15
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 18 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/dapp/
/bridge/
/js/
28 changes: 19 additions & 9 deletions container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,27 @@ RUN ../bridge-server-venv/bin/pip3.6 install kombu==4.1
# https://github.com/OriginProtocol/bridge-server/issues/74
RUN sed -i '24s/.*/ return True\n """/' /opt/bridge-server/bridge-server-venv/lib/python3.6/site-packages/ipfsapi/client.py

# install node modules
WORKDIR /opt/js
RUN git clone https://github.com/OriginProtocol/origin-js.git source
WORKDIR /opt/js/source
# js - install node modules
RUN mkdir /opt/origin-js
WORKDIR /opt/origin-js
RUN git clone https://github.com/OriginProtocol/origin-js.git temp-source
WORKDIR /opt/origin-js/temp-source
RUN git checkout develop
ENV NODE_PATH=/opt/js/node_modules
RUN npm run install:dev
RUN cp -r node_modules /opt/origin-js/node_modules

# dapp - install node modules
RUN mkdir /opt/origin-dapp
WORKDIR /opt/origin-dapp
RUN git clone https://github.com/OriginProtocol/demo-dapp.git temp-source
WORKDIR /opt/origin-dapp/temp-source
RUN git checkout develop
RUN npm run install:dev
RUN mv node_modules /opt/origin-dapp/node_modules

# Copy start scripts for js and dapp
COPY files/scripts/start-js.sh /opt/origin-js/scripts/start-js.sh
COPY files/scripts/start-dapp.sh /opt/origin-dapp/scripts/start-dapp.sh

# Elasticsearch 5.4.3 (minimum across regions, of the highest version in a region)
WORKDIR /tmp
Expand Down Expand Up @@ -114,8 +128,4 @@ RUN apt-get install -y sudo
# cleanup
RUN rm -rf /tmp/*

# Expose ports for pm2 health check endpoint, bridge server, ipfs, postgres, redis, ganache, elasticsearch
# TODO: pull these from configs
EXPOSE 4000 5000 5002 8080 8081 5432 6379 8545 9200

CMD pm2-runtime /opt/process.json --web 4000
16 changes: 9 additions & 7 deletions container/files/process.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@
"cwd" : "/opt/es",
"interpreter": "/bin/bash"
},{
"name": "origin-js",
"script": "npm",
"args": "start",
"cwd": "/opt/origin-js/source",
"env": {
"NODE_PATH": "/opt/js/node_modules"
}
"name" : "origin-js",
"script" : "start-js.sh",
"cwd" : "/opt/origin-js/scripts",
"interpreter": "/bin/bash"
},{
"name" : "origin-dapp",
"script" : "start-dapp.sh",
"cwd" : "/opt/origin-dapp/scripts",
"interpreter": "/bin/bash"
}]
}
8 changes: 8 additions & 0 deletions container/files/scripts/start-dapp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cd /opt/origin-dapp/source

# update symlink to origin
rm /usr/lib/node_modules/origin
ln -s /opt/origin-js/source /usr/lib/node_modules/origin

cp -r /opt/origin-dapp/node_modules node_modules
npm start
3 changes: 3 additions & 0 deletions container/files/scripts/start-js.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cd /opt/origin-js/source
cp -r /opt/origin-js/node_modules node_modules
npm start
7 changes: 5 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ services:
volumes:
- ./bridge:/opt/bridge-server/source
- ./js:/opt/origin-js/source
- ./dapp:/opt/origin-dapp/source
ports:
- "3000:3000"
- "4000:4000"
- "5000:5000"
- "5002:5002"
- "5432:5432"
- "6379:6379"
- "9200:9200"
- "5002:5002"
- "8080:8080"
- "8081:8081"
- "8545:8545"
- "9200:9200"
8 changes: 8 additions & 0 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ cd js
git checkout develop
cd ..

# Clone dapp source
git clone https://github.com/OriginProtocol/demo-dapp.git dapp

# Checkout dapp develop branch
cd dapp
git checkout develop
cd ..

# Copy .env file to source
cp ./container/files/config/bridge_server_dev.env ./bridge/.env

Expand Down

0 comments on commit 2779e15

Please sign in to comment.