Skip to content

Commit

Permalink
add some indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jin-Sun-tts committed Mar 19, 2024
1 parent 8d5bd69 commit 719c58c
Show file tree
Hide file tree
Showing 20 changed files with 253 additions and 353 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ jobs:
- name: deploy DHL
uses: cloud-gov/cg-cli-tools@main
with:
command: cf push datagov-harvesting-logic --vars-file vars.development.yml --strategy rolling --no-wait
command: cf push --vars-file vars.development.yml --strategy rolling --no-wait
cf_org: gsa-datagov
cf_space: ${{vars.ENVIRONMENT_NAME}}
cf_username: ${{secrets.CF_SERVICE_USER}}
cf_password: ${{secrets.CF_SERVICE_AUTH}}
- name: smoke test
uses: cloud-gov/cg-cli-tools@main
with:
command: cf run-task datagov-harvesting-logic -c "/home/vcap/app/scripts/smoke-test.py" --name smoke-test
command: cf run-task harvesting-logic -c "/home/vcap/app/scripts/smoke-test.py" --name smoke-test
cf_org: gsa-datagov
cf_space: ${{vars.ENVIRONMENT_NAME}}
cf_username: ${{secrets.CF_SERVICE_USER}}
Expand All @@ -91,7 +91,7 @@ jobs:
uses: cloud-gov/cg-cli-tools@main
with:
command: >
scripts/monitor-cf-logs.sh datagov-harvesting-logic smoke-test
scripts/monitor-cf-logs.sh harvesting-logic smoke-test
cf_org: gsa-datagov
cf_space: ${{vars.ENVIRONMENT_NAME}}
cf_username: ${{secrets.CF_SERVICE_USER}}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ tmp/
# vscode debugger
.vscode/
.env
requirements.txt

5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ RUN pip install --no-cache-dir -r requirements.txt

EXPOSE 8080

CMD ["python", "app.py"]
ENV FLASK_APP=run.py

# Run run.py when the container launches
CMD ["flask", "run", "--host=0.0.0.0", "--port=8080"]
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ If you followed the instructions for `CKAN load testing` and `Harvester testing`

This will start the necessary services and execute the test.

3. when there are database DDL changes, use following steps to generate migration scripts and update database:

```bash
docker-compose db up
docker-compose run app flask db migrate -m "migration description"
docker-compose run app flask db upgrade
```

### Deployment to cloud.gov

#### Database Service Setup
Expand Down Expand Up @@ -143,4 +151,10 @@ Accessing the service can be done with service keys. They can be created with `c
```bash
poetry export -f requirements.txt --output requirements.txt --without-hashes
cf push --vars-file vars.development.yml
```
```
3. when there are database DDL changes, use following to do the database update:
```bash
cf run-task harvesting-logic --command "flask db upgrade" --name database-upgrade
```
91 changes: 0 additions & 91 deletions app.py

This file was deleted.

4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,14 @@ services:
build: .
depends_on:
- db
volumes:
- .:/app
environment:
DATABASE_URI: ${DATABASE_URI}
FLASK_APP: run.py
ports:
- "8080:8080"
command: flask run --host=0.0.0.0 --port=8080

volumes:
postgres_data:
3 changes: 0 additions & 3 deletions harvester/database/__init__.py

This file was deleted.

14 changes: 0 additions & 14 deletions harvester/database/init_db.py

This file was deleted.

79 changes: 0 additions & 79 deletions harvester/database/interface.py

This file was deleted.

58 changes: 0 additions & 58 deletions harvester/database/models.py

This file was deleted.

4 changes: 2 additions & 2 deletions harvester/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
from datetime import datetime
from .database.interface import HarvesterDBInterface
from app.interface import HarvesterDBInterface


# critical exceptions
Expand Down Expand Up @@ -60,7 +60,7 @@ def __init__(self, msg, harvest_job_id, title):
"severity": self.severity,
"type": self.type,
"date_created": datetime.utcnow(),
"record_id": self.title,
"harvest_record_id": self.title # to-do
}

self.db_interface.add_harvest_error(error_data, self.harvest_job_id)
Expand Down
3 changes: 2 additions & 1 deletion manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ applications:
instances: 1
env:
DATABASE_NAME: ((database_name))
command: python app.py
FLASK_APP: run.py
command: flask run --host=0.0.0.0 --port=8080
Loading

0 comments on commit 719c58c

Please sign in to comment.