Closed SecurityArsenal closed 1 month ago
ok seems the download pulled an older docker yml file: wget https://raw.githubusercontent.com/socfortress/CoPilot/v0.0.8/docker-compose.yml
I pulled the one from the latest and it has the correct copilot-mysql image.
So after the pulling the latest is it working correctly now? I'm sorry if im not following correctly but what docker-compose.yml were you using before? Where you using an old version prior to conversion to mysql?
Yeah works fine after getting direct from github.
The latest version 0.8 can't be installed it errors backend starting linked to mysql:
I have tried setting the mysql password in the .env, docker volume prune -a, pulled again new OS install, There must be an error with the latest version of the backend that is not allowing a new install.
docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 42a97bc571a0 ghcr.io/socfortress/copilot-backend:latest "/usr/wait-for-it.sh…" 2 minutes ago Exited (3) 48 seconds ago copilot-copilot-backend-1 d8c4874ebc9b ghcr.io/socfortress/copilot-frontend:latest "/docker-entrypoint.…" 2 minutes ago Up About a minute 0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp copilot-copilot-frontend-1 root@soc:/opt/CoPilot# docker logs "docker logs" requires exactly 1 argument. See 'docker logs --help'.
Usage: docker logs [OPTIONS] CONTAINER
Fetch the logs of a container root@soc:/opt/CoPilot# docker logs 42a97bc571a0 wait-for-it.sh: waiting 15 seconds for copilot-mysql:3306 wait-for-it.sh: timeout occurred after waiting 15 seconds for copilot-mysql:3306 2024-05-26 00:20:51.745 | INFO | app.db.db_session::141 - Loading environment from /opt/copilot/.env
2024-05-26 00:20:51.746 | INFO | app.db.db_session::148 - DB User: copilot and password: REPLACE_WITH_PASSWORD
INFO: Started server process [1]
INFO: Waiting for application startup.
2024-05-26 00:20:57.258 | INFO | main:init_db:151 - Initializing database
ERROR: Traceback (most recent call last):
File "/opt/venv/lib/python3.11/site-packages/pymysql/connections.py", line 644, in connect
sock = socket.create_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/socket.py", line 827, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/socket.py", line 962, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 3361, in _wrap_pool_connect return fn() ^^^^ File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 320, in connect return _ConnectionFairy._checkout(self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 884, in _checkout fairy = _ConnectionRecord.checkout(pool) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 486, in checkout rec = pool._do_get() ^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/pool/impl.py", line 145, in _do_get with util.safereraise(): File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/util/langhelpers.py", line 70, in exit compat.raise( File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/util/compat.py", line 208, in raise_ raise exception File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/pool/impl.py", line 143, in _do_get return self._create_connection() ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 266, in _create_connection return _ConnectionRecord(self) ^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 381, in init self.connect() File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 677, in connect with util.safereraise(): File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/util/langhelpers.py", line 70, in exit compat.raise( File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/util/compat.py", line 208, in raise_ raise exception File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 673, in __connect self.dbapi_connection = connection = pool._invoke_creator(self) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/engine/create.py", line 578, in connect return dialect.connect(*cargs, *cparams) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 598, in connect return self.dbapi.connect(cargs, **cparams) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/pymysql/connections.py", line 358, in init self.connect() File "/opt/venv/lib/python3.11/site-packages/pymysql/connections.py", line 711, in connect raise exc pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on 'copilot-mysql' ([Errno -2] Name or service not known)")
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/opt/venv/lib/python3.11/site-packages/starlette/routing.py", line 677, in lifespan async with self.lifespan_context(app) as maybe_state: File "/opt/venv/lib/python3.11/site-packages/starlette/routing.py", line 566, in aenter await self._router.startup() File "/opt/venv/lib/python3.11/site-packages/starlette/routing.py", line 654, in startup await handler() File "/opt/copilot/backend/copilot.py", line 153, in init_db await create_database_if_not_exists(db_url=SQLALCHEMY_DATABASE_URI_NO_DB, db_name="copilot") File "/opt/copilot/backend/app/db/db_setup.py", line 37, in create_database_if_not_exists conn = engine.connect() ^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 3315, in connect return self._connection_cls(self, close_with_result=close_with_result) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 96, in init else engine.raw_connection() ^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 3394, in raw_connection return self._wrap_pool_connect(self.pool.connect, _connection) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 3364, in _wrap_pool_connect Connection._handle_dbapi_exception_noconnection( File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 2198, in _handle_dbapi_exceptionnoconnection util.raise( File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/util/compat.py", line 208, in raise_ raise exception File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 3361, in _wrap_pool_connect return fn() ^^^^ File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 320, in connect return _ConnectionFairy._checkout(self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 884, in _checkout fairy = _ConnectionRecord.checkout(pool) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 486, in checkout rec = pool._do_get() ^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/pool/impl.py", line 145, in _do_get with util.safereraise(): File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/util/langhelpers.py", line 70, in exit compat.raise( File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/util/compat.py", line 208, in raise_ raise exception File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/pool/impl.py", line 143, in _do_get return self._create_connection() ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 266, in _create_connection return _ConnectionRecord(self) ^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 381, in init self.connect() File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 677, in connect with util.safereraise(): File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/util/langhelpers.py", line 70, in exit compat.raise( File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/util/compat.py", line 208, in raise_ raise exception File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 673, in __connect self.dbapi_connection = connection = pool._invoke_creator(self) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/engine/create.py", line 578, in connect return dialect.connect(*cargs, *cparams) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 598, in connect return self.dbapi.connect(cargs, **cparams) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv/lib/python3.11/site-packages/pymysql/connections.py", line 358, in init self.connect() File "/opt/venv/lib/python3.11/site-packages/pymysql/connections.py", line 711, in connect raise exc sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (2003, "Can't connect to MySQL server on 'copilot-mysql' ([Errno -2] Name or service not known)") (Background on this error at: https://sqlalche.me/e/14/e3q8)
ERROR: Application startup failed. Exiting. root@soc:/opt/CoPilot# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 42a97bc571a0 ghcr.io/socfortress/copilot-backend:latest "/usr/wait-for-it.sh…" 2 minutes ago Exited (3) About a minute ago copilot-copilot-backend-1 d8c4874ebc9b ghcr.io/socfortress/copilot-frontend:latest "/docker-entrypoint.…" 2 minutes ago Up About a minute 0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp copilot-copilot-frontend-1