Skip to content

Commit f1d6d61

Browse files
authored
Merge branch 'dev' into dependabot/docker/compose/local/docs/python-3.10.14-slim-bullseye
2 parents 5902bd0 + 4d5d8cf commit f1d6d61

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1217
-307
lines changed

.envs/.local/.django

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,7 @@ SINEQUA_CONFIGS_REPO_WEBAPP_PR_BRANCH='dummy_branch'
3333
# Slack Webhook
3434
# ------------------------------------------------------------------------------
3535
SLACK_WEBHOOK_URL=''
36+
LRM_USER=''
37+
LRM_PASSWORD=''
38+
XLI_USER=''
39+
XLI_PASSWORD=''
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: Bug report
3+
about: Create a bug report to help the development team fix any issues on COSMOS
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
## Describe the bug
11+
A clear and concise description of what the bug is.
12+
13+
## Steps To Reproduce
14+
Steps to reproduce the behavior on https://sde-indexing-helper.nasa-impact.net/:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
## Expected behavior
21+
A clear and concise description of what you expected to happen originally.
22+
23+
## Screenshots
24+
If applicable, add screenshots to help explain your problem.
25+
26+
## Desktop (please complete the following information):
27+
- OS: [e.g. iOS]
28+
- Browser: [e.g. chrome, safari]
29+
- Version: [e.g. 22]
30+
31+
## Smartphone (please complete the following information):
32+
- Device: [e.g. iPhone6]
33+
- OS: [e.g. iOS8.1]
34+
- Browser: [e.g. stock browser, safari]
35+
- Version: [e.g. 22]
36+
37+
## Additional context
38+
Add any other context about the problem here.

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,26 @@ To load collections:
7878
$ docker-compose -f local.yml run --rm django python manage.py loaddata sde_collections/fixtures/collections.json
7979
```
8080

81-
### Loading the Database from a Backup
81+
### Manually Creating and Loading a ContentTypeless Backup
82+
Navigate to the server running prod, then to the project folder. Run the following command to create a backup:
83+
84+
```bash
85+
docker-compose -f production.yml run --rm --user root django python manage.py dumpdata --natural-foreign --natural-primary --exclude=contenttypes --exclude=auth.Permission --indent 2 --output /app/backups/prod_backup-20240812.json
86+
```
87+
This will have saved the backup in a folder outside of the docker container. Now you can copy it to your local machine.
88+
89+
```bash
90+
mv ~/prod_backup-20240812.json <project_path>/prod_backup-20240812.json
91+
scp sde:/home/ec2-user/sde_indexing_helper/backups/prod_backup-20240812.json prod_backup-20240812.json
92+
```
93+
94+
Finally, load the backup into your local database:
95+
96+
```bash
97+
docker-compose -f local.yml run --rm django python manage.py loaddata prod_backup-20240812.json
98+
```
99+
100+
### Loading the Database from an Arbitrary Backup
82101

83102
1. Build the project and run the necessary containers (as documented above).
84103
2. Clear out content types using the Django shell:

compose/local/django/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# define an alias for the specfic python version used in this file.
2-
FROM python:3.10.13-slim-bullseye as python
2+
FROM python:3.10.13-slim-bullseye AS python
33

44
# Python build stage
5-
FROM python as python-build-stage
5+
FROM python AS python-build-stage
66

77
ARG BUILD_ENVIRONMENT=local
88

@@ -25,7 +25,7 @@ RUN pip wheel --wheel-dir /usr/src/app/wheels \
2525

2626

2727
# Python 'run' stage
28-
FROM python as python-run-stage
28+
FROM python AS python-run-stage
2929

3030
ARG BUILD_ENVIRONMENT=local
3131
ARG APP_HOME=/app

compose/local/docs/Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# define an alias for the specfic python version used in this file.
22
FROM python:3.10.14-slim-bullseye as python
33

4-
54
# Python build stage
6-
FROM python as python-build-stage
5+
FROM python AS python-build-stage
76

87
ENV PYTHONDONTWRITEBYTECODE 1
98

@@ -26,7 +25,7 @@ RUN pip wheel --no-cache-dir --wheel-dir /usr/src/app/wheels \
2625

2726

2827
# Python 'run' stage
29-
FROM python as python-run-stage
28+
FROM python AS python-run-stage
3029

3130
ARG BUILD_ENVIRONMENT
3231
ENV PYTHONUNBUFFERED 1

compose/production/django/Dockerfile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
2-
31
# define an alias for the specfic python version used in this file.
4-
FROM python:3.10.13-slim-bullseye as python
2+
FROM python:3.10.14-slim-bullseye AS python
53

64
# Python build stage
7-
FROM python as python-build-stage
5+
FROM python AS python-build-stage
86

97
ARG BUILD_ENVIRONMENT=production
108

@@ -27,7 +25,7 @@ RUN pip wheel --wheel-dir /usr/src/app/wheels \
2725

2826

2927
# Python 'run' stage
30-
FROM python as python-run-stage
28+
FROM python AS python-run-stage
3129

3230
ARG BUILD_ENVIRONMENT=production
3331
ARG APP_HOME=/app

compose/production/traefik/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM traefik:2.11.0
1+
FROM traefik:3.1.2
22
RUN mkdir -p /etc/traefik/acme \
33
&& touch /etc/traefik/acme/acme.json \
44
&& chmod 600 /etc/traefik/acme/acme.json

config/settings/base.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,21 @@
7474
"crispy_bootstrap5",
7575
"crispy_forms",
7676
"django_celery_beat",
77+
"django_filters",
7778
"rest_framework_datatables",
7879
"rest_framework",
7980
]
8081

82+
LOCAL_APPS = [
83+
"environmental_justice",
84+
"feedback",
85+
"sde_collections",
86+
"sde_indexing_helper.users",
87+
]
88+
89+
# https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps
90+
INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
91+
8192
CORS_ALLOWED_ORIGINS = [
8293
"http://localhost:3000",
8394
"http://sde-lrm.nasa-impact.net",
@@ -91,15 +102,6 @@
91102
"http://localhost:4200",
92103
]
93104

94-
LOCAL_APPS = [
95-
"environmental_justice",
96-
"sde_indexing_helper.users",
97-
"sde_collections",
98-
"feedback",
99-
]
100-
# https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps
101-
INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
102-
103105
# MIGRATIONS
104106
# ------------------------------------------------------------------------------
105107
# https://docs.djangoproject.com/en/dev/ref/settings/#migration-modules
@@ -339,3 +341,7 @@
339341
SINEQUA_CONFIGS_REPO_DEV_BRANCH = env("SINEQUA_CONFIGS_REPO_DEV_BRANCH")
340342
SINEQUA_CONFIGS_REPO_WEBAPP_PR_BRANCH = env("SINEQUA_CONFIGS_REPO_WEBAPP_PR_BRANCH")
341343
SLACK_WEBHOOK_URL = env("SLACK_WEBHOOK_URL")
344+
XLI_USER = env("XLI_USER")
345+
XLI_PASSWORD = env("XLI_PASSWORD")
346+
LRM_USER = env("LRM_USER")
347+
LRM_PASSWORD = env("LRM_PASSWORD")
Lines changed: 34 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,49 @@
1-
# rename this file to config.py and do not track it on git
2-
# example on how to get the token are in the README.md
3-
# go down to the bottom to the section called this is the stuff you want to change
1+
from sources_to_scrape import (
2+
sources_to_index_test_grid_20240809,
3+
)
44

5-
from sources_to_scrape import sources_to_delete_20231108
6-
7-
# API Config
85
tokens: dict[str, str] = {
96
"test_server": "token here",
107
"ren_server": "token here",
118
}
129

1310
AVAILABLE_INDEXERS_TEST = [
14-
"NodeIndexer1/identity0",
15-
"NodeWebapp1/identity0",
16-
"NodeWebapp2/identity0",
17-
"NodeWebapp3/identity0",
11+
"IndexerServerA/identity0",
12+
"IndexerServerB/identity0",
1813
]
1914

2015
AVAILABLE_INDEXERS_PROD = ["NodeINDEX1/identity0", "NodeINDEX2/identity0"]
2116

2217
TEST_SERVER_INDEXES = [ # this is the test server list
23-
"HELIO_Repository_1",
24-
"SDE_Acronyms",
25-
"SMD_ASTRO_Repository_1",
26-
"SMD_ASTRO_Repository_2",
27-
"SMD_EARTHSCIENCE_Repository_1",
28-
"SMD_GENELAB_Repository_1",
29-
"SMD_PLANETARY_Repository_1",
30-
"SMD_PLANETARY_Repository_2",
18+
# "sde_neural_test_index",
19+
"sde_index"
3120
]
3221

3322
PROD_SERVER_INDEXES = [
3423
# "EDP_Audit_1",
35-
"SMD_LSDA_Repository_1",
36-
# "EDP_UserMetadata_1",
37-
"SMD_NTRS_Repository_1",
38-
"GCMD_Repository_1",
39-
"SMD_PLANETARY_Repository_1",
40-
# "GCMD_Repository_1_Metadata",
41-
"SMD_PLANETARY_Repository_2",
42-
"GCMD_Repository_2",
43-
"STI_Repository_1",
44-
# "GCMD_Repository_3_Metadata",
45-
# "STI_Repository_1_Metadata",
46-
"HELIO_Repository_1",
47-
"STI_Repository_2",
24+
# "SMD_LSDA_Repository_1",
25+
# # "EDP_UserMetadata_1",
26+
# "SMD_NTRS_Repository_1",
27+
# "GCMD_Repository_1",
28+
# "SMD_PLANETARY_Repository_1",
29+
# # "GCMD_Repository_1_Metadata",
30+
# "SMD_PLANETARY_Repository_2",
31+
# "GCMD_Repository_2",
32+
# "STI_Repository_1",
33+
# # "GCMD_Repository_3_Metadata",
34+
# # "STI_Repository_1_Metadata",
35+
# "HELIO_Repository_1",
36+
# "STI_Repository_2",
4837
"SDE_Index",
4938
# "STI_Repository_2_Metadata",
50-
"SMD_ASTRO_Repository_1",
51-
"STI_Repository_3",
52-
"SMD_ASTRO_Repository_2",
53-
"STI_Repository_4",
54-
"SMD_EARTHSCIENCE_Repository_1",
55-
# "SinequaDoc",
56-
"SMD_GENELAB_Repository_1",
57-
"Test",
39+
# "SMD_ASTRO_Repository_1",
40+
# "STI_Repository_3",
41+
# "SMD_ASTRO_Repository_2",
42+
# "STI_Repository_4",
43+
# "SMD_EARTHSCIENCE_Repository_1",
44+
# # "SinequaDoc",
45+
# "SMD_GENELAB_Repository_1",
46+
# "Test",
5847
]
5948

6049

@@ -69,12 +58,14 @@
6958
},
7059
}
7160

72-
# this is the stuff you want to change
73-
collection_list: list[str] = sources_to_delete_20231108 # python list
74-
source = "SMD"
75-
batch_name: str = "delete_everywhere_20231108_test"
61+
# Job Creation Config
62+
collection_list: list[str] = sources_to_index_test_grid_20240809 # python list
63+
date = "20240809"
64+
source = "SDE"
7665
server = "test"
7766

7867
# auto assigned
68+
batch_delete_name: str = f"sources_to_delete_on_{server}_{date}"
69+
batch_index_name: str = f"sources_to_index_on_{server}_{date}"
7970
available_indexers = SERVER_INFO[server]["indexers"]
8071
indexes_to_delete_from = SERVER_INFO[server]["indexes"]

config_generation/delete_server_content.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@
22

33
from db_to_xml_file_based import XmlEditor
44

5-
from config import batch_name, collection_list, indexes_to_delete_from, source
5+
from config import batch_delete_name, collection_list, indexes_to_delete_from, source, engines
66

77
COMMAND_FILES_PATH = "../sinequa_configs/commands/"
88
DELETE_COMMAND_TEMPLATE_PATH = "xmls/delete_template.xml"
99

1010
command_file = XmlEditor(DELETE_COMMAND_TEMPLATE_PATH)
1111

12+
command_file.update_or_add_element_value(element_name="Engines", element_value=",".join([engine for engine in engines]))
1213
for collection in collection_list:
1314
for index in indexes_to_delete_from:
1415
sql = f"delete from {index} where collection='/{source}/{collection}/'"
1516
command_file.update_or_add_element_value(element_name="SQL", element_value=sql, add_duplicate=True)
16-
file_name = f"{COMMAND_FILES_PATH}{batch_name}.xml"
17+
18+
file_name = f"{COMMAND_FILES_PATH}{batch_delete_name}.xml"
1719
command_file._update_config_xml(file_name)

0 commit comments

Comments
 (0)