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

updating to latest throws Exception on container start. #86

Closed
Zixim opened this issue Mar 13, 2021 · 7 comments
Closed

updating to latest throws Exception on container start. #86

Zixim opened this issue Mar 13, 2021 · 7 comments

Comments

@Zixim
Copy link

Zixim commented Mar 13, 2021

issue seems to be : sqlite3.OperationalError: no such column: server.subnet
Help ?

[2021-03-13 09:57:05 +0000] [9] [INFO] Starting gunicorn 20.0.4,
[2021-03-13 09:57:05 +0000] [9] [INFO] Listening at: http://0.0.0.0:8888 (9),
[2021-03-13 09:57:05 +0000] [9] [INFO] Using worker: uvicorn.workers.UvicornWorker,
[2021-03-13 09:57:05 +0000] [11] [INFO] Booting worker with pid: 11,
[2021-03-13 09:57:07 +0000] [11] [ERROR] Exception in worker process,
Traceback (most recent call last):,
  File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1276, in _execute_context,
    self.dialect.do_execute(,
  File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/default.py", line 608, in do_execute,
    cursor.execute(statement, parameters),
sqlite3.OperationalError: no such column: server.subnet,
,
The above exception was the direct cause of the following exception:,
,
Traceback (most recent call last):,
  File "/usr/lib/python3/dist-packages/gunicorn/arbiter.py", line 583, in spawn_worker,
    worker.init_process(),
  File "/usr/lib/python3/dist-packages/uvicorn/workers.py", line 57, in init_process,
    super(UvicornWorker, self).init_process(),
  File "/usr/lib/python3/dist-packages/gunicorn/workers/base.py", line 119, in init_process,
    self.load_wsgi(),
  File "/usr/lib/python3/dist-packages/gunicorn/workers/base.py", line 144, in load_wsgi,
    self.wsgi = self.app.wsgi(),
  File "/usr/lib/python3/dist-packages/gunicorn/app/base.py", line 67, in wsgi,
    self.callable = self.load(),
  File "/usr/lib/python3/dist-packages/gunicorn/app/wsgiapp.py", line 49, in load,
    return self.load_wsgiapp(),
  File "/usr/lib/python3/dist-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp,
    return util.import_app(self.app_uri),
  File "/usr/lib/python3/dist-packages/gunicorn/util.py", line 383, in import_app,
    mod = importlib.import_module(module),
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module,
    return _bootstrap._gcd_import(name[level:], package, level),
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import,
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load,
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked,
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked,
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module,
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed,
  File "/app/main.py", line 76, in <module>,
    servers: typing.List[models.WGServer] = _db.query(models.WGServer).all(),
  File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/orm/query.py", line 3373, in all,
    return list(self),
  File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/orm/query.py", line 3535, in __iter__,
    return self._execute_and_instances(context),
  File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/orm/query.py", line 3560, in _execute_and_instances,
    result = conn.execute(querycontext.statement, self._params),
  File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1011, in execute,
    return meth(self, multiparams, params),
  File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/sql/elements.py", line 298, in _execute_on_connection,
    return connection._execute_clauseelement(self, multiparams, params),
  File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1124, in _execute_clauseelement,
    ret = self._execute_context(,
  File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1316, in _execute_context,
    self._handle_dbapi_exception(,
  File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1510, in _handle_dbapi_exception,
    util.raise_(,
  File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/util/compat.py", line 182, in raise_,
    raise exception,
  File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1276, in _execute_context,
    self.dialect.do_execute(,
  File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/default.py", line 608, in do_execute,
    cursor.execute(statement, parameters),
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such column: server.subnet,
[SQL: SELECT server.id AS server_id, server.interface AS server_interface, server.subnet AS server_subnet, server.address AS server_address, server.v6_address AS server_v6_address, server.v6_subnet AS server_v6_subnet, server.listen_port AS server_listen_port, server.private_key AS server_private_key, server.public_key AS server_public_key, server.endpoint AS server_endpoint, server.dns AS server_dns, server.allowed_ips AS server_allowed_ips, server.keep_alive AS server_keep_alive, server.read_only AS server_read_only, server.post_up AS server_post_up, server.post_down AS server_post_down, server.is_running AS server_is_running, server.configuration AS server_configuration, peer_1.id AS peer_1_id, peer_1.name AS peer_1_name, peer_1.address AS peer_1_address, peer_1.v6_address AS peer_1_v6_address, peer_1.public_key AS peer_1_public_key, peer_1.private_key AS peer_1_private_key, peer_1.shared_key AS peer_1_shared_key, peer_1.dns AS peer_1_dns, peer_1.allowed_ips AS peer_1_allowed_ips, peer_1.keep_alive AS peer_1_keep_alive, peer_1.read_only AS peer_1_read_only, peer_1.server_id AS peer_1_server_id, peer_1.configuration AS peer_1_configuration ,
FROM server LEFT OUTER JOIN peer AS peer_1 ON server.id = peer_1.server_id],
(Background on this error at: http://sqlalche.me/e/13/e3q8),
[2021-03-13 09:57:07 +0000] [11] [INFO] Worker exiting (pid: 11),
{"loglevel": "info", "workers": 1, "bind": "0.0.0.0:8888", "worker-tmp-dir": "/dev/shm", "workers_per_core": 1.0, "host": "0.0.0.0", "port": "8888"},
[2021-03-13 09:57:07 +0000] [9] [INFO] Shutting down: Master,
[2021-03-13 09:57:07 +0000] [9] [INFO] Reason: Worker failed to boot.,
{"loglevel": "info", "workers": 1, "bind": "0.0.0.0:8888", "worker-tmp-dir": "/dev/shm", "workers_per_core": 1.0, "host": "0.0.0.0", "port": "8888"},
@2L3R4
Copy link
Contributor

2L3R4 commented Mar 13, 2021

related to/same as #36 ?

@Zixim
Copy link
Author

Zixim commented Mar 13, 2021

yes, did you solve that ?

@2L3R4
Copy link
Contributor

2L3R4 commented Mar 13, 2021

method 1 (when you cant/dont want to change the client configs):
step 0: backup all servers
step 1: delete old container
step 2: pull latest container and start it as described in docs
step 3: login and restore all servers
method 2 (when you can/want to change the client configs | or when you cant access the webinterface)
step 1: delete container
step 2: pull latest container and start it as described in docs
step 3: (re)create servers and (re)setup client devices

p.s. I used method 2 because I had "only" 1 server with one or two peers

@perara
Copy link
Owner

perara commented Mar 13, 2021

Hi, it's a bit weird that this is happening because 004_create_Server_subnet.py in migrations should add this if you're far behind on the versions (and when you upgrade it should add it). I guess this has not happened

And yes, it seems to be the same problem as #36.
Generally, I think its time to move to alembic (if I get it to work) and I'll create a migration script that collects all of the previous ones in hopes that everything will magically fix itself

perara added a commit that referenced this issue Mar 13, 2021
@perara
Copy link
Owner

perara commented Mar 13, 2021

I've now set up alembic with a migration that should (probably wont) fix your problems. please report back if it works :)

@Zixim
Copy link
Author

Zixim commented Mar 14, 2021

everything looks good.
Thanks !!

@Zixim Zixim closed this as completed Mar 14, 2021
@perara
Copy link
Owner

perara commented Mar 14, 2021

Excellent!

m4xx1m added a commit to m4xx1m/wg-manager that referenced this issue Oct 16, 2022
m4xx1m pushed a commit to m4xx1m/wg-manager that referenced this issue Oct 16, 2022
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

No branches or pull requests

3 participants