From e8cc3d459a871410cd2c80e3e308bc5f996308d7 Mon Sep 17 00:00:00 2001 From: Divyansh Bhardwaj <87605149+Dbhardwaj99@users.noreply.github.com> Date: Sat, 18 Jun 2022 17:17:40 +0530 Subject: [PATCH] Added if else for network change --- Dockerfile | 17 +++++++++++------ flo.sh | 1 + mongoose.sh | 5 ----- run.sh | 1 + 4 files changed, 13 insertions(+), 11 deletions(-) create mode 100644 flo.sh delete mode 100755 mongoose.sh diff --git a/Dockerfile b/Dockerfile index ba2c4e5..60c2e41 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,7 @@ FROM ubuntu:20.04 ENV DEBIAN_FRONTEND=noninteractive EXPOSE 6200 EXPOSE 6012 +ARG net LABEL ranchimall="ranchimallfze@gmail.com" @@ -40,12 +41,12 @@ RUN python3 -m pip install requests 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]\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 - RUN touch config.py -RUN echo "committeeAddressList = ['oVwmQnQGtXjRpP7dxJeiRGd5azCrJiB6Ka'] \nsseAPI_url = 'https://ranchimallflo-testnet.duckdns.org/' \nprivKey = 'RG6Dni1fLqeT2TEFbe7RB9tuw53bDPDXp8L4KuvmYkd5JGBam6KJ' " >> /flo-token-tracking/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 @@ -65,11 +66,15 @@ 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 -## Flo token tracking configuration -## Ranchimallflo configuration WORKDIR /etc/supervisor/conf.d/ 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 @@ -85,4 +90,4 @@ RUN touch /var/log/floscout/floscout.out.log COPY run.sh . RUN chmod +x run.sh -CMD ["/etc/supervisor/conf.d/run.sh"] \ No newline at end of file +#CMD ["/etc/supervisor/conf.d/run.sh"] \ No newline at end of file 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/mongoose.sh b/mongoose.sh deleted file mode 100755 index a64a132..0000000 --- a/mongoose.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -cd /floscout - -echo "mongoose server is up...." -./example diff --git a/run.sh b/run.sh index c44c5ce..ac8ae23 100755 --- a/run.sh +++ b/run.sh @@ -1,4 +1,5 @@ #!/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..."