Skip to content

Commit

Permalink
updated docs; added proper requirements to setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
DataGreed committed Jun 22, 2020
1 parent 3e0043f commit ad04360
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 11 deletions.
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,25 @@ to supply different setting files for Web and Worker environments. See also: [do

### Accessing Web Tier Database from Worker

`#TODO`
You will probably want your worker environment to have access to the same database as your web tier environment.

Assuming you have a web tier environment and a worker environment with the same Django apps deployed
(if you don't have a worker environment, yet, you can create it using `eb create -t worker <environment name>`)
and the web tier environment has an
[attached database](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.managing.db.html)
set up via Elastic Beanstalk with database connection settings populated from environmantal variables,
do the following:

1. Open Elastic Beanstalk Web Console
2. Navigate to your Web Tier environment > Configuration > Database
3. Copy database connection settings. Note that the database password will not be shown here. If you don't remember it,
you can connect to the Web environment using `eb ssh` and getting it using `cat /opt/python/current/env`
4. Navigate to your Worker environment > Configuration > Software > Edit
5. Add environmental variables for DB connection that you've copied (`RDS_PORT`,`RDS_PASSWORD`,`RDS_USERNAME`,
`RDS_DB_NAME`, `RDS_HOSTNAME`) and hit "Apply"
6. Navigate to your Worker environment > Configuration > Instances > Edit
7. Add security group corresponding to your Web Tier environment and hit "Apply", confirm changes.
8. Re-deploy the application using `eb deploy` to make sure that everything works as expected.

### Delay abstraction

Expand Down
18 changes: 9 additions & 9 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
boto3>=1.10.28
botocore==1.17.5
Django==2.2
docutils==0.15.2
jmespath==0.10.0
python-dateutil==2.8.1
pytz==2020.1
s3transfer==0.3.3
six==1.15.0
urllib3==1.25.9
botocore>=1.17.5
Django>=2.2
docutils>=0.15.2
jmespath>=0.10.0
python-dateutil>=2.8.1
pytz>=2020.1
s3transfer>=0.3.3
six>=1.15.0
urllib3>=1.25.9
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
with open("README.md", "r") as fh:
long_description = fh.read()

with open('requirements.txt') as fp:
install_requires = fp.read()

setuptools.setup(
name="django-eb-sqs-worker", # Replace with your own username
version="0.1.0",
version="0.2.1",
author="Alexey Strelkov",
author_email="[email protected]",
description="Django Background Tasks for Amazon Elastic Beanstalk",
Expand All @@ -19,4 +22,5 @@
"Operating System :: OS Independent",
],
python_requires='>=3.6',
install_requires=install_requires,
)

0 comments on commit ad04360

Please sign in to comment.