-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
135 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# Syndicate gateways for node.js | ||
# | ||
# VERSION 1.0 | ||
|
||
FROM ubuntu:14.04 | ||
MAINTAINER Illyoung Choi <[email protected]> | ||
|
||
############################################## | ||
# Setup utility packages | ||
############################################## | ||
|
||
RUN apt-get update | ||
RUN apt-get install -y wget unzip | ||
RUN apt-get install -y python-pip | ||
|
||
############################################## | ||
# Setup a Syndicate account | ||
############################################## | ||
ENV HOME /home/syndicate | ||
|
||
RUN useradd syndicate && echo 'syndicate:docker' | chpasswd | ||
RUN echo "syndicate ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers | ||
RUN mkdir /home/syndicate | ||
RUN chown -R syndicate:syndicate $HOME | ||
|
||
############################################## | ||
# build essentials | ||
############################################## | ||
RUN apt-get install -y build-essential | ||
|
||
############################################## | ||
# fskit | ||
############################################## | ||
RUN apt-get install -y libfuse-dev libattr1-dev | ||
|
||
USER syndicate | ||
WORKDIR $HOME | ||
|
||
RUN wget -O fskit.zip https://github.com/jcnelson/fskit/archive/master.zip | ||
RUN unzip fskit.zip | ||
RUN mv fskit-master fskit | ||
WORKDIR "fskit" | ||
RUN make | ||
|
||
USER root | ||
RUN make install | ||
|
||
############################################## | ||
# syndicate | ||
############################################## | ||
RUN apt-get install -y protobuf-compiler libprotobuf-dev libcurl4-gnutls-dev libmicrohttpd-dev libjson0-dev valgrind cython python-protobuf libssl-dev python-crypto python-requests | ||
RUN pip install pika python-irodsclient retrying timeout_decorator | ||
|
||
USER syndicate | ||
WORKDIR $HOME | ||
|
||
RUN wget -O syndicate.zip https://github.com/jcnelson/syndicate/archive/master.zip | ||
RUN unzip syndicate.zip | ||
RUN mv syndicate-master syndicate | ||
WORKDIR "syndicate" | ||
RUN make | ||
|
||
USER root | ||
RUN make -C libsyndicate install | ||
RUN make -C libsyndicate-ug install | ||
RUN make -C python install | ||
|
||
WORKDIR $HOME/syndicate/gateways/acquisition | ||
RUN make install | ||
|
||
WORKDIR $HOME/syndicate/gateways/user | ||
RUN make install | ||
|
||
expose $GATEWAY_PORT$ | ||
|
||
WORKDIR $HOME | ||
|
||
############################################## | ||
# node.js | ||
############################################## | ||
RUN apt-get install -y curl | ||
RUN curl -sL https://deb.nodesource.com/setup_4.x | bash - | ||
RUN apt-get install -y nodejs | ||
|
||
RUN npm install ffi ref ref-struct ref-array | ||
|
||
RUN wget -O libsyndicate-node.js.zip https://github.com/syndicate-storage/libsyndicate-node.js/archive/master.zip | ||
RUN unzip libsyndicate-node.js.zip | ||
RUN mv libsyndicate-node.js-master libsyndicate-node.js | ||
|
||
USER syndicate | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Syndicate Gateway Docker Image for Node.js | ||
|
||
Build a Docker Image | ||
-------------------- | ||
|
||
Make sure that you install docker and have access rights to run docker before get started. | ||
|
||
Run build.sh to start building a docker image. | ||
``` | ||
sudo build.sh | ||
``` | ||
|
||
You can also specify a port number you want to use for the gateway and a name of docker image. | ||
``` | ||
sudo build.sh 31112 syndicate-gateways-nodejs-31112 | ||
``` | ||
|
||
|
||
A new docker image for Syndicate Gateway will have a name "syndicate-gateways-nodejs" by default. The docker image created will have Syndicate installed and an user "syndicate". | ||
|
||
You can run the image in interactive mode by following command. | ||
``` | ||
sudo docker run -t -i -p 31111:31111 syndicate-gateways-nodejs | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
GATEWAY_PORT=31111 | ||
IMAGE_NAME="syndicate-gateways-nodejs" | ||
if [ "$#" -ge 1 ]; then | ||
GATEWAY_PORT=$1 | ||
fi | ||
|
||
if [ "$#" -ge 2 ]; then | ||
IMAGE_NAME=$2 | ||
fi | ||
|
||
# copy from template | ||
cp Dockerfile.template Dockerfile | ||
PARAM='s/\$GATEWAY_PORT\$/'$GATEWAY_PORT'/g' | ||
sed -i $PARAM Dockerfile | ||
|
||
#docker build --no-cache -t $IMAGE_NAME . | ||
docker build -t $IMAGE_NAME . |