You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* fix: correct default for trees file
If the ingester was initialized with an empty trees_file argument it was not defaulting correctly since None was passed to the function
* docker-compose: Add dashboard ingester as separate service
The ingester is used to insert data into the database, so we always want it running smoothly in the project
while also not consuming resources or having its resources consumed by the backend as if it were just a cron job
Also fixes signal handling when running the ingester command within docker
and avoids running cronjobs in the new service.
Co-authored-by: Marcelo Robert Santos <marcelo.santos@profusion.mobi>
* feat: add pending items processing as a docker service
Follows the addition of the ingester service. This new service will consume the items generated by the ingester aggregation and organize them into the listing tables. It is done as a new service instead of a cronjob in order to avoid over-execution and multiple processes being started
Also adds a dockerignore file to avoid building cache folder/files and the folder for submission testing
* docker-compose: Remove cloud-sql
Removed old configuration for Google Cloud because it has been replaced with Azure database
Co-authored-by: Marcelo Robert Santos <marcelo.santos@profusion.mobi>
* chore: remove gcloud from docs
* feat: update trees file with ingester startup
Replaces the use of a cronjob to update the tree-names file with updating it with the ingester. This also lets the command be called within the code.
* refactor: separate commands containers further
Gives each command their specific env file and also separates the backend entrypoint
* refactor: simplify database env vars
Reverts to using only a single set of variables for the database setup; Removes the json format of the database env vars
* chore: add dashboard database setup script and initialization (#1750)
* chore: add dashboard database setup script and initialization
* refactor: update database user and name variables in setup scripts
* fix: use correct image names in compose
Corrects the image names setting the right variables for the images that can be pulled from kernelci/dashboard
* refactor: consolidate database initialization into setup script
---------
Co-authored-by: Denys Fedoryshchenko <denys.f@collabora.com>
Co-authored-by: Gustavo Flores <gustavo.flores@profusion.mobi>
We are not using sessions or anything like that right now, so changing the secret key won't be a big deal.
64
64
65
+
Since the production *database* is not open for the public, we use ssh tunneling with a whitelist to access it. This means that the docker setup currently can't access it, but we have a local database that is connected automatically if you don't change the env vars.
65
66
66
-
Add a `application_default_credentials.json` file with your ADC in the root of the project.
If it doesn't work, check the [Configure ADC with your Google Account](https://cloud.google.com/docs/authentication/provide-credentials-adc#google-idp) documentation.
81
-
82
-
Create a secret file with the database password:
67
+
If you do use docker, you should create a secret file with the database password:
If you are going to use a database user other than `kernelci`, set it to `DB_DEFAULT_USER`:
73
+
If you are going to use a database user other than `kernelci`, set it to `DB_USER`:
89
74
```sh
90
-
exportDB_DEFAULT_USER=<user>
75
+
exportDB_USER=<user>
91
76
```
92
77
93
78
If you are setting up instance different than production KernelCI dashboard, you need to define CORS_ALLOWED_ORIGINS. On .env.backend:
@@ -119,17 +104,15 @@ Or you can also run the env exports and docker compose within the root user by r
119
104
> Tip: you can create a quick script to set all the necessary envs and start the services. This will also allow docker to see the environment variables correclty. Example:
> [Note] If you are going to run using only the local database, the DB_DEFAULT_NAME should be `dashboard` and the `DB_DEFAULT_USER` and `DB_DEFAULT_PASSWORD` should be `admin` (for now).
131
-
> After you define those values, also set the env var `USE_DASHBOARD_DB` to True, setting the local database as the default one.
132
-
> You could also set the DB_DEFAULT variables to point to the local database and leave `USE_DASHBOARD_DB` as False.
115
+
> [Note] If you are going to run using only the local database, the DB_NAME should be `dashboard` and the `DB_USER` and `DB_PASSWORD` should be `admin` (for now). This simply follows what is going to be setup by the `dashboard_db` service on docker compose.
> It is possible to have authentication issues when escaping special characters. In some cases, it is necessary to add more than one backslash, whilein others, no addition is needed. To assist with this, you can export`DEBUG_DB_VARS=True` to check the database connection info in the terminal, allowing you to determine if the characters got escaped as intended. **This variable should NOT be set to True in production**.
62
57
63
-
Along with the main database, the backend also connects to a secondary, local db made while we transition between database providers. It uses a simpler environment variable structure:
64
-
```sh
65
-
DASH_DB_NAME=dashboard
66
-
DASH_DB_USER=admin
67
-
DASH_DB_PASSWORD=admin
68
-
DASH_DB_HOST=127.0.0.1
69
-
DASH_DB_PORT=5434 # Note that this is not 5432, avoids conflict with the proxy port.
70
-
```
71
-
72
-
If you have both connections and you want to use the local one as the default, the env var `USE_DASHBOARD_DB` can be exported as `True`for a quick flag change.
73
-
74
58
#### SQLite
75
59
76
60
Before running the server, you must also update a local SQLite database used for caching. You can simply run the [migrate-cache-db.sh](./migrate-cache-db.sh) script, which will update the migrations if needed and apply them.
77
61
78
62
79
63
## Running the server
80
64
81
-
After connecting to the database proxy, execute the server with:
65
+
After connecting to the database, execute the server with:
82
66
83
67
```sh
84
68
poetry run python3 manage.py runserver
@@ -89,7 +73,7 @@ poetry run python3 manage.py runserver
89
73
We have a couple of useful scripts:
90
74
91
75
* [migrate-cache-db.sh](./migrate-cache-db.sh) will create and apply migrations for the cache SQLite database. This runs automatically when running on docker, but you have to run it mannually otherwise.
92
-
* [migrate-app-db.sh](./migrate-app-db.sh) will create and apply migrations forthe main app, used for the secondary database. This does not run automaticallyin order to avoid potential problems. For this script, be aware of the `USE_DASHBOARD_DB` environment variable, because that variable will change the name of the databases (`dashboard_db` becomes `default` and `default` becomes `kcidb`) and so you'll have to change the command accordingly.
76
+
* [migrate-app-db.sh](./migrate-app-db.sh) will create and apply migrations forthe main app, generally used for the local database. This does not run automaticallyin order to avoid potential problems. Be aware that *if* you have write permissions to the production database it will be changed, so double check that you are connected to the right one (but usually developers won't have write access to the production database anyway).
93
77
94
78
It is important to note that Django automatically creates migrations based on changes to the models when running the first command of the scripts above. You can edit the migrations manually, and you can also run the commands by hand if you want more control over it.
95
79
@@ -236,7 +220,7 @@ In order to debug backend in PyCharm, just follow these steps:
236
220
- in `Run` session of the dialog, select `script`, then find the script `manage.py` at the `backend` folder
237
221
- at `script` name input, just enter `runserver`
238
222
- at `Environment Variables`, enter the following values:
0 commit comments