This commit is contained in:
Ray Ozzie 2016-03-21 15:23:08 -07:00
parent 23d1839211
commit 9c5e1b8e58
4 changed files with 43 additions and 5 deletions

View File

@ -14,4 +14,4 @@ RUN ./install.sh
WORKDIR /opt/ttn-gateway/bin WORKDIR /opt/ttn-gateway/bin
# Start it up # Start it up
CMD ["sh", "-c", "pwd && ls /opt/ttn-gateway/bin && env && ./start.sh"] CMD ["sh", "-c", "env && echo && ./start.sh"]

View File

@ -11,7 +11,7 @@ WORKDIR ~/ttn-gateway
RUN ./install.sh RUN ./install.sh
# Make sure we start up within the bin directory # Make sure we start up within the bin directory
WORKDIR ~/opt/ttn-gateway/bin WORKDIR /opt/ttn-gateway/bin
# Start it up # Start it up
CMD ["sh", "-c", "env && ./start.sh"] CMD ["sh", "-c", "pwd && ls /opt/ttn-gateway/bin && env && ./start.sh"]

View File

@ -36,10 +36,10 @@ echo GATEWAY_ALT: $GATEWAY_ALT
echo "" echo ""
echo -e "{\n\t\"gateway_conf\": {\n\t\t\"gateway_ID\": \"0000000000000000\",\n\t\t\"servers\": [ { \"server_address\": \"croft.thethings.girovito.nl\", \"serv_port_up\": 1700, \"serv_port_down\": 1701, \"serv_enabled\": true } ],\n\t\t\"ref_latitude\": $GATEWAY_LAT,\n\t\t\"ref_longitude\": $GATEWAY_LON,\n\t\t\"ref_altitude\": $GATEWAY_ALT,\n\t\t\"contact_email\": \"$GATEWAY_EMAIL\",\n\t\t\"description\": \"$GATEWAY_NAME\" \n\t}\n}" >./bin/local_conf.json echo -e "{\n\t\"gateway_conf\": {\n\t\t\"gateway_ID\": \"0000000000000000\",\n\t\t\"servers\": [ { \"server_address\": \"croft.thethings.girovito.nl\", \"serv_port_up\": 1700, \"serv_port_down\": 1701, \"serv_enabled\": true } ],\n\t\t\"ref_latitude\": $GATEWAY_LAT,\n\t\t\"ref_longitude\": $GATEWAY_LON,\n\t\t\"ref_altitude\": $GATEWAY_ALT,\n\t\t\"contact_email\": \"$GATEWAY_EMAIL\",\n\t\t\"description\": \"$GATEWAY_NAME\" \n\t}\n}" >./local_conf.json
# Reset gateway ID based on MAC # Reset gateway ID based on MAC
./packet_forwarder/reset_pkt_fwd.sh start ./bin/local_conf.json ../packet_forwarder/reset_pkt_fwd.sh start ./local_conf.json
# Test the connection, wait if needed. # Test the connection, wait if needed.
while [[ $(ping -c1 google.com 2>&1 | grep " 0% packet loss") == "" ]]; do while [[ $(ping -c1 google.com 2>&1 | grep " 0% packet loss") == "" ]]; do

View File

@ -1,5 +1,43 @@
#! /bin/bash #! /bin/bash
# Configure the global and local configuration files via the environment
echo "Configuring gateway:"
if [[ $GATEWAY_NAME == "" ]]; then
echo "ERROR: NO GATEWAY_NAME FOUND IN ENVIRONMENT"
exit 1
fi
echo GATEWAY_NAME: $GATEWAY_NAME
if [[ $GATEWAY_EMAIL == "" ]]; then
echo "ERROR: NO GATEWAY_EMAIL FOUND IN ENVIRONMENT"
exit 1
fi
echo GATEWAY_EMAIL: $GATEWAY_EMAIL
if [[ $GATEWAY_LAT == "" ]]; then
echo "ERROR: NO GATEWAY_LAT (latitude) FOUND IN ENVIRONMENT"
exit 1
fi
echo GATEWAY_LAT: $GATEWAY_LAT
if [[ $GATEWAY_LON == "" ]]; then
echo "ERROR: NO GATEWAY_LON (longitude) FOUND IN ENVIRONMENT"
exit 1
fi
echo GATEWAY_LON: $GATEWAY_LON
if [[ $GATEWAY_ALT == "" ]]; then
echo "ERROR: NO GATEWAY_ALT (altitude) FOUND IN ENVIRONMENT"
exit 1
fi
echo GATEWAY_ALT: $GATEWAY_ALT
echo ""
echo -e "{\n\t\"gateway_conf\": {\n\t\t\"gateway_ID\": \"0000000000000000\",\n\t\t\"servers\": [ { \"server_address\": \"croft.thethings.girovito.nl\", \"serv_port_up\": 1700, \"serv_port_down\": 1701, \"serv_enabled\": true } ],\n\t\t\"ref_latitude\": $GATEWAY_LAT,\n\t\t\"ref_longitude\": $GATEWAY_LON,\n\t\t\"ref_altitude\": $GATEWAY_ALT,\n\t\t\"contact_email\": \"$GATEWAY_EMAIL\",\n\t\t\"description\": \"$GATEWAY_NAME\" \n\t}\n}" >./bin/local_conf.json
# Reset gateway ID based on MAC # Reset gateway ID based on MAC
./packet_forwarder/reset_pkt_fwd.sh start ./bin/local_conf.json ./packet_forwarder/reset_pkt_fwd.sh start ./bin/local_conf.json