Skip to content

Commit 55eab17

Browse files
authored
Deployment to Production Mode (#46)
* adds all deployment changes * removes colocarpy requirement * adds init file * fixes import * updates python config * one more time * updates config * manually add path * edit django config * update requirements * change project name * move eb extensions * update settings * shifting folders around * fix static files * collects all statics * updates settings once more * remove ds store * updates readme
1 parent 06713cc commit 55eab17

File tree

207 files changed

+33534
-30
lines changed

Some content is hidden

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

207 files changed

+33534
-30
lines changed

.DS_Store

-6 KB
Binary file not shown.

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,7 @@ dmypy.json
129129
# Pyre type checker
130130
.pyre/
131131

132-
neuvueDB
132+
# Elastic Beanstalk Files
133+
.elasticbeanstalk/*
134+
!.elasticbeanstalk/*.cfg.yml
135+
!.elasticbeanstalk/*.global.yml

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "neuvue-client"]
2+
path = neuvue_project/deps/neuvue-client
3+
url = https://github.com/aplbrain/neuvue-client.git

Neuvue_Blueprint.png

203 KB
Loading

README.md

+77-12
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,77 @@
1-
# neuvue
2-
MICrONS Proofreading App
3-
4-
## How to run the app locally
5-
6-
- create a virtual environment using the requirements.txt file
7-
- activate the environment
8-
- check for django updates:
9-
- run `python3 manage.py makemigrations`
10-
- run `python3 manage.py migrate`
11-
- run `python3 manage.py runserver localhost:8000`
12-
- navigate to [http://127.0.0.1:8000/]( http://127.0.0.1:8000/) in your browser
1+
<h3 align=center>Neuvue</h3>
2+
<h6 align=center>Proofreading web-app and task management system</h6>
3+
4+
## Installation
5+
6+
Create a python3 virtual environment and install the requirements in neuvue_project/requirements.txt.
7+
8+
```shell
9+
python -m venv venv
10+
source venv/bin/activate
11+
pip install -r neuvue_project/requirements.txt
12+
```
13+
14+
## Running a development environment
15+
16+
For development purposes, there is a included neuvueDB.sqlite3 database file containing the tables needed to run the Django app. By default, the settings are configured for production which uses a cloud-enabled MySQL datatbase server. Here are the steps to enable development mode.
17+
18+
1. Open `neuvue_project/neuvue/settings.py` and set `DEBUG=True`
19+
20+
2. In the same file, modify `NEUVUE_QUEUE_ADDR` variable to the Nuevue-Queue endpoint you would like to use.
21+
22+
3. Get the recent migrations to the database by running
23+
24+
`python manage.py migrate`
25+
26+
4. (OPTIONAL) Create a superuser to modify the app in your development environment.
27+
28+
`python manage.py createsuperuser`
29+
30+
5. Run the app with the `runserver` command to start a development instance. Run on the localhost:8000 address and port to allow OAuth client to properly authenticate user.
31+
32+
`python manage.py runserver localhost:8000`
33+
34+
6. Open your app on http://localhost:8000
35+
36+
## Deploying to production
37+
38+
We use AWS Elastic Beanstalk to deploy Neuvue. To re-deploy after changes are made to the production branch, follow the instructions below.
39+
40+
1. Update your AWS credentials in `~/.aws/credentials` file with a long-lived token generated on cloudmanager.jhuapl.edu.
41+
42+
2. Install the elastic beanstalk CLI and restart the terminal.
43+
44+
`sudo pip install --upgrade awsebcli`
45+
46+
3. Change directories to `neuvue_project` and run `eb init`. This will connect to the current deployment environment.
47+
48+
```bash
49+
cd neuvue_project
50+
eb init
51+
```
52+
53+
4. (OPTIONAL) Run `eb health` to check the current status of the app.
54+
55+
5. Run `eb deploy` to upload your local environment to the production system. You do not have to run `manage.py collectstatic`, elastic beanstalk will do this for you.
56+
57+
Modifications to the elastic beanstalk environment (database, instance types, error logs, etc) are best handled directly throught the AWS console.
58+
59+
60+
## OAuth Set-up
61+
62+
The included development database is preconfigured to allow OAuth to authetnticate user accounts from `localhost:8000`. For a more complete guide on how this was done, refer to this link:
63+
64+
https://www.section.io/engineering-education/django-google-oauth/
65+
66+
We use `django-allauth` to connect Google OAuth to the Django environment. Users also have the option to log in through the base allauth login/signup page:
67+
68+
http://localhost:8000/accounts/login/
69+
70+
Django users, OAuth settings, and site configuration can be modified in the admin console.
71+
72+
http://localhost:8000/admin
73+
74+
75+
## Cloud Blueprint
76+
77+
<img src="Neuvue_Blueprint.png" style="background-color: rgb(300, 300, 300);">

django/neuvueDB

-220 KB
Binary file not shown.

django/static/images/.DS_Store

-6 KB
Binary file not shown.

django/workspace/.DS_Store

-6 KB
Binary file not shown.
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
option_settings:
2+
aws:elasticbeanstalk:application:environment:
3+
DJANGO_SETTINGS_MODULE: "neuvue.settings"
4+
PYTHONPATH: "/var/app/current:$PYTHONPATH"
5+
aws:elasticbeanstalk:container:python:
6+
WSGIPath: neuvue.wsgi:application
7+
NumProcesses: 3
8+
NumThreads: 20
9+
aws:elasticbeanstalk:environment:proxy:staticfiles:
10+
/static: static
11+
12+
container_commands:
13+
01_migrate:
14+
command: "source /var/app/venv/*/bin/activate && python3 manage.py migrate"
15+
leader_only: true
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
option_settings:
2+
aws:elbv2:listener:443:
3+
SSLCertificateArns: arn:aws:acm:us-east-1:473318664541:certificate/78634bd0-b992-44d1-81f3-da0c52b7ba24
4+
Protocol: HTTPS
5+
Resources:
6+
AWSEBV2LoadBalancerListener:
7+
Type: 'AWS::ElasticLoadBalancingV2::Listener'
8+
Properties:
9+
LoadBalancerArn: { "Ref" : "AWSEBV2LoadBalancer" }
10+
DefaultActions:
11+
- RedirectConfig:
12+
Port: 443
13+
Protocol: HTTPS
14+
StatusCode: HTTP_301
15+
Type: redirect
16+
Port: 80
17+
Protocol: HTTP
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
packages:
2+
yum:
3+
python3-devel: []
4+
mariadb-devel: []

neuvue_project/.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
# Elastic Beanstalk Files
3+
.elasticbeanstalk/*
4+
!.elasticbeanstalk/*.cfg.yml
5+
!.elasticbeanstalk/*.global.yml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
# Created by https://www.gitignore.io/api/code,macos,python,jupyternotebook
2+
3+
### Code ###
4+
# Visual Studio Code - https://code.visualstudio.com/
5+
.settings/
6+
.vscode/
7+
tsconfig.json
8+
jsconfig.json
9+
10+
### JupyterNotebook ###
11+
.ipynb_checkpoints
12+
*/.ipynb_checkpoints/*
13+
14+
# Remove previous ipynb_checkpoints
15+
# git rm -r .ipynb_checkpoints/
16+
#
17+
18+
### macOS ###
19+
# General
20+
.DS_Store
21+
.AppleDouble
22+
.LSOverride
23+
24+
# Icon must end with two \r
25+
Icon
26+
27+
# Thumbnails
28+
._*
29+
30+
# Files that might appear in the root of a volume
31+
.DocumentRevisions-V100
32+
.fseventsd
33+
.Spotlight-V100
34+
.TemporaryItems
35+
.Trashes
36+
.VolumeIcon.icns
37+
.com.apple.timemachine.donotpresent
38+
39+
# Directories potentially created on remote AFP share
40+
.AppleDB
41+
.AppleDesktop
42+
Network Trash Folder
43+
Temporary Items
44+
.apdisk
45+
46+
### Python ###
47+
# Byte-compiled / optimized / DLL files
48+
__pycache__/
49+
*.py[cod]
50+
*$py.class
51+
52+
# C extensions
53+
*.so
54+
55+
# Distribution / packaging
56+
.Python
57+
build/
58+
develop-eggs/
59+
dist/
60+
downloads/
61+
eggs/
62+
.eggs/
63+
lib/
64+
lib64/
65+
parts/
66+
sdist/
67+
var/
68+
wheels/
69+
*.egg-info/
70+
.installed.cfg
71+
*.egg
72+
MANIFEST
73+
74+
# PyInstaller
75+
# Usually these files are written by a python script from a template
76+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
77+
*.manifest
78+
*.spec
79+
80+
# Installer logs
81+
pip-log.txt
82+
pip-delete-this-directory.txt
83+
84+
# Unit test / coverage reports
85+
htmlcov/
86+
.tox/
87+
.coverage
88+
.coverage.*
89+
.cache
90+
nosetests.xml
91+
coverage.xml
92+
*.cover
93+
.hypothesis/
94+
.pytest_cache/
95+
96+
# Translations
97+
*.mo
98+
*.pot
99+
100+
# Django stuff:
101+
*.log
102+
local_settings.py
103+
db.sqlite3
104+
105+
# Flask stuff:
106+
instance/
107+
.webassets-cache
108+
109+
# Scrapy stuff:
110+
.scrapy
111+
112+
# Sphinx documentation
113+
docs/_build/
114+
115+
# PyBuilder
116+
target/
117+
118+
# Jupyter Notebook
119+
120+
# pyenv
121+
.python-version
122+
123+
# celery beat schedule file
124+
celerybeat-schedule
125+
126+
# SageMath parsed files
127+
*.sage.py
128+
129+
# Environments
130+
.env
131+
.venv
132+
env/
133+
venv/
134+
ENV/
135+
env.bak/
136+
venv.bak/
137+
138+
# Spyder project settings
139+
.spyderproject
140+
.spyproject
141+
142+
# Rope project settings
143+
.ropeproject
144+
145+
# mkdocs documentation
146+
/site
147+
148+
# mypy
149+
.mypy_cache/
150+
151+
### Python Patch ###
152+
.venv/
153+
154+
155+
# End of https://www.gitignore.io/api/code,macos,python,jupyternotebook
156+
157+
### colocarpy ###
158+
159+
notebooks/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- **0.2.1**
2+
- Fix infamous `_id` index error when a result has zero rows; now returns an empty dataframe with the correct columns.
3+
- Add test suite
4+
- Add `limit` argument when requesting large numbers of results
5+
- Enable environment-variable authentication
6+
- Fix unauthorized-access infinite loop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<p align=center><img align=center src='axonolotl.png' width=300 /></p>
2+
<h3 align=center>neuvue-client</h3>
3+
<h6 align=center>a python client for neuvuequeue</h6>
4+
5+
# Installation
6+
7+
```shell
8+
pip3 install git+https://github.com/aplbrain/neuvueclient.git
9+
```
10+
11+
# Configuration
12+
13+
Create a configuration file in your home directory `~/.neuvueclient/neuvue-secret.txt` with your Google Oauth token:
14+
15+
```
16+
[CONFIG]
17+
token = <insert token>
18+
```
19+
20+
# Usage
21+
22+
First, create a new neuvuequeue instance:
23+
24+
```python
25+
import neuvueclient as Client
26+
27+
C = Client.NeuvueQueue("http://neuvuequeue-server/")
28+
```
29+
30+
Now you can do all that your corazón desires:
31+
32+
```python
33+
C.get_tasks(sieve={"namespace": "split"})
34+
```
35+
36+
# Implementation Progress
37+
38+
| Object | POST | GET | LIST | DELETE | PATCH |
39+
|----------|------|-----|------|--------|-------|
40+
| Point | ✅ | ✅ | ✅ | ✅ | ⛔
41+
| Task | ✅ | ✅ | ✅ | ✅ | ✅

0 commit comments

Comments
 (0)