Skip to content

Migrate startup architecture to TS#157

Merged
dapplion merged 27 commits intov0.2.6from
startup-js
Jul 22, 2020
Merged

Migrate startup architecture to TS#157
dapplion merged 27 commits intov0.2.6from
startup-js

Conversation

@dapplion
Copy link
Contributor

@dapplion dapplion commented Jul 14, 2020

This PR attempts to make VPN startup architecture more resilient. It introduces 4 main changes:

New process structure

  • One main NodeJS process,
  • who manages internally the OpenVPN binary
  • who serves the static files

Global ENVs are polled, not pushed

Instead of waiting to be reseted, the VPN will poll a DAPPMANAGER API for global ENVs:

GET http://dappmanager.dappnode/global-envs/hostname

RETURNS "hostname"
GET http://dappmanager.dappnode/global-envs/internal_ip

RETURNS "internal_ip"
  • Change DAPPMANAGER initializeDb to not restart the VPN
  • Make sure logs persist after the VPN process.exit(1) itself

Startup script in Javascript

Write the entrypoint inside the NodeJS app, so it can be smarter and not stall. It can also report it's status via the NodeJS app to the DAPPMANAGER > ADMIN:

GET http://vpn.dappnode/status

RETURNS "Polling configuration" ||
        "DAPPMANAGER not available" ||
        "OpenVPN error"

Deprecate the loginMsg file

Instead of waiting for a file to exist, periodically query the VPN status endpoint and eventually request the admin credentials to be generated.

@dapplion dapplion requested a review from vdo July 14, 2020 10:39
@dapplion dapplion merged commit 67bfa32 into v0.2.6 Jul 22, 2020
@dapplion dapplion deleted the startup-js branch July 22, 2020 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants