Skip to content

Commit 341a2e8

Browse files
committed
Completed config.md
Changes to be committed: modified: .secrets.example modified: README.md modified: admin_only/local_deployment.secrets modified: config/settings.py new file: docs/config.md renamed: docs/dockerDeployment.md -> docs/deployment/dockerDeployment.md renamed: docs/localDeployment.md -> docs/deployment/localDeployment.md renamed: docs/productionDeployment.md -> docs/deployment/productionDeployment.md new file: docs/testing.md
1 parent e085b68 commit 341a2e8

File tree

9 files changed

+81
-17
lines changed

9 files changed

+81
-17
lines changed

.secrets.example

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@ SECRET_KEY=
33
ANON_KEY=
44

55
[SERVER]
6-
PRODUCTION=
76
DEBUG=True
87
ALLOWED_HOSTS=
98
SERVER_VERSION=
109
HOSTNAME=
1110
HUMAN_READABLE_HOSTNAME=
1211
PUBLIC_HOSTNAME=
13-
SERVER_URL=
1412
DATABASE=
1513
EMAIL_BACKEND=

README.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
# BCO DB
2-
The BioCompute Database is designed to be deployable in a variety of environments.
3-
4-
## BCODB Quickstart
2+
The BioCompute Database is designed to be deployable in a variety of environments. If configured properly it should work with the [BioCompute Portal](https://biocomputeobject.org/) reguardelss of the deployment.
53

64
The BCO API repository contains a top-level folder “admin_only” which contains service definitions for gunicorn and django, an example database, and a prepopultated `.secrets` file (called `local_deployment.secrets`).
75

8-
The service definitions are for deployment on a server exposed ot the internet. A local deployment will not need to use those files. Below are links to deployment instructions in different environments.
9-
10-
- [Local deployment for devleopment](docs/localDeployment.md)
11-
- [Production deployment](docs/productionDeployment.md)
12-
- [Docker deployment](docs/dockerDeployment.md) [WIP]
13-
- [FAQ and trouble shooting](docs/faq.md)
6+
The service definitions are for deployment on a server exposed to the internet. A local deployment will not need to use those files. Below are links to instructions for deployment in different environments.
147

8+
## BCODB Deployment
159

10+
- [Local deployment](docs/deployment/localDeployment.md)
11+
- For develpment or internal use only
12+
- [Production deployment](docs/deployment/productionDeployment.md)
13+
- For deployment that is exposed to the internet
14+
- [Docker deployment](docs/deployment/dockerDeployment.md)
15+
- WIP: comming soon
1616

17-
## Issues and BCODB Development
17+
## BCODB Development and troubleshooting
18+
- [FAQ and trouble shooting](docs/faq.md)
19+
- [`.secretes` configuration](docs/config.md)
20+
- [Testing](docs/testing.md)

admin_only/local_deployment.secrets

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@ SECRET_KEY=^2uql114+yy0d$xv6+lm8*#1=uxs_oa0zw0bvu^fpi4tc9x0i
33
ANON_KEY=627626823549f787c3ec763ff687169206626149
44

55
[SERVER]
6-
PRODUCTION=False
76
DEBUG=True
87
ALLOWED_HOSTS=*
98
SERVER_VERSION=24.06.13
109
HOSTNAME=127.0.0.1:8000
1110
HUMAN_READABLE_HOSTNAME=DEV BCODB
1211
PUBLIC_HOSTNAME=http://127.0.0.1:8000
13-
SERVER_URL=http://localhost:3000
1412
DATABASE=db.sqlite3
1513
EMAIL_BACKEND=django.core.mail.backends.console.EmailBackend

config/settings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# Load the server config file.
1313
secrets = configparser.ConfigParser()
1414
secrets.read(BASE_DIR + "/.secrets")
15-
PRODUCTION = secrets["SERVER"]["PRODUCTION"]
1615
DEBUG = secrets["SERVER"]["DEBUG"]
1716
VERSION = secrets["SERVER"]["SERVER_VERSION"]
1817
# Set the anonymous user's key.

docs/config.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# BCO DB Configuration
2+
3+
Below is an example configuration file. This file contains sensitive information and deployment specific settings. Example values and specific instructions are given in each of the respective [deployment](docs/deployment) instructions.
4+
5+
See the [Django docs](https://docs.djangoproject.com/en/5.0/ref/settings/) for more specific details.
6+
``` shell
7+
[DJANGO_KEYS]
8+
SECRET_KEY=^2uql114+yy0d$xv6+lm8*#1=uxs_oa0zw0bvu^fpi4tc9x0i
9+
ANON_KEY=627626823549f787c3ec763ff687169206626149
10+
11+
[SERVER]
12+
DEBUG=True
13+
ALLOWED_HOSTS=*
14+
SERVER_VERSION=24.06.13
15+
HOSTNAME=127.0.0.1:8000
16+
HUMAN_READABLE_HOSTNAME=DEV BCODB
17+
PUBLIC_HOSTNAME=http://127.0.0.1:8000
18+
DATABASE=db.sqlite3
19+
EMAIL_BACKEND=django.core.mail.backends.console.EmailBackend
20+
```
21+
22+
23+
## DJANGO_KEYS: Keys and Tokens for Django
24+
### SECRET_KEY
25+
According to the Django docs the [SECRETE_KEY](https://docs.djangoproject.com/en/dev/ref/settings/#secret-key) is used for the following:
26+
- All sessions if you are using any other session backend than django.contrib.sessions.backends.cache, or are using the default get_session_auth_hash().
27+
- All messages if you are using CookieStorage or FallbackStorage.
28+
- All PasswordResetView tokens.
29+
- Any usage of cryptographic signing, unless a different key is provided.
30+
31+
If you rotate your secret key, all of the above will be invalidated. Secret keys are not used for passwords of users and key rotation will not affect them.
32+
33+
### ANON_KEY
34+
The BCO DB uses Django REST framework's [TokenAuthentication](https://www.django-rest-framework.org/api-guide/authentication/#tokenauthentication) as one of the athentication schems. To allow access to *public* objects and information there is a default [AnonymousUser](https://docs.djangoproject.com/en/5.0/ref/contrib/auth/#anonymoususer-object) set. This is the token to be set for the `AnonymousUser`.
35+
36+
## SERVER: Deployument specific settings
37+
38+
### DEBUG
39+
Django's [DEBUG](https://docs.djangoproject.com/en/5.0/ref/settings/#debug) flag.
40+
41+
It's a boolean that turns on/off debug mode, with the default as `False`. It is reccomended to never deploy a site into production with DEBUG turned on.
42+
43+
### ALLOWED_HOSTS
44+
45+
Django's [ALLOWED_HOSTS](https://docs.djangoproject.com/en/5.0/ref/settings/#allowed-hosts) list. Default is an empty list.
46+
47+
"A list of strings representing the host/domain names that this Django site can serve. This is a security measure to prevent HTTP Host header attacks, which are possible even under many seemingly-safe web server configurations."
48+
49+
### SERVER_VERSION
50+
The SERVER_VERSION is displayed on the Swagger Docs page.
51+
52+
### HOSTNAME
53+
The HOSTNAME to be returnd in the `user_info` object. This is used by the BCO Portal for interacting with a specific instance of the BCO DB.
54+
55+
### HUMAN_READABLE_HOSTNAME
56+
The HUMAN_READABLE_HOSTNAME to be returnd in the `user_info` object. This is used by the BCO Portal for interacting with a specific instance of the BCO DB, and in the Swager Docs.
57+
58+
### PUBLIC_HOSTNAME
59+
The PUBLIC_HOSTNAME to be returnd in the `user_info` object. This is used by the BCO Portal for interacting with a specific instance of the BCO DB, and in the Swager Docs. It is also utilized by the `activation_link`, `retrieve_bco`, `validate_bco_object_id` functions, as well as in the API tests.
60+
61+
### DATABASE
62+
This value is used as the `"NAME"`in Django's [DATABASES](https://docs.djangoproject.com/en/5.0/ref/settings/#databases) object. The BCO DB is set up to use the default SQLITE. If you would like to have a database that is outside of the project folder and/or has a non-default name than you can provide an absolute path for the name value here.
63+
64+
### EMAIL_BACKEND
65+
Specifies which of Django's [EMAIL_BACKEND](https://docs.djangoproject.com/en/5.0/topics/email/#topic-email-backends) classes to use.
66+
67+
This app has been tested using the `django.core.mail.backends.smtp.EmailBackend` with `sendmail` and a GMail account in production, and with `django.core.mail.backends.console.EmailBackend` in local deployments.
File renamed without changes.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ vim bco_api/bco_api/server.conf
3434

3535
Production and publishing flags NOTE: Valid values are True or False (note the capitalization).
3636

37-
[PRODUCTION]
38-
production=False
37+
3938
DB Version
4039

4140
[VERSION]
File renamed without changes.

docs/testing.md

Whitespace-only changes.

0 commit comments

Comments
 (0)