Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migration #2509

Merged
merged 34 commits into from
Aug 14, 2023
Merged

migration #2509

merged 34 commits into from
Aug 14, 2023

Conversation

mattkasun
Copy link
Contributor

No description provided.

mattkasun and others added 21 commits August 1, 2023 06:21
* enforce unique names for ext client names

* only check for unique id on creation

* check for unique id if changed
* enforce unique names for ext client names

* only check for unique id on creation

* check for unique id if changed

* validate network parameter passed to node endpoints

---------

Co-authored-by: Abhishek K <32607604+abhishek9686@users.noreply.github.com>
nm-certs.sh now requests certificate for EE and CE edition domains accordingly.
* Add limited http handlers functionality to rest handler

* Export ee.errValidation (ee.ErrValidation)

* Export a fatal error handled by the hook manager

* Export a new status variable for unlicensed server

* Mark server as unlicensed when ee checks fail

* Handle license validation failures with a (re)boot in a limited state

* Revert "Export a fatal error handled by the hook manager"

This reverts commit 069c219.

* Revert "Export ee.errValidation (ee.ErrValidation)"

This reverts commit 59dbab8.

* Revert "Add limited http handlers functionality to rest handler"

This reverts commit e2f1f28.

* Revert "Handle license validation failures with a (re)boot in a limited state"

This reverts commit 58cfbba.

* Revert "Mark server as unlicensed when ee checks fail"

This reverts commit 77c6dbd.

* Handle license validation failures with a middleware

* Forbid responses if unlicensed ee and not in status api

* Remove unused func
* Introduce config for environment

* Introduce func to get environment

* Choose accounts api host from environment

* Test the ee package on workflows

* Use build tag ee for license_test.go
* domain flag for auto installs

* use static servers with custom domain (#2421)

* send delete peer update always

* fix add/remove host api calls

* keep mq updates in a single go func

* move branch test logic to devops (#2443)

* handle IOT OS

* save server name to env (#2460)

* ensure branch test servers available after test runs (#2467)

* save server name to env

* free server always; add PR to discord messages

* use correct method to delete droplets (#2468)

* quick fix for the launcher

* removed exit when triggering not supported exit and removed the TODO comments related to this issue

---------

Co-authored-by: Matthew R Kasun <mkasun@nusak.ca>
Co-authored-by: Alex Feiszli <31018251+afeiszli@users.noreply.github.com>
Co-authored-by: Christopher Blaha <crispspiceguitar@gmail.com>
Co-authored-by: Abhishek Kondur <abhi281342@gmail.com>
Co-authored-by: Abhishek K <32607604+abhishek9686@users.noreply.github.com>
@mattkasun mattkasun changed the base branch from master to develop August 9, 2023 12:32
@mattkasun mattkasun marked this pull request as draft August 9, 2023 12:32
@mattkasun mattkasun marked this pull request as ready for review August 9, 2023 17:15
controllers/migrate.go Show resolved Hide resolved
controllers/migrate.go Show resolved Hide resolved
controllers/migrate.go Outdated Show resolved Hide resolved
scripts/nm-upgrade.sh Outdated Show resolved Hide resolved
scripts/nm-upgrade.sh Outdated Show resolved Hide resolved
scripts/nm-upgrade.sh Outdated Show resolved Hide resolved
@abhishek9686 abhishek9686 merged commit 5c38b5b into develop Aug 14, 2023
15 checks passed
mattkasun added a commit that referenced this pull request Aug 14, 2023
* create gateways during migration

* set version for testing

* restruct migration

* debug logging

* enforce unique names for ext client names (#2476)

* enforce unique names for ext client names

* only check for unique id on creation

* check for unique id if changed

* prune(NET-483): remove defunct host.internetgateway field (#2487)

* don't reference host on err (#2493)

* deprecrate netclient install scripts (#2490)

* Net 500: validate network parameter passed to node endpoints (#2480)

* enforce unique names for ext client names

* only check for unique id on creation

* check for unique id if changed

* validate network parameter passed to node endpoints

---------

Co-authored-by: Abhishek K <32607604+abhishek9686@users.noreply.github.com>

* NET-513 (#2492)

nm-certs.sh now requests certificate for EE and CE edition domains accordingly.

* [NET-404] Run in limited mode when ee checks fail (#2474)

* Add limited http handlers functionality to rest handler

* Export ee.errValidation (ee.ErrValidation)

* Export a fatal error handled by the hook manager

* Export a new status variable for unlicensed server

* Mark server as unlicensed when ee checks fail

* Handle license validation failures with a (re)boot in a limited state

* Revert "Export a fatal error handled by the hook manager"

This reverts commit 069c219.

* Revert "Export ee.errValidation (ee.ErrValidation)"

This reverts commit 59dbab8.

* Revert "Add limited http handlers functionality to rest handler"

This reverts commit e2f1f28.

* Revert "Handle license validation failures with a (re)boot in a limited state"

This reverts commit 58cfbba.

* Revert "Mark server as unlicensed when ee checks fail"

This reverts commit 77c6dbd.

* Handle license validation failures with a middleware

* Forbid responses if unlicensed ee and not in status api

* Remove unused func

* feat(NET-449): add sync feature to request a host pull from server (#2491)

* fix(NET-486): change client name length validation (#2498)

set limit to 5<=x<=32

* [NET-477] Pick AMB URL dynamically (#2489)

* Introduce config for environment

* Introduce func to get environment

* Choose accounts api host from environment

* Test the ee package on workflows

* Use build tag ee for license_test.go

* [Feature]: nm-quick script tackling arm TODO support (#2488)

* domain flag for auto installs

* use static servers with custom domain (#2421)

* send delete peer update always

* fix add/remove host api calls

* keep mq updates in a single go func

* move branch test logic to devops (#2443)

* handle IOT OS

* save server name to env (#2460)

* ensure branch test servers available after test runs (#2467)

* save server name to env

* free server always; add PR to discord messages

* use correct method to delete droplets (#2468)

* quick fix for the launcher

* removed exit when triggering not supported exit and removed the TODO comments related to this issue

---------

Co-authored-by: Matthew R Kasun <mkasun@nusak.ca>
Co-authored-by: Alex Feiszli <31018251+afeiszli@users.noreply.github.com>
Co-authored-by: Christopher Blaha <crispspiceguitar@gmail.com>
Co-authored-by: Abhishek Kondur <abhi281342@gmail.com>
Co-authored-by: Abhishek K <32607604+abhishek9686@users.noreply.github.com>

* rebase conflict

* include pass and os in mirgration data

* node network ranges

* remove debugging logs

* add gateways

* use sent node

* upgrade shell script

* associate node to host during migration

* add node to host.Nodes and publish peer update

* save host outside loop

* fix script name

* simplify upgrade script

* don't migrate relays

* simplify upgrade script even more

* guard against blank address or address6

* typos

---------

Co-authored-by: Aceix <aceixsmartX@gmail.com>
Co-authored-by: Abhishek K <32607604+abhishek9686@users.noreply.github.com>
Co-authored-by: Farukh Khan <farukhkhan21@gmail.com>
Co-authored-by: Gabriel de Souza Seibel <gabrielseibel1@gmail.com>
Co-authored-by: bornav <51048565+bornav@users.noreply.github.com>
Co-authored-by: Alex Feiszli <31018251+afeiszli@users.noreply.github.com>
Co-authored-by: Christopher Blaha <crispspiceguitar@gmail.com>
Co-authored-by: Abhishek Kondur <abhi281342@gmail.com>
abhishek9686 added a commit that referenced this pull request Aug 25, 2023
* use NewHosts to init hostfile

* Revert "Bump github.com/txn2/txeh from 1.4.0 to 1.5.3 (#2464)" (#2475)

This reverts commit aafaa91.

* NET-433: Only Set Routes for NAT enabled egress GW (#2469)

* remove related fields and code

* remover metrics collection from server code

* fw update struct

* add ext client flag to metrics data

* simply nat types

* rm proxy update from cli

* remove ingress routes from firewall update

* check if egress ranges are present

* rm unused func

* ignore network parameter passed to delete ingress endpoint (#2471)

* fix(NET-388): fix to update node dns toggle (#2472)

* use local port for metrics pinger (#2479)

* v0.20.5 release notes (#2482)

* v0.20.5 release notes

* add a known issue

* update develop to v0.20.6 (#2485)

* enforce unique names for ext client names (#2476)

* enforce unique names for ext client names

* only check for unique id on creation

* check for unique id if changed

* prune(NET-483): remove defunct host.internetgateway field (#2487)

* don't reference host on err (#2493)

* deprecrate netclient install scripts (#2490)

* Net 500: validate network parameter passed to node endpoints (#2480)

* enforce unique names for ext client names

* only check for unique id on creation

* check for unique id if changed

* validate network parameter passed to node endpoints

---------

Co-authored-by: Abhishek K <32607604+abhishek9686@users.noreply.github.com>

* NET-513 (#2492)

nm-certs.sh now requests certificate for EE and CE edition domains accordingly.

* [NET-404] Run in limited mode when ee checks fail (#2474)

* Add limited http handlers functionality to rest handler

* Export ee.errValidation (ee.ErrValidation)

* Export a fatal error handled by the hook manager

* Export a new status variable for unlicensed server

* Mark server as unlicensed when ee checks fail

* Handle license validation failures with a (re)boot in a limited state

* Revert "Export a fatal error handled by the hook manager"

This reverts commit 069c219.

* Revert "Export ee.errValidation (ee.ErrValidation)"

This reverts commit 59dbab8.

* Revert "Add limited http handlers functionality to rest handler"

This reverts commit e2f1f28.

* Revert "Handle license validation failures with a (re)boot in a limited state"

This reverts commit 58cfbba.

* Revert "Mark server as unlicensed when ee checks fail"

This reverts commit 77c6dbd.

* Handle license validation failures with a middleware

* Forbid responses if unlicensed ee and not in status api

* Remove unused func

* feat(NET-449): add sync feature to request a host pull from server (#2491)

* fix(NET-486): change client name length validation (#2498)

set limit to 5<=x<=32

* [NET-477] Pick AMB URL dynamically (#2489)

* Introduce config for environment

* Introduce func to get environment

* Choose accounts api host from environment

* Test the ee package on workflows

* Use build tag ee for license_test.go

* [Feature]: nm-quick script tackling arm TODO support (#2488)

* domain flag for auto installs

* use static servers with custom domain (#2421)

* send delete peer update always

* fix add/remove host api calls

* keep mq updates in a single go func

* move branch test logic to devops (#2443)

* handle IOT OS

* save server name to env (#2460)

* ensure branch test servers available after test runs (#2467)

* save server name to env

* free server always; add PR to discord messages

* use correct method to delete droplets (#2468)

* quick fix for the launcher

* removed exit when triggering not supported exit and removed the TODO comments related to this issue

---------

Co-authored-by: Matthew R Kasun <mkasun@nusak.ca>
Co-authored-by: Alex Feiszli <31018251+afeiszli@users.noreply.github.com>
Co-authored-by: Christopher Blaha <crispspiceguitar@gmail.com>
Co-authored-by: Abhishek Kondur <abhi281342@gmail.com>
Co-authored-by: Abhishek K <32607604+abhishek9686@users.noreply.github.com>

* Bump github.com/go-playground/validator/v10 from 10.14.1 to 10.15.0 (#2503)

Bumps [github.com/go-playground/validator/v10](https://github.com/go-playground/validator) from 10.14.1 to 10.15.0.
- [Release notes](https://github.com/go-playground/validator/releases)
- [Commits](go-playground/validator@v10.14.1...v10.15.0)

---
updated-dependencies:
- dependency-name: github.com/go-playground/validator/v10
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump golang.org/x/oauth2 from 0.10.0 to 0.11.0 (#2502)

Bumps [golang.org/x/oauth2](https://github.com/golang/oauth2) from 0.10.0 to 0.11.0.
- [Commits](golang/oauth2@v0.10.0...v0.11.0)

---
updated-dependencies:
- dependency-name: golang.org/x/oauth2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump alpine from 3.18.2 to 3.18.3 (#2500)

Bumps alpine from 3.18.2 to 3.18.3.

---
updated-dependencies:
- dependency-name: alpine
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Net 509 515 (#2496)

* NET-509

* External client config files with IPv6 endpoints now have the [] separating the address and port.

* NET-515

* Increased network name max length to 32

* NET-509-515

* Updated unit test for network name max length check.

* Updated extclient endpoint ip string manipulation to use sprintf

* Added proper error message for network name length more than max allowed.

* NET-515 small typo fix for error strings should not be capitalized

* [NET-494 / ACC-322] New free tier limits (#2495)

* Rename var

* Rename consts and use iota

* Use switch instead of repeated else if

* Rename limits related vars

* Introduce new free tier limits

* Measure new limits and report on license validation

* Separate usage and limits, have new ones

* Don't check for hosts and clients limits, but for machines instead

* Error on egress creation @ free tier w/ internet gateways

* Remove clients and hosts limit from code

* Rename var

* Rename consts and use iota

* Use switch instead of repeated else if

* Rename limits related vars

* Introduce new free tier limits

* Measure new limits and report on license validation

* Separate usage and limits, have new ones

* Don't check for hosts and clients limits, but for machines instead

* Error on egress creation @ free tier w/ internet gateways

* Remove clients and hosts limit from code

* NET-507 (#2506)

* NET-507

* Fixed server restart changing the node expiration date to the defaults.

* Removed expired nodes removal from zombie cleanup routine.

* Added a new expired nodes deletion routine which removes expired nodes every hour.

* NET-507 suggested changes

* Possible fix for zombie nodes upon node deletion from the UI.

* Suggested changes implemented for expired nodes deletion go routine.

* NET-507 typo fix

* typo fix for DeleteNode purge parameter

* NET-517 (#2510)

* Fixed emqx docker compose file syntax and added volumes for persistence.

* Added helper comments for docker-compose.yml and netmaker.env files to enable emqx broker support.

* migration (#2509)

* create gateways during migration

* set version for testing

* restruct migration

* debug logging

* enforce unique names for ext client names (#2476)

* enforce unique names for ext client names

* only check for unique id on creation

* check for unique id if changed

* prune(NET-483): remove defunct host.internetgateway field (#2487)

* don't reference host on err (#2493)

* deprecrate netclient install scripts (#2490)

* Net 500: validate network parameter passed to node endpoints (#2480)

* enforce unique names for ext client names

* only check for unique id on creation

* check for unique id if changed

* validate network parameter passed to node endpoints

---------

Co-authored-by: Abhishek K <32607604+abhishek9686@users.noreply.github.com>

* NET-513 (#2492)

nm-certs.sh now requests certificate for EE and CE edition domains accordingly.

* [NET-404] Run in limited mode when ee checks fail (#2474)

* Add limited http handlers functionality to rest handler

* Export ee.errValidation (ee.ErrValidation)

* Export a fatal error handled by the hook manager

* Export a new status variable for unlicensed server

* Mark server as unlicensed when ee checks fail

* Handle license validation failures with a (re)boot in a limited state

* Revert "Export a fatal error handled by the hook manager"

This reverts commit 069c219.

* Revert "Export ee.errValidation (ee.ErrValidation)"

This reverts commit 59dbab8.

* Revert "Add limited http handlers functionality to rest handler"

This reverts commit e2f1f28.

* Revert "Handle license validation failures with a (re)boot in a limited state"

This reverts commit 58cfbba.

* Revert "Mark server as unlicensed when ee checks fail"

This reverts commit 77c6dbd.

* Handle license validation failures with a middleware

* Forbid responses if unlicensed ee and not in status api

* Remove unused func

* feat(NET-449): add sync feature to request a host pull from server (#2491)

* fix(NET-486): change client name length validation (#2498)

set limit to 5<=x<=32

* [NET-477] Pick AMB URL dynamically (#2489)

* Introduce config for environment

* Introduce func to get environment

* Choose accounts api host from environment

* Test the ee package on workflows

* Use build tag ee for license_test.go

* [Feature]: nm-quick script tackling arm TODO support (#2488)

* domain flag for auto installs

* use static servers with custom domain (#2421)

* send delete peer update always

* fix add/remove host api calls

* keep mq updates in a single go func

* move branch test logic to devops (#2443)

* handle IOT OS

* save server name to env (#2460)

* ensure branch test servers available after test runs (#2467)

* save server name to env

* free server always; add PR to discord messages

* use correct method to delete droplets (#2468)

* quick fix for the launcher

* removed exit when triggering not supported exit and removed the TODO comments related to this issue

---------

Co-authored-by: Matthew R Kasun <mkasun@nusak.ca>
Co-authored-by: Alex Feiszli <31018251+afeiszli@users.noreply.github.com>
Co-authored-by: Christopher Blaha <crispspiceguitar@gmail.com>
Co-authored-by: Abhishek Kondur <abhi281342@gmail.com>
Co-authored-by: Abhishek K <32607604+abhishek9686@users.noreply.github.com>

* rebase conflict

* include pass and os in mirgration data

* node network ranges

* remove debugging logs

* add gateways

* use sent node

* upgrade shell script

* associate node to host during migration

* add node to host.Nodes and publish peer update

* save host outside loop

* fix script name

* simplify upgrade script

* don't migrate relays

* simplify upgrade script even more

* guard against blank address or address6

* typos

---------

Co-authored-by: Aceix <aceixsmartX@gmail.com>
Co-authored-by: Abhishek K <32607604+abhishek9686@users.noreply.github.com>
Co-authored-by: Farukh Khan <farukhkhan21@gmail.com>
Co-authored-by: Gabriel de Souza Seibel <gabrielseibel1@gmail.com>
Co-authored-by: bornav <51048565+bornav@users.noreply.github.com>
Co-authored-by: Alex Feiszli <31018251+afeiszli@users.noreply.github.com>
Co-authored-by: Christopher Blaha <crispspiceguitar@gmail.com>
Co-authored-by: Abhishek Kondur <abhi281342@gmail.com>

* dns tests

* go mod tidy

* set dns dir when testing

* troubleshoot test failure

* test fail troubleshooting

* use txeh.RenderHostFile to compare

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Abhishek K <32607604+abhishek9686@users.noreply.github.com>
Co-authored-by: Aceix <aceixsmartX@gmail.com>
Co-authored-by: Christopher Blaha <crispspiceguitar@gmail.com>
Co-authored-by: Farukh Khan <farukhkhan21@gmail.com>
Co-authored-by: Gabriel de Souza Seibel <gabrielseibel1@gmail.com>
Co-authored-by: bornav <51048565+bornav@users.noreply.github.com>
Co-authored-by: Alex Feiszli <31018251+afeiszli@users.noreply.github.com>
Co-authored-by: Abhishek Kondur <abhi281342@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Copy link

@luzfcb luzfcb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried running nm-upgrade.sh on my Netmaker EE server, but it didn't work as I expected, and I got a bunch of errors.


MASTERKEY=$(grep MASTER_KEY docker-compose.yml | awk '{print $2;}' | tr -d '"')
EMAIL=$(grep email Caddyfile | awk '{print $2;}' | tr -d '"')
BROKER=$(grep SERVER_NAME docker-compose.yml | awk '{print $2;}' | tr -d '"')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mattkasun @theguy951357 @abhishek9686

What is the expected value of BROKER=$(grep SERVER_NAME docker-compose.yml | awk '{print $2;}' | tr -d '"')

For me, it returns SERVER_NAME=${NM_DOMAIN} and result an errors when get the certificates

root@nm:~# ./nm-upgrade.sh 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                                                                         
 __   __     ______     ______   __    __     ______     __  __     ______     ______    
/\ "-.\ \   /\  ___\   /\__  _\ /\ "-./  \   /\  __ \   /\ \/ /    /\  ___\   /\  == \   
\ \ \-.  \  \ \  __\   \/_/\ \/ \ \ \-./\ \  \ \  __ \  \ \  _"-.  \ \  __\   \ \  __<   
 \ \_\\"\_\  \ \_____\    \ \_\  \ \_\ \ \_\  \ \_\ \_\  \ \_\ \_\  \ \_____\  \ \_\ \_\ 
  \/_/ \/_/   \/_____/     \/_/   \/_/  \/_/   \/_/\/_/   \/_/\/_/   \/_____/   \/_/ /_/ 
                                                                                                                                                                                                 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Using config: /root/netmaker.env
-----------------------------------------------------
Would you like to install Netmaker Community Edition (CE), or Netmaker Enterprise Edition (EE)?
EE will require you to create an account at https://app.netmaker.io
-----------------------------------------------------
1) Community Edition
2) Enterprise Edition
#? 2
installing Netmaker EE
-----------Build Options-----------------------------
    EE or CE: ee
   Version: v0.20.6
   Installer: v0.1.0
-----------------------------------------------------
checking dependencies...
Hit:1 http://ubuntu.mirror.constant.com jammy InRelease
Hit:2 https://download.docker.com/linux/ubuntu jammy InRelease                                                                                         
Hit:3 http://ubuntu.mirror.constant.com jammy-updates InRelease                                                                                        
Get:4 http://ubuntu.mirror.constant.com jammy-backports InRelease [109 kB]                           
Hit:5 https://apprepo.vultr.com/ubuntu universal InRelease                                                      
Hit:6 http://archive.ubuntu.com/ubuntu jammy InRelease                                                          
Get:7 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
Hit:8 http://ubuntu.mirror.constant.com jammy-security InRelease                                                                                                                            
Get:9 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [109 kB]                                                                                                                   
Get:10 http://archive.ubuntu.com/ubuntu jammy-security InRelease [110 kB]                                                                                                                   
Fetched 446 kB in 8s (53.8 kB/s)                                                                                                                                                            
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
63 packages can be upgraded. Run 'apt list --upgradable' to see them.
     git is installed
     wireguard is installed
     wireguard-tools is installed
     dnsutils is installed
     jq is installed
     docker.io is not installed. Attempting install.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 containerd.io : Conflicts: containerd
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
   FAILED TO INSTALL docker.io
   This may break functionality.
     docker-compose is installed
     grep is installed
     gawk is installed
-----------------------------------------------------
dependency check complete
-----------------------------------------------------
-----------------------------------------------------
The following subdomains will be used:
          dashboard.SERVER_NAME=${NM_DOMAIN}
                api.SERVER_NAME=${NM_DOMAIN}
             broker.SERVER_NAME=${NM_DOMAIN}
               turn.SERVER_NAME=${NM_DOMAIN}
            turnapi.SERVER_NAME=${NM_DOMAIN}
         prometheus.SERVER_NAME=${NM_DOMAIN}
  netmaker-exporter.SERVER_NAME=${NM_DOMAIN}
            grafana.SERVER_NAME=${NM_DOMAIN}
-----------------------------------------------------
-----------------------------------------------------
Provide Details for EE installation:
    1. Log into https://app.netmaker.io
    2. follow instructions to get a license at: https://docs.netmaker.io/ee/ee-setup.html
    3. Retrieve License and Tenant ID
    4. note email address
-----------------------------------------------------
License Key: ***********************
Tenant ID: ***********************
using default username/random pass for MQ
using default username/random pass for TURN
-----------------------------------------------------------------
                SETUP ARGUMENTS
-----------------------------------------------------------------
        domain: SERVER_NAME=${NM_DOMAIN}
         email: ***********************@gmail.com
     public ip: ***.***.***.***
       license: ***********************
    account id: ***********************
-----------------------------------------------------------------
Confirm Settings for Installation
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Does everything look right? [y/n]: y
Stopping all containers...
generating netclient configuration files
{"time":"2023-08-28T16:16:56.157767822Z","level":"INFO","source":"root.go 91}","msg":"creating config dir"}
{"time":"2023-08-28T16:16:56.15870603Z","level":"INFO","source":"root.go 95}","msg":"retrieving legacy nodes"}
{"time":"2023-08-28T16:16:56.163801576Z","level":"WARN","source":"root.go 149}","msg":"unmarhal node","error":"json: cannot unmarshal bool into Go struct field LegacyNode.connected of type string"}
{"time":"2023-08-28T16:16:56.163839299Z","level":"WARN","source":"root.go 149}","msg":"unmarhal node","error":"json: cannot unmarshal bool into Go struct field LegacyNode.connected of type string"}
{"time":"2023-08-28T16:16:56.163859077Z","level":"WARN","source":"root.go 149}","msg":"unmarhal node","error":"json: cannot unmarshal bool into Go struct field LegacyNode.connected of type string"}
-----------------------------------------------------------------
Beginning installation...
-----------------------------------------------------------------
. . .
. . .
. . .
Pulling config files...
Saving the config to /root/netmaker.env
Setting up SSL certificates...
fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/community/x86_64/APKINDEX.tar.gz
v3.16.7-45-ga175333e49e [https://dl-cdn.alpinelinux.org/alpine/v3.16/main]
v3.16.7-44-g4bb68229aaf [https://dl-cdn.alpinelinux.org/alpine/v3.16/community]
OK: 17048 distinct packages available
(1/5) Installing bash (5.1.16-r2)
Executing bash-5.1.16-r2.post-install
(2/5) Installing brotli-libs (1.0.9-r6)
(3/5) Installing nghttp2-libs (1.47.0-r1)
(4/5) Installing libcurl (8.2.1-r0)
(5/5) Installing curl (8.2.1-r0)
Executing busybox-1.35.0-r17.trigger
OK: 29 MiB in 46 packages
certonly --standalone --non-interactive --expand --agree-tos -m ****@gmail.com -d api.SERVER_NAME= -d broker.SERVER_NAME= -d dashboard.SERVER_NAME= -d turn.SERVER_NAME= -d turnapi.SERVER_NAME= -d netmaker-exporter.SERVER_NAME= -d grafana.SERVER_NAME= -d prometheus.SERVER_NAME=
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Requesting a certificate for api.server_name= and 7 more domains
An unexpected error occurred:
Error creating new order :: Cannot issue for "api.server_name=": Domain name contains an invalid character (and 7 more problems. Refer to sub-problems for more information.)
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Requesting a certificate for api.server_name= and 7 more domains
An unexpected error occurred:
Error creating new order :: Cannot issue for "api.server_name=": Domain name contains an invalid character (and 7 more problems. Refer to sub-problems for more information.)
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
Missing file: /root/letsencrypt/live/api.SERVER_NAME=/fullchain.pem
SSL certificates failed

set_buildinfo() {

MASTERKEY=$(grep MASTER_KEY docker-compose.yml | awk '{print $2;}' | tr -d '"')
EMAIL=$(grep email Caddyfile | awk '{print $2;}' | tr -d '"')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mattkasun @theguy951357 @abhishek9686

The regular Caddyfile does not contain email

https://github.com/gravitl/netmaker/blob/b9a18cf73d070a5bf3ceaf9207bdd39752a25dc9/docker/Caddyfile

In case the user has manually modified and added the email in the Caddyfile, and for some reason runs nm-upgrade.sh a second time, then it will result in an invalid value, ie, it will result in an empty string.

The main issue is: in my case, I have a netmaker.env file and it has NM_EMAIL with an email address and several other variables that for some reason are ignored and overwritten when running this script. It might be good to make a backup of netmaker.env before modifying or overwriting it.

Comment on lines +229 to +232
if [ -f /etc/debian_version ]; then
dependencies="git wireguard wireguard-tools dnsutils jq docker.io docker-compose grep gawk"
update_cmd='apt update'
install_cmd='apt-get install -y'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code ignores the fact that I can have the official docker repository configured and the packages installed, I think it should somehow check that the official docker repository is installed and thus use the correct package names.

It might be possible to find out with something like

awk '/^deb .*http/ {sub("^deb .*(http|https)", "http", $0); print $0}' /etc/apt/sources.list /etc/apt/sources.list.d/* 2>/dev/null | sort | uniq | grep .docker.com

luzfcb

This comment was marked as resolved.

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.

8 participants