diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b358f20 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ + +*.iml +*.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..1d1fe94 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +Dockerfile \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 15e1c4f..60c2e41 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,24 @@ FROM ubuntu:20.04 ENV DEBIAN_FRONTEND=noninteractive -SHELL ["/bin/bash", "-c"] +EXPOSE 6200 +EXPOSE 6012 +ARG net LABEL ranchimall="ranchimallfze@gmail.com" -CMD { "echo", "Ranchi Mall" } - -## for apt to be noninteractive +# for apt to be noninteractive ENV DEBIAN_FRONTEND noninteractive ENV DEBCONF_NONINTERACTIVE_SEEN true RUN apt-get update RUN apt-get -y install python3-pip +RUN apt-get -y install nano RUN apt-get -y install git RUN apt-get -y install python-chardet python3.9 python3.9-venv RUN apt-get -y install libsecp256k1-dev libssl-dev build-essential automake pkg-config libtool libffi-dev libgmp-dev libyaml-cpp-dev -RUN apt-get install supervisor - +RUN python3 -m pip install supervisor +RUN echo_supervisord_conf +RUN echo_supervisord_conf > /etc/supervisord.conf # Installation of Pybtc, currently named as Pyflo WORKDIR ../ @@ -26,78 +28,66 @@ RUN apt-get install -y pkg-config RUN python3 setup.py install WORKDIR ../ + # Setup of Flo Token Tracker -RUN git clone https://github.com/vivekteega/ftt-docker -WORKDIR ftt-docker -#RUN python3.9 -m venv ftt -#RUN . ftt/bin/activate +RUN git clone --branch token-swap https://github.com/ranchimall/flo-token-tracking.git +RUN apt install python3.8-venv +WORKDIR flo-token-tracking RUN python3 -m pip install chardet RUN python3 -m pip install arrow +RUN python3 -m pip install sqlalchemy RUN python3 -m pip install socketio RUN python3 -m pip install requests -RUN sed -i "s|chardet==4.0.0|chardet|g" /ftt-docker/requirements.txt +RUN python3 -m venv env +RUN sed -i "s|chardet==4.0.0|chardet|g" /flo-token-tracking/requirements.txt RUN touch config.ini -RUN echo "[DEFAULT] \n\ - NET = testnet \n\ - FLO_CLI_PATH = /usr/local/bin/flo-cli \n\ - START_BLOCK = 740400" >> /ftt-docker/config.ini - RUN touch config.py -RUN echo "committeeAddressList = ['oVwmQnQGtXjRpP7dxJeiRGd5azCrJiB6Ka'] \n\ - sseAPI_url = 'https://ranchimallflo-testnet.duckdns.org/' \n\ - privKey = 'RG6Dni1fLqeT2TEFbe7RB9tuw53bDPDXp8L4KuvmYkd5JGBam6KJ' " >> /ftt-docker/config.py +RUN if [[ $net=='test' ]] ; then echo "[DEFAULT]\nNET = testnet\nFLO_CLI_PATH = /usr/local/bin/flo-cli\nSTART_BLOCK = 740400\nFLOSIGHT_NETURL = http://0.0.0.0:9000/\nTESTNET_FLOSIGHT_SERVER_LIST = http://0.0.0.0:9000/, https://testnet-flosight.duckdns.org/\nMAINNET_FLOSIGHT_SERVER_LIST = http://0.0.0.0:9495/, https://flosight.duckdns.org/\nTOKENAPI_SSE_URL = https://ranchimallflo-testnet.duckdns.org\nIGNORE_BLOCK_LIST = 902446\nIGNORE_TRANSACTION_LIST = b4ac4ddb51188b28b39bcb3aa31357d5bfe562c21e8aaf8dde0ec560fc893174" >> /flo-token-tracking/config.ini ; else echo "[DEFAULT]\nNET = testnet\nFLO_CLI_PATH = /usr/local/bin/flo-cli\nSTART_BLOCK = 740400\nFLOSIGHT_NETURL = http://0.0.0.0:9000/\nTESTNET_FLOSIGHT_SERVER_LIST = http://0.0.0.0:9000/, https://testnet-flosight.duckdns.org/\nMAINNET_FLOSIGHT_SERVER_LIST = http://0.0.0.0:9495/, https://flosight.duckdns.org/\nTOKENAPI_SSE_URL = https://ranchimallflo-testnet.duckdns.org\nIGNORE_BLOCK_LIST = 902446\nIGNORE_TRANSACTION_LIST = b4ac4ddb51188b28b39bcb3aa31357d5bfe562c21e8aaf8dde0ec560fc893174" >> /flo-token-tracking/config.ini ; fi +RUN if [[ $net=='test' ]] ; then echo "committeeAddressList = ['oVwmQnQGtXjRpP7dxJeiRGd5azCrJiB6Ka'] \nsseAPI_url = 'https://ranchimallflo-testnet.duckdns.org/' \nprivKey = 'RG6Dni1fLqeT2TEFbe7RB9tuw53bDPDXp8L4KuvmYkd5JGBam6KJ' " >> /flo-token-tracking/config.py ; else echo "committeeAddressList = ['oVwmQnQGtXjRpP7dxJeiRGd5azCrJiB6Ka'] \nsseAPI_url = 'https://ranchimallflo-testnet.duckdns.org/' \nprivKey = 'RG6Dni1fLqeT2TEFbe7RB9tuw53bDPDXp8L4KuvmYkd5JGBam6KJ' " >> /flo-token-tracking/config.py ; fi + # Setup of RanchimallFlo API +WORKDIR ../ RUN git clone https://github.com/ranchimall/ranchimallflo-api WORKDIR ranchimallflo-api RUN python3 -m pip install --upgrade pip setuptools wheel +RUN python3 -m venv env RUN python3 -m pip install -r requirements.txt RUN pip3 install apscheduler RUN touch config.py -RUN echo "dbfolder = '/home/production/dev/shivam/ranchimallflo-api' \n\ - sse_pubKey = '02b68a7ba52a499b4cb664033f511a14b0b8b83cd3b2ffcc7c763ceb9e85caabcf' \n\ - apiUrl = 'https://flosight.duckdns.org/api/' \n\ - apilayerAccesskey = '3abc51aa522420e4e185ac22733b0f30' \n\ - FLO_DATA_DIR = '/home/production/.flo' " >> /config.py +RUN echo "dbfolder = '/flo-token-tracking' \nsse_pubKey = '02b68a7ba52a499b4cb664033f511a14b0b8b83cd3b2ffcc7c763ceb9e85caabcf' \napiUrl = 'https://flosight.duckdns.org/api/' \napilayerAccesskey = '3abc51aa522420e4e185ac22733b0f30' \nFLO_DATA_DIR = '/home/production/.flo' " >> /ranchimallflo-api/config.py # Setup of Floscout +WORKDIR ../ +RUN git clone https://github.com/ranchimall/floscout.git +WORKDIR floscout +RUN rm index.html +COPY index.html . +COPY example . +RUN sed -i "s|window.tokenapiUrl = 'http://0.0.0.0:6012'|window.tokenapiUrl = $FLOAPIURL|" /floscout/index.html +WORKDIR ../ +##clientside changes +#COPY flo.sh . +#RUN chmod +x flo.sh +#RUN #flo.sh # Supervisor configurations -## Ranchimallflo configuration WORKDIR /etc/supervisor/conf.d/ -RUN touch ranchimallflo-api.conf -RUN echo "[program:ranchimallflo-api]\n\ - directory=/ranchimallflo-api\n\ - command=/ranchimallflo-api/py3.7/bin/hypercorn -w 1 -b 0.0.0.0:5009 wsgi:app\n\ - user=root\n\ - autostart=true\n\ - autorestart=true\n\ - stopasgroup=true\n\ - killasgroup=true\n\ - stderr_logfile=/var/log/ranchimallflo-api/ranchimallflo-api.err.log \n\ - stdout_logfile=/var/log/ranchimallflo-api/ranchimallflo-api.out.log" >> ranchimallflo-api.conf -RUN mkdir /var/log/ranchimallflo-api/ -RUN touch /var/log/ranchimallflo-api/ranchimallflo-api.err.log -RUN touch /var/log/ranchimallflo-api/ranchimallflo-api.out.log - -## Flo token tracking configuration -RUN touch ftt.conf -RUN echo "[program:ftt-docker]\n\ - directory=ftt-docker\n\ - command=tracktokens-smartcontracts.py\n\ - user=root\n\ - autostart=true\n\ - autorestart=true\n\ - stopasgroup=true\n\ - killasgroup=true\n\ - stderr_logfile=/var/log/flo-token-tracking/flo-token-tracking.err.log\n\ - stdout_logfile=/var/log/flo-token-tracking/flo-token-tracking.out.log" >> ftt.conf +RUN touch ftt-ranchimallflo.conf +RUN echo "[supervisord] \nnodaemon=true\n[program:flo-token-tracking]\ndirectory=/flo-token-tracking\ncommand=python3 tracktokens_smartcontracts.py --reset\nuser=root\nautostart=true\nautorestart=false\nstopasgroup=true\nkillasgroup=true\nstderr_logfile=/var/log/flo-token-tracking/flo-token-tracking.err.log\nstdout_logfile=/var/log/flo-token-tracking/flo-token-tracking.out.log\n[program:ranchimallflo-api]\ndirectory=/ranchimallflo-api\ncommand=hypercorn -w 1 -b 0.0.0.0:6012 wsgi:app\nuser=root\nautostart=true\nautorestart=true\nstopasgroup=true\nkillasgroup=true\nstderr_logfile=/var/log/ranchimallflo-api/ranchimallflo-api.err.log \nstdout_logfile=/var/log/ranchimallflo-api/ranchimallflo-api.out.log\n[program:floscout]\ndirectory=/floscout\ncommand=/floscout/example\nuser=root\nautostart=true\nautorestart=false\nstopasgroup=true\nkillasgroup=true\nstderr_logfile=/var/log/floscout/floscout.err.log\nstdout_logfile=/var/log/floscout/floscout.out.log" >> ftt-ranchimallflo.conf RUN mkdir /var/log/flo-token-tracking RUN touch /var/log/flo-token-tracking/flo-token-tracking.err.log RUN touch /var/log/flo-token-tracking/flo-token-tracking.out.log +RUN mkdir /var/log/ranchimallflo-api/ +RUN touch /var/log/ranchimallflo-api/ranchimallflo-api.err.log +RUN touch /var/log/ranchimallflo-api/ranchimallflo-api.out.log +RUN mkdir /var/log/floscout/ +RUN touch /var/log/floscout/floscout.err.log +RUN touch /var/log/floscout/floscout.out.log -# Run supervisor -RUN service supervisor restart \ No newline at end of file +COPY run.sh . +RUN chmod +x run.sh +#CMD ["/etc/supervisor/conf.d/run.sh"] \ No newline at end of file diff --git a/README.md b/README.md index e07084c..d3b3206 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,26 @@ RanchiMall wants to made things easy for you by packing all the three systems to ## How do I use this? -Clone the repository and then run +Clone the repository and build the docker image by the following command ``` sudo docker build . +``` + +Run the docker container with exposing all the port and mounting the volume + +``` +docker run -d -p 6012:6012 -p 4256:6200 +``` + +To Check if FLO-API is running + +``` +http://0.0.0.0:5009/api/v1.0/getSystemData +``` + +To Check if FLOSCOUT is running + +``` +http://0.0.0.0:4256 ``` \ No newline at end of file diff --git a/example b/example new file mode 100755 index 0000000..281d2a7 Binary files /dev/null and b/example differ diff --git a/flo.sh b/flo.sh new file mode 100644 index 0000000..780563e --- /dev/null +++ b/flo.sh @@ -0,0 +1 @@ +sed -i "s|window.tokenapiUrl = 'http://0.0.0.0:6012'|window.tokenapiUrl = '$FLOAPIURL'|" /floscout/index.html diff --git a/index.html b/index.html new file mode 100644 index 0000000..c2bf569 --- /dev/null +++ b/index.html @@ -0,0 +1,2886 @@ + + + + + + + FLO Scout + + + + +
+ Copied +
+
+ + Loading + + +

Loading

+
+
+
+

Search

+ + close + + + +
+ +
+
+
+ + + +
+ +
+
+
+ + + + + + + + + + + + \ No newline at end of file diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..ac8ae23 --- /dev/null +++ b/run.sh @@ -0,0 +1,7 @@ +#!/bin/bash +#sed -i "s|window.tokenapiUrl = 'http://0.0.0.0:6012'|window.tokenapiUrl = '$FLOAPIURL'|" /floscout/index.html +cd /etc/supervisor/conf.d/ + +echo "running..." +supervisord -c /etc/supervisor/conf.d/ftt-ranchimallflo.conf +#./floscout/example \ No newline at end of file