Skip to content

Commit

Permalink
Add task and doc on deployment
Browse files Browse the repository at this point in the history
After much trial and error, I was able to deploy to Elastic Beanstalk
(EB). Initially, I was running into an issue where when I deployed, EB
wasn't able to find the entry-point application, even if I used eb
configure to set the WSGIPath variable. The reason for this (I think) is
that even if you set WSGIPath to some.module.somewhere.app, EB still
needs to know what the name of the Flask app variable is. (The tutorial
has you make the entry-point application runnable, so I'm not sure why
it would need to know the name of the Flask app variable, but alas.)

The solution I arrived at was to create a Procfile that specifies the
module and the Flask app name.

For:
#8
  • Loading branch information
liammulh committed Mar 25, 2024
1 parent 73778cf commit 780470f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ For all other command line tasks, the affils project uses [Invoke](https://docs.
5. Run the development server: `invoke dev` or `inv dev`.
6. Read the `tasks.py` module for other command line tasks.
7. Read the [standards document](./doc/standards.md).

## Deployment

Read the [doc](./doc/deploy.md) on deploying to production.
19 changes: 19 additions & 0 deletions doc/deploy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Deploying affils

The affils service is deployed to AWS's Elastic Beanstalk service. If
you use your Stanford credentials to log in to AWS, choose the
production profile, and set your region to Oregon (us-west-2), and then
you navigate to the Elastic Beanstalk console, you should see an Elastic
Beanstalk environment called `affils-env`. The `affils-env` environment
contains the `affils` application. If you click the `affils`
application, you should be able to view information about the affils
service.

To deploy the files from your computer, enter the following:

```
inv deploy
```

This command should upload the affils files from your computer to AWS's
Elastic Beanstalk service.
11 changes: 11 additions & 0 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,14 @@ def dev(c):
Assumes you've activated the virtual environment.
"""
c.run("cd src && flask run")


@task
def deploy(c):
"""Deploy the affils service.
Assumes you have the Elastic Beanstalk CLI tool, eb. Also assumes
you have AWS configured properly. You should set Oregon (us-west-2)
as your AWS region, and you should have AWS production credentials.
"""
c.run("eb deploy")

0 comments on commit 780470f

Please sign in to comment.