-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from greenjune-ship-it/12-display-ed50-and-ed5…
…0-thermal-threshold 12 display ed50, release v0.1.1
- Loading branch information
Showing
51 changed files
with
1,980 additions
and
500 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,5 @@ django_app/staticfiles/ | |
pg_dump.sql | ||
backup.pgdump | ||
|
||
.~* | ||
.~* | ||
/django_app/users/management/commands/user_data.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,39 +31,57 @@ CONTACT_EMAIL_ADDRESS='' | |
|
||
### Deploy | ||
|
||
From backup: | ||
#### Up the project from scratch | ||
|
||
```commandline | ||
bash deploy.sh | ||
docker compose up -d | ||
``` | ||
|
||
Up the project from scratch: | ||
#### Create superuser | ||
|
||
```commandline | ||
sudo docker compose up -d | ||
docker compose exec django-app python manage.py createsuperuser | ||
``` | ||
|
||
Collect static files: | ||
You can also prepare your `user_data.json` and populate your database automatically: | ||
|
||
```commandline | ||
sudo docker compose exec django-app python manage.py collectstatic --noinput | ||
``` | ||
[ | ||
{"username": "user1", "password": "password123", "first_name": "John", "last_name": "Doe", "email": "[email protected]"}, | ||
{"username": "user2", "password": "password456", "first_name": "Jane", "last_name": "Smith", "email: "[email protected]"}, | ||
{"username": "admin", "password": "adminpassword", "first_name": "Admin", "last_name": "User", "email": "[email protected]"} | ||
] | ||
Create superuser: | ||
``` | ||
And then run custom django-admin command: | ||
|
||
```commandline | ||
sudo docker compose exec django-app python manage.py createsuperuser | ||
docker compose exec django-app python manage.py create_users path/to/user_data.json | ||
``` | ||
Don't forget to replace the path to your `user_data.json` file. | ||
|
||
#### Populate the database | ||
|
||
Populate the database (let's say my superuser is `adm_iakovyu1`: | ||
Let's say my superuser is `adm_iakovyu1`. | ||
|
||
For complete datasets: | ||
|
||
```commandline | ||
sudo docker compose exec django-app python populate_db.py \ | ||
--owner iakovyu1 \ | ||
docker compose exec django-app python populate_db.py \ | ||
--owner adm_iakovyu1 \ | ||
--csv_path static/datasheets/cbass_84.csv | ||
``` | ||
|
||
For incomplete datasets, use `--no-pam` argument: | ||
|
||
```commandline | ||
docker compose exec django-app python populate_db.py \ | ||
--owner adm_iakovyu1 \ | ||
--csv_path static/datasheets/redsea_gradient_study.csv \ | ||
--no-pam | ||
``` | ||
|
||
## Database Backups | ||
|
||
Create a database backup: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,10 @@ | ||
#!/bin/bash | ||
|
||
source .env | ||
|
||
docker compose up -d | ||
|
||
docker compose pause django-app | ||
|
||
docker compose cp backup.pgdump database:backup.pgdump | ||
|
||
echo "Drop the database and restore from backup" | ||
|
||
docker compose exec database \ | ||
pg_restore --clean --dbname $DB_NAME -U $DB_USER backup.pgdump | ||
docker compose exec django-app python manage.py create_users user_data.json | ||
|
||
echo "Done!" | ||
docker compose exec django-app python manage.py populate_db --owner voolsch1 --csv_path static/datasheets/cbass_84.csv | ||
docker compose exec django-app python manage.py populate_db --owner voolsch1 --csv_path static/datasheets/redsea_gradient_study.csv --no-pam | ||
|
||
docker compose unpause django-app | ||
docker compose exec django-app python manage.py link_biosamples |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.