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

ENG-376 docker compose setup for running GitCloud #21

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vkarpov15
Copy link
Contributor

Added Dockerfiles for services/jobs, frontend, and Oso local binary. And added a docker-compose that can run gitcloud, jobs, frontend, Oso local binary, and postgres. I wasn't able to figure out how to reliably seed the db without making some substantial changes, so I just added a separate seed script to the services/gitclub Makefile with instructions to only run that seed script once.

Copy link

vercel bot commented Sep 24, 2024

@vkarpov15 is attempting to deploy a commit to the osohq Team on Vercel.

A member of the Team first needs to authorize it.

@vkarpov15
Copy link
Contributor Author

@samscott89 @gj @gsarjeant tagging because I'm not allowed to add reviewers to this PR.

Copy link

vercel bot commented Oct 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
gitcloud ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 11, 2024 1:51pm

@gsarjeant
Copy link
Collaborator

@vkarpov15 I had to modify the base images for the gitcloud and jobs services to fix errors I got after building the containers on my Mac. The changes are on 080ce95

I don't have permission to push the branch to your repo to submit a PR there, but it's a small change. Sorry for the long delay getting to this.

@gsarjeant
Copy link
Collaborator

Here are the stack traces I got that led to this, for reference:

 [+] Running 6/5
 ✔ Network gitcloud_default       Created                                                                                                                                         0.0s 
 ✔ Container gitcloud-postgres-1  Created                                                                                                                                         0.1s 
 ✔ Container gitcloud-oso-1       Created                                                                                                                                         0.1s 
 ✔ Container gitcloud-jobs-1      Created                                                                                                                                         0.0s 
 ✔ Container gitcloud-gitclub-1   Created                                                                                                                                         0.0s 
 ✔ Container gitcloud-frontend-1  Created                                                                                                                                         0.0s 
Attaching to frontend-1, gitclub-1, jobs-1, oso-1, postgres-1
postgres-1  | 
postgres-1  | PostgreSQL Database directory appears to contain a database; Skipping initialization
postgres-1  | 
postgres-1  | 2024-10-11 14:00:16.952 UTC [1] LOG:  starting PostgreSQL 14.13 on aarch64-unknown-linux-musl, compiled by gcc (Alpine 13.2.1_git20240309) 13.2.1 20240309, 64-bit
postgres-1  | 2024-10-11 14:00:16.953 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
postgres-1  | 2024-10-11 14:00:16.953 UTC [1] LOG:  listening on IPv6 address "::", port 5432
postgres-1  | 2024-10-11 14:00:16.953 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres-1  | 2024-10-11 14:00:16.961 UTC [28] LOG:  database system was shut down at 2024-10-11 13:56:17 UTC
postgres-1  | 2024-10-11 14:00:16.965 UTC [1] LOG:  database system is ready to accept connections
gitclub-1   | [2024-10-11 14:00:17 +0000] [1] [INFO] Starting gunicorn 23.0.0
gitclub-1   | [2024-10-11 14:00:17 +0000] [1] [INFO] Listening at: http://0.0.0.0:5000 (1)
gitclub-1   | [2024-10-11 14:00:17 +0000] [1] [INFO] Using worker: sync
gitclub-1   | [2024-10-11 14:00:17 +0000] [7] [INFO] Booting worker with pid: 7
gitclub-1   | [2024-10-11 14:00:17 +0000] [8] [INFO] Booting worker with pid: 8
jobs-1      | yarn run v1.22.19
jobs-1      | warning package.json: No license field
jobs-1      | $ nodemon -r ./src/tracing src/index.ts
jobs-1      | [nodemon] 2.0.19
jobs-1      | [nodemon] to restart at any time, enter `rs`
jobs-1      | [nodemon] watching path(s): *.*
jobs-1      | [nodemon] watching extensions: ts,json
jobs-1      | [nodemon] starting `ts-node -r ./src/tracing src/index.ts`
frontend-1  | yarn run v1.22.19
frontend-1  | $ next start
frontend-1  | ready - started server on 0.0.0.0:8000, url: http://localhost:8000
gitclub-1   | [2024-10-11 14:00:17 +0000] [8] [ERROR] Exception in worker process
gitclub-1   | Traceback (most recent call last):
gitclub-1   |   File "/usr/local/lib/python3.13/site-packages/gunicorn/arbiter.py", line 608, in spawn_worker
gitclub-1   |     worker.init_process()
gitclub-1   |     ~~~~~~~~~~~~~~~~~~~^^
gitclub-1   |   File "/usr/local/lib/python3.13/site-packages/gunicorn/workers/base.py", line 135, in init_process
gitclub-1   |     self.load_wsgi()
gitclub-1   |     ~~~~~~~~~~~~~~^^
gitclub-1   |   File "/usr/local/lib/python3.13/site-packages/gunicorn/workers/base.py", line 147, in load_wsgi
gitclub-1   |     self.wsgi = self.app.wsgi()
gitclub-1   |                 ~~~~~~~~~~~~~^^
gitclub-1   |   File "/usr/local/lib/python3.13/site-packages/gunicorn/app/base.py", line 66, in wsgi
gitclub-1   |     self.callable = self.load()
gitclub-1   |                     ~~~~~~~~~^^
gitclub-1   |   File "/usr/local/lib/python3.13/site-packages/gunicorn/app/wsgiapp.py", line 57, in load
gitclub-1   |     return self.load_wsgiapp()
gitclub-1   |            ~~~~~~~~~~~~~~~~~^^
gitclub-1   |   File "/usr/local/lib/python3.13/site-packages/gunicorn/app/wsgiapp.py", line 47, in load_wsgiapp
gitclub-1   |     return util.import_app(self.app_uri)
gitclub-1   |            ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
gitclub-1   |   File "/usr/local/lib/python3.13/site-packages/gunicorn/util.py", line 370, in import_app
gitclub-1   |     mod = importlib.import_module(module)
gitclub-1   |   File "/usr/local/lib/python3.13/importlib/__init__.py", line 88, in import_module
gitclub-1   |     return _bootstrap._gcd_import(name[level:], package, level)
gitclub-1   |            ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
gitclub-1   |   File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
gitclub-1   |   File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
gitclub-1   |   File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
gitclub-1   |   File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
gitclub-1   |   File "<frozen importlib._bootstrap_external>", line 1022, in exec_module
gitclub-1   |   File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
gitclub-1   |   File "/app/app/__init__.py", line 18, in <module>
gitclub-1   |     from .tracing import instrument_app
gitclub-1   |   File "/app/app/tracing.py", line 6, in <module>
gitclub-1   |     from opentelemetry.instrumentation.psycopg2 import Psycopg2Instrumentor
gitclub-1   |   File "/usr/local/lib/python3.13/site-packages/opentelemetry/instrumentation/psycopg2/__init__.py", line 108, in <module>
gitclub-1   |     import psycopg2
gitclub-1   |   File "/usr/local/lib/python3.13/site-packages/psycopg2/__init__.py", line 51, in <module>
gitclub-1   |     from psycopg2._psycopg import (                     # noqa
gitclub-1   |     ...<10 lines>...
gitclub-1   |     )
gitclub-1   | ImportError: Error relocating /usr/local/lib/python3.13/site-packages/psycopg2/_psycopg.cpython-313-aarch64-linux-musl.so: _PyInterpreterState_Get: symbol not found
gitclub-1   | [2024-10-11 14:00:17 +0000] [7] [ERROR] Exception in worker process
gitclub-1   | Traceback (most recent call last):
gitclub-1   |   File "/usr/local/lib/python3.13/site-packages/gunicorn/arbiter.py", line 608, in spawn_worker
gitclub-1   |     worker.init_process()
gitclub-1   |     ~~~~~~~~~~~~~~~~~~~^^
gitclub-1   |   File "/usr/local/lib/python3.13/site-packages/gunicorn/workers/base.py", line 135, in init_process
gitclub-1   |     self.load_wsgi()
gitclub-1   |     ~~~~~~~~~~~~~~^^
gitclub-1   |   File "/usr/local/lib/python3.13/site-packages/gunicorn/workers/base.py", line 147, in load_wsgi
gitclub-1   |     self.wsgi = self.app.wsgi()
gitclub-1   |                 ~~~~~~~~~~~~~^^
gitclub-1   |   File "/usr/local/lib/python3.13/site-packages/gunicorn/app/base.py", line 66, in wsgi
gitclub-1   |     self.callable = self.load()
gitclub-1   |                     ~~~~~~~~~^^
gitclub-1   |   File "/usr/local/lib/python3.13/site-packages/gunicorn/app/wsgiapp.py", line 57, in load
gitclub-1   |     return self.load_wsgiapp()
gitclub-1   |            ~~~~~~~~~~~~~~~~~^^
gitclub-1   |   File "/usr/local/lib/python3.13/site-packages/gunicorn/app/wsgiapp.py", line 47, in load_wsgiapp
gitclub-1   |     return util.import_app(self.app_uri)
gitclub-1   |            ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
gitclub-1   |   File "/usr/local/lib/python3.13/site-packages/gunicorn/util.py", line 370, in import_app
gitclub-1   |     mod = importlib.import_module(module)
gitclub-1   |   File "/usr/local/lib/python3.13/importlib/__init__.py", line 88, in import_module
gitclub-1   |     return _bootstrap._gcd_import(name[level:], package, level)
gitclub-1   |            ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
gitclub-1   |   File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
gitclub-1   |   File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
gitclub-1   |   File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
gitclub-1   |   File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
gitclub-1   |   File "<frozen importlib._bootstrap_external>", line 1022, in exec_module
gitclub-1   |   File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
gitclub-1   |   File "/app/app/__init__.py", line 18, in <module>
gitclub-1   |     from .tracing import instrument_app
gitclub-1   |   File "/app/app/tracing.py", line 6, in <module>
gitclub-1   |     from opentelemetry.instrumentation.psycopg2 import Psycopg2Instrumentor
gitclub-1   |   File "/usr/local/lib/python3.13/site-packages/opentelemetry/instrumentation/psycopg2/__init__.py", line 108, in <module>
gitclub-1   |     import psycopg2
gitclub-1   |   File "/usr/local/lib/python3.13/site-packages/psycopg2/__init__.py", line 51, in <module>
gitclub-1   |     from psycopg2._psycopg import (                     # noqa
gitclub-1   |     ...<10 lines>...
gitclub-1   |     )
gitclub-1   | ImportError: Error relocating /usr/local/lib/python3.13/site-packages/psycopg2/_psycopg.cpython-313-aarch64-linux-musl.so: _PyInterpreterState_Get: symbol not found
gitclub-1   | [2024-10-11 14:00:17 +0000] [8] [INFO] Worker exiting (pid: 8)
gitclub-1   | [2024-10-11 14:00:17 +0000] [7] [INFO] Worker exiting (pid: 7)
gitclub-1   | [2024-10-11 14:00:17 +0000] [1] [ERROR] Worker (pid:7) exited with code 3
gitclub-1   | [2024-10-11 14:00:17 +0000] [1] [ERROR] Worker (pid:8) was sent SIGTERM!
gitclub-1   | [2024-10-11 14:00:17 +0000] [1] [ERROR] Shutting down: Master
gitclub-1   | [2024-10-11 14:00:17 +0000] [1] [ERROR] Reason: Worker failed to boot.
oso-1       | Server is in test mode, use token 'e_0123456789_12345_osotesttoken01xiIn'
oso-1       | failed to init LogTracer: SetLoggerError(())
gitclub-1 exited with code 3
oso-1       | Policy loaded
oso-1       |   2024-10-11T14:00:18.534887Z ERROR api::feature_flags::online: Error building tenant context, app.error: key cannot be empty
oso-1       |     at api/src/feature_flags/online.rs:190
oso-1       | 
jobs-1      | /home/node/app/node_modules/typeorm/src/driver/sqlite/SqliteDriver.ts:180
jobs-1      |             throw new DriverPackageNotInstalledError("SQLite", "sqlite3")
jobs-1      |                   ^
jobs-1      | DriverPackageNotInstalledError: SQLite package has not been found installed. Try to install it: npm install sqlite3 --save
jobs-1      |     at SqliteDriver.loadDependencies (/home/node/app/node_modules/typeorm/src/driver/sqlite/SqliteDriver.ts:180:19)
jobs-1      |     at new SqliteDriver (/home/node/app/node_modules/typeorm/src/driver/sqlite/SqliteDriver.ts:49:14)
jobs-1      |     at DriverFactory.create (/home/node/app/node_modules/src/driver/DriverFactory.ts:44:24)
jobs-1      |     at new DataSource (/home/node/app/node_modules/src/data-source/DataSource.ts:139:43)
jobs-1      |     at Object.<anonymous> (/home/node/app/src/localDb.ts:6:32)
jobs-1      |     at Module._compile (node:internal/modules/cjs/loader:1364:14)
jobs-1      |     at Module.m._compile (/home/node/app/node_modules/ts-node/src/index.ts:1597:23)
jobs-1      |     at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
jobs-1      |     at Object.require.extensions.<computed> [as .ts] (/home/node/app/node_modules/ts-node/src/index.ts:1600:12)
jobs-1      |     at Module.load (node:internal/modules/cjs/loader:1203:32)
jobs-1      | [nodemon] app crashed - waiting for file changes before starting...

@gsarjeant
Copy link
Collaborator

I found this issue against psycopg that indicates ongoing issues with python 3.13, so I downgraded the jobs service to 3.12.

I bumped gitcloud to the latest node LTS just as an experiment, but that fixed the SQLite error.

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