dind: Set DELTA_ENDPOINT, insert variant into os-release, and fix vpn apikeys

Setting DELTA_ENDPOINT as meta-resin does allows the dev dind supervisor to use the correct
delta server.

Inserting a VARIANT_ID into /etc/os-release allows treating this device as a dev build of Resin OS
(and avoids an unhandled exception).

Changing the precedence for device/provisioning apikeys in the vpn-init script allows the device
to connect to the VPN when a key exchange is still pending (as meta-resin does - though this is getting
replaced by watching config.json for changes).

This at least makes the development supervisor functional for now, but I'll work on improving the dind setup soon.

Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
This commit is contained in:
Pablo Carranza Velez 2017-06-26 17:17:25 -07:00
parent a6409f0e12
commit 0078c299b4
4 changed files with 4 additions and 1 deletions

View File

@ -30,6 +30,7 @@ RUN passwd -d root
# Change os release to a resin-sync compatible one
RUN sed -i 's/\(PRETTY_NAME=\).*/\1"ResinOS 1.2.1+dind"/' /etc/os-release
RUN echo 'VARIANT_ID="dev"' >> /etc/os-release
COPY config/openvpn/ /etc/openvpn/
COPY config/dropbear/config /etc/default/dropbear

View File

@ -26,6 +26,7 @@ ExecStart=/bin/bash -c 'source /usr/src/app/resin-vars && \
-v /etc/resolv.conf:/etc/resolv.conf:rw \
${SUPERVISOR_EXTRA_MOUNTS} \
-e "API_ENDPOINT=$API_ENDPOINT" \
-e "DELTA_ENDPOINT=$DELTA_ENDPOINT" \
-e "REGISTRY_ENDPOINT=$REGISTRY_ENDPOINT" \
-e "PUBNUB_SUBSCRIBE_KEY=$PUBNUB_SUBSCRIBE_KEY" \
-e "PUBNUB_PUBLISH_KEY=$PUBNUB_PUBLISH_KEY" \

View File

@ -44,6 +44,7 @@ fi
if [ -f $CONFIG_PATH ]
then
API_ENDPOINT=$(jq --raw-output ".apiEndpoint" $CONFIG_PATH)
DELTA_ENDPOINT=$(jq --raw-output ".deltaEndpoint" $CONFIG_PATH)
LISTEN_PORT=$(jq --raw-output ".listenPort" $CONFIG_PATH)
MIXPANEL_TOKEN=$(jq --raw-output ".mixpanelToken" $CONFIG_PATH)
PUBNUB_PUBLISH_KEY=$(jq --raw-output ".pubnubPublishKey" $CONFIG_PATH)

View File

@ -7,7 +7,7 @@ while true; do
echo "UUID missing from config file, VPN cannot connect"
sleep 2
else
read uuid api_key <<<$(jq -r '.uuid,.deviceApiKey // .apiKey' $CONFIG_PATH)
read uuid api_key <<<$(jq -r '.uuid,.apiKey // .deviceApiKey' $CONFIG_PATH)
mkdir -p /var/volatile/
echo $uuid > /var/volatile/vpnfile
echo $api_key >> /var/volatile/vpnfile