Skip to content
Snippets Groups Projects
Commit f38621c3 authored by Roy de Goei's avatar Roy de Goei
Browse files

Merge remote-tracking branch 'origin/main' into SDC-685

parents 740811d9 922d9ea3
No related branches found
No related tags found
1 merge request!4SDC-685: Script which migrates ldvadmin data to ldv-spec-db
Pipeline #33681 passed
...@@ -10,6 +10,7 @@ LDV Specification Application. For filling ATDB-LDV with processing tasks for LO ...@@ -10,6 +10,7 @@ LDV Specification Application. For filling ATDB-LDV with processing tasks for LO
- https://drive.google.com/file/d/1_j9Fp505pZTxcmzAEdgftdPkoIFrKfAX/view?usp=sharing - https://drive.google.com/file/d/1_j9Fp505pZTxcmzAEdgftdPkoIFrKfAX/view?usp=sharing
## Collaborate ## Collaborate
* create `your branch` from `main` * create `your branch` from `main`
* add your functionality * add your functionality
* test your functionality locally * test your functionality locally
...@@ -20,11 +21,72 @@ LDV Specification Application. For filling ATDB-LDV with processing tasks for LO ...@@ -20,11 +21,72 @@ LDV Specification Application. For filling ATDB-LDV with processing tasks for LO
* deploy in production, and test it * deploy in production, and test it
### Local update ### Local update
After a collegue has made changes, then locally After a collegue has made changes, then locally:
* git pull ```
* pip install -r requirements\dev.tx > git pull
* python manage.py migrate --settings=ldvspec.settings.dev > pip install -r requirements\dev.txt
> python manage.py migrate --settings=ldvspec.settings.dev
```
## Local Development Environment
### Postgres Database in Docker
Run `docker-compose up -d` with the following compose file to spin up a new Postgres container.
See the `docker-compose-postgres-dev.yml` file in the `docker` directory.
(not that port 5433 is used. You can change that at will, but then also change it in `dev.py`)
```yaml
version: "3.7"
services:
ldv-spec-db:
image: postgres:14
container_name: ldv-spec-postgres
expose:
- 5433
ports:
- 5433:5432
environment:
POSTGRES_PASSWORD: "secret"
POSTGRES_USER: "postgres"
POSTGRES_DB: "ldv-spec-db"
volumes:
- ldv-spec-db:/var/lib/postgresql/data
restart: always
volumes:
ldv-spec-db:
```
### Django Application
* clone the repo
* open the project in Pycharm
* create a venv (File -> Settings -> Project -> Project Interpreter -> (click cog) -> add)
* pip install -r requirements\dev.txt
* check and/or change the database connection in settings/dev/py. In this example it connects to a database server on 'raspiastro',
you have to change that to the server where you run your Postgres Docker container (localhost?)
```python
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'USER': 'postgres',
'PASSWORD': 'secret',
'NAME': 'ldv-spec-db',
'HOST': 'raspiastro',
'PORT': '5433',
},
}
```
```
> python manage.py migrate --settings=ldvspec.settings.dev
> python manage.py runserver --settings=ldvspec.settings.dev
> python manage.py createsuperuser --settings=ldvspec.settings.dev
```
## Test Environment ## Test Environment
* https://sdc-dev.astron.nl/ldvspec/ * https://sdc-dev.astron.nl/ldvspec/
......
version: "3.7"
services:
ldv-spec-db:
image: postgres:14
container_name: ldv-spec-postgres
expose:
- 5433
ports:
- 5433:5432
env_file:
- $HOME/shared/ldvspec.env
environment:
POSTGRES_PASSWORD: "secret"
POSTGRES_USER: "postgres"
POSTGRES_DB: "ldv-spec-db"
volumes:
- ldv-spec-db:/var/lib/postgresql/data
restart: always
volumes:
ldv-spec-db:
\ No newline at end of file
...@@ -10,11 +10,11 @@ CORS_ORIGIN_ALLOW_ALL = True ...@@ -10,11 +10,11 @@ CORS_ORIGIN_ALLOW_ALL = True
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', 'ENGINE': 'django.db.backends.postgresql_psycopg2',
'USER': 'atdb_admin', 'USER': 'postgres',
'PASSWORD': 'atdb123', 'PASSWORD': 'secret',
'NAME': 'ldv-spec-db', 'NAME': 'ldv-spec-db',
'HOST': 'localhost', 'HOST': 'raspiastro',
'PORT': '5432', 'PORT': '5433',
}, },
} }
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
</tbody> </tbody>
</table> </table>
<p class="footer"> Version 1.0.0 (25 jul 2022 - 8:00) <p class="footer"> Version 1.0.0 (26 jul 2022 - 13:00)
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment