gravitl / netmaker

Netmaker makes networks with WireGuard. Netmaker automates fast, secure, and distributed virtual networks.
https://netmaker.io
Other
9.4k stars 547 forks source link

[Bug]: v0.16.1 -> v.0.17.1 upgrade does not work (database issue?) #1882

Open voroskoi opened 1 year ago

voroskoi commented 1 year ago

Contact Details

No response

What happened?

I have tried upgrading my working v0.16.1 setup to 0.17.1, but I was unable to make it work.

The docker-compose.yml for the working setup is here.

The compose file for 0.17 is here.

I have applied this diff. I have read the release docs, changed traefik to caddy, updated mosquitto config.

After those steps caddy starts up fine, the cert renewal works fine, but I run into the very same error reported in #1827. It looks like a chicken-egg problem, netmaker waits for mq and mq waits for netmaker to start up. I commented out the wait_for_netmaker function call in wait.sh, this way mq starts up fine at least. According to the logs it even accepts Netmaker-Admin and Netmaker-Server.

Now I try to reach the UI, and it loads up fine, but wants to create a new admin user (The log files indeed have a line could not update user voroskoi. Adding new admin does not work: "Failed to create Admin. Could not reach server". I have tried to change netmaker.db permissions to 666 to see if it is a permission problem, but the error does not change.

What am I doing wrong?

Version

v0.17.1

What OS are you using?

Linux

Relevant log output

[I] voroskoi@kistasli ~/i/v/k/docker (v17)> docker-compose up
Starting netmaker ... done
Starting caddy    ... done
Starting mq          ... done
Starting netmaker-ui ... done
Attaching to caddy, netmaker, mq, netmaker-ui
caddy          | {"level":"info","ts":1672263609.5489829,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}
caddy          | {"level":"warn","ts":1672263609.5539784,"msg":"Caddyfile input is not formatted; run the 'caddy fmt' command to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":2}
caddy          | {"level":"info","ts":1672263609.5618677,"logger":"admin","msg":"admin endpoint started","address":"localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}
caddy          | {"level":"info","ts":1672263609.562485,"logger":"http","msg":"server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS","server_name":"srv0","https_port":443}
caddy          | {"level":"info","ts":1672263609.5625656,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
caddy          | {"level":"info","ts":1672263609.5630996,"logger":"http.log","msg":"server running","name":"remaining_auto_https_redirects","protocols":["h1","h2","h3"]}
caddy          | {"level":"info","ts":1672263609.5632493,"logger":"http","msg":"enabling HTTP/3 listener","addr":":443"}
caddy          | {"level":"info","ts":1672263609.563402,"msg":"failed to sufficiently increase receive buffer size (was: 208 kiB, wanted: 2048 kiB, got: 416 kiB). See https://github.com/lucas-clemente/quic-go/wiki/UDP-Receive-Buffer-Size for details."}
caddy          | {"level":"info","ts":1672263609.5635579,"logger":"http.log","msg":"server running","name":"srv0","protocols":["h1","h2","h3"]}
caddy          | {"level":"info","ts":1672263609.5636132,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["api.voroskoi.duckdns.org","dashboard.voroskoi.duckdns.org","broker.voroskoi.duckdns.org"]}
caddy          | {"level":"info","ts":1672263609.5684426,"msg":"autosaved config (load with --resume flag)","file":"/config/caddy/autosave.json"}
caddy          | {"level":"info","ts":1672263609.5685802,"msg":"serving initial configuration"}
caddy          | {"level":"info","ts":1672263609.5689213,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc00041e2a0"}
caddy          | {"level":"info","ts":1672263609.569073,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/data/caddy"}
caddy          | {"level":"info","ts":1672263609.5697887,"logger":"tls","msg":"finished cleaning storage units"}
netmaker       |
netmaker       |  __   __     ______     ______   __    __     ______     __  __     ______     ______
netmaker       | /\ "-.\ \   /\  ___\   /\__  _\ /\ "-./  \   /\  __ \   /\ \/ /    /\  ___\   /\  == \
netmaker       | \ \ \-.  \  \ \  __\   \/_/\ \/ \ \ \-./\ \  \ \  __ \  \ \  _"-.  \ \  __\   \ \  __<
netmaker       |  \ \_\\"\_\  \ \_____\    \ \_\  \ \_\ \ \_\  \ \_\ \_\  \ \_\ \_\  \ \_____\  \ \_\ \_\
netmaker       |   \/_/ \/_/   \/_____/     \/_/   \/_/  \/_/   \/_/\/_/   \/_/\/_/   \/_____/   \/_/ /_/
netmaker       |
netmaker       |
netmaker       | [netmaker] 2022-12-28 21:40:09 connecting to sqlite
netmaker       | [netmaker] 2022-12-28 21:40:09 database successfully connected
netmaker       | [netmaker] 2022-12-28 21:40:09 no OAuth provider found or not configured, continuing without OAuth
netmaker       | [netmaker] 2022-12-28 21:40:09 could not update user voroskoi
netmaker-ui    | >>>> backend set to: https://api.netmaker.voroskoi.duckdns.org <<<<<
netmaker-ui    | 2022/12/28 21:40:10 [notice] 9#9: using the "epoll" event method
netmaker-ui    | 2022/12/28 21:40:10 [notice] 9#9: nginx/1.21.6
netmaker-ui    | 2022/12/28 21:40:10 [notice] 9#9: built by gcc 10.3.1 20211027 (Alpine 10.3.1_git20211027)
netmaker-ui    | 2022/12/28 21:40:10 [notice] 9#9: OS: Linux 5.15.85-0-virt
netmaker-ui    | 2022/12/28 21:40:10 [notice] 9#9: getrlimit(RLIMIT_NOFILE): 1048576:1048576
netmaker-ui    | 2022/12/28 21:40:10 [notice] 9#9: start worker processes
netmaker-ui    | 2022/12/28 21:40:10 [notice] 9#9: start worker process 10
mq             | OK: 8 MiB in 20 packages
mq             | Starting MQ...
mq             | 1672263610: mosquitto version 2.0.15 starting
mq             | 1672263610: Config loaded from /mosquitto/config/mosquitto.conf.
mq             | 1672263610: Loading plugin: /usr/lib/mosquitto_dynamic_security.so
mq             | 1672263610: Opening websockets listen socket on port 8883.
mq             | 1672263610: Opening websockets listen socket on port 1883.
mq             | 1672263610: mosquitto version 2.0.15 running
netmaker       | [netmaker] 2022-12-28 21:40:11 Configuring MQ...
netmaker       | [netmaker] 2022-12-28 21:40:11 MQ config exists already, So Updating Existing Config...
netmaker       | [netmaker] 2022-12-28 21:40:11 REST Server successfully started on port  8081  (REST)
netmaker       | [netmaker] 2022-12-28 21:40:11 connecting to mq broker at ws://mq:1883 with TLS? false
mq             | 1672263612: New client connected from ::ffff:172.23.0.2:42208 as c6KKhfdadGofFCutw5xgdsV (p2, c1, k60, u'Netmaker-Admin').
mq             | 1672263612: New client connected from ::ffff:172.23.0.2:42220 as ZW5esoHu04M7fabSWZTeLiC (p2, c1, k60, u'Netmaker-Server').

Contributing guidelines

simonericcio commented 1 year ago

Same problem here. Ony differences are that we are using postgres database, and that oidc is enabled.

Also get this error: error when getting user info from callback: failed to exchange oauth2 token using code

Is there any workaround to create an admin user and get back into the system?

Thanks