Skip to content

Commit a1a29b6

Browse files
author
David McKay
committed
Cleanup Env Documentation
There were some conflicting configuration details, namely .env_sample, and sendgrid.env. I've opted for .env_sample, as sendgrid.env actually seemed to be incorrect.
1 parent 33a3576 commit a1a29b6

File tree

6 files changed

+79
-21
lines changed

6 files changed

+79
-21
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,5 @@ README.txt
2020
coverage.xml
2121
htmlcov
2222
temp*.py
23-
sendgrid.env
2423
.vscode
2524

CONTRIBUTING.md

+11-4
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ We welcome direct contributions to the sendgrid-python code base. Thank you!
6262
### Development Environment ###
6363
#### There are two ways to get set up: ####
6464
#### 1. Using Docker ####
65-
This is usually the easiest and fastest way to get set up.
65+
This is usually the easiest and fastest way to get set up.
6666
You can use our Docker image to avoid setting up the development environment yourself. See [USAGE.md](https://github.com/sendgrid/sendgrid-python/blob/master/docker/USAGE.md).
6767

6868
#### - OR - ####
@@ -87,9 +87,14 @@ First, get your free SendGrid account [here](https://sendgrid.com/free?source=se
8787
Next, update your environment with your [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys).
8888

8989
```bash
90-
echo "export SENDGRID_API_KEY='YOUR_API_KEY'" > sendgrid.env
91-
echo "sendgrid.env" >> .gitignore
92-
source ./sendgrid.env
90+
cp .env_sample .env
91+
```
92+
93+
Then edit `.env` and insert your API key.
94+
95+
```bash
96+
# You do not need to do this when using Docker Compose
97+
source .env
9398
```
9499

95100
##### Execute: #####
@@ -184,8 +189,10 @@ Please run your code through:
184189
```bash
185190
# Clone your fork of the repo into the current directory
186191
git clone https://github.com/sendgrid/sendgrid-python
192+
187193
# Navigate to the newly cloned directory
188194
cd sendgrid-python
195+
189196
# Assign the original repo to a remote called "upstream"
190197
git remote add upstream https://github.com/sendgrid/sendgrid-python
191198
```

README.md

+1-5
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ We appreciate your continued support, thank you!
4949

5050
Update the development environment with your [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys), for example:
5151

52-
```bash
53-
echo "export SENDGRID_API_KEY='YOUR_API_KEY'" > sendgrid.env
54-
echo "sendgrid.env" >> .gitignore
55-
source ./sendgrid.env
56-
```
52+
SendGrid also supports local environment file `.env`. Copy or rename `.env_sample` into `.env` and update [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys) with your key.
5753

5854
Sendgrid also supports local environment file `.env`. Copy or rename `.env_sample` into `.env` and update [SENDGRID_API_KEY](https://app.sendgrid.com/settings/api_keys) with your key.
5955

docker/USAGE.md

+57
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,63 @@ $ docker run -it -v /path/to/cool-sendgrid-python:/mnt/sendgrid-python sendgrid/
7070

7171
Note that the paths you specify in `-v` must be absolute.
7272

73+
# Docker Compose
74+
75+
<a name="Quickstart"></a>
76+
# Quickstart
77+
78+
1. Install docker-compose on your machine.
79+
2. Must copy .env_sample to .env file.
80+
3. Edit .env file for yours versions and paths.
81+
4. Must create env folder for clone yours repo.
82+
5. Have fun! :D
83+
84+
## Using tag's for versions - DockerHub:
85+
86+
### Edit variable TAG on .env/env_sample file
87+
88+
```sh-session
89+
$ sed -ie 's/TAG=latest/TAG=choice_a_version/g'
90+
```
91+
### Run service using tags
92+
93+
```sh-session
94+
$ cd /path/to/sendgrid-python/docker
95+
$ docker-compose up -d sendgrid
96+
```
97+
98+
## Specifying specific versions:
99+
100+
### Edit variable TAG on .env/env_sample file
101+
102+
```sh-session
103+
$ sed -ie 's/SENDGRID_PYTHON_VERSION=vy.x.z/SENDGRID_PYTHON_VERSION=vx.y.z/g'
104+
$ sed -ie 's/HTTP_CLIENT_VERSION=vy.x.z/HTTP_CLIENT_VERSION=vx.y.z/g'
105+
```
106+
107+
### Run service
108+
109+
```sh-session
110+
$ cd /path/to/sendgrid-python/docker
111+
$ docker-compose up -d sendgrid-dev
112+
```
113+
114+
## Specifying your own fork:
115+
116+
### Edit variable TAG on .env/env_sample file
117+
118+
```sh-session
119+
$ sed -ie 's/TAG=latest/TAG=choice_a_version/g'
120+
$ sed -ie 's/SENDGRID_PYTHON_VERSION=vy.x.z/SENDGRID_PYTHON_VERSION=vx.y.z/g'
121+
```
122+
123+
### Run service
124+
125+
```sh-session
126+
$ cd /path/to/sendgrid-python/docker
127+
$ docker-compose up -d sendgrid-beta
128+
```
129+
73130
<a name="Testing"></a>
74131
# Testing
75132
Testing is easy! Run the container, `cd sendgrid`, and run `tox`.

sendgrid.env

-1
This file was deleted.

use_cases/aws.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ Before starting this tutorial, you will need to have access to an AWS account in
1919
## Getting Started
2020

2121
### Create AWS CodeStar Project
22-
Log in to your AWS account and go to the AWS CodeStar service. Click "Start a project". For this tutorial we're going to choose a Python Web service, utilizing AWS Lambda. You can use the filters on the left hand side of the UI to narrow down the available choices.
22+
Log in to your AWS account and go to the AWS CodeStar service. Click "Start a project". For this tutorial we're going to choose a Python Web service, utilizing AWS Lambda. You can use the filters on the left hand side of the UI to narrow down the available choices.
2323

24-
After you've selected the template, you're asked to provide a name for your project. Go ahead and name it "hello-email". Once you've entered a name, click "Create Project" in the lower right hand corner. You can then choose which tools you want to use to interact with the project. For this tutorial, we'll be choosing "Command Line".
24+
After you've selected the template, you're asked to provide a name for your project. Go ahead and name it "hello-email". Once you've entered a name, click "Create Project" in the lower right hand corner. You can then choose which tools you want to use to interact with the project. For this tutorial, we'll be choosing "Command Line".
2525

26-
Once that is completed, you'll be given some basic steps to get Git installed and setup, and instructions for connecting to the AWS CodeCommit(git) repository. You can either use HTTPS, or SSH. Instructions for setting up either are provided.
26+
Once that is completed, you'll be given some basic steps to get Git installed and setup, and instructions for connecting to the AWS CodeCommit(git) repository. You can either use HTTPS, or SSH. Instructions for setting up either are provided.
2727

2828
Go ahead and clone the Git repository link after it is created. You may need to click "Skip" in the lower right hand corner to proceed.
2929

30-
Once that's done, you've successfully created a CodeStar project! You should be at the dashboard, with a view of the wiki, change log, build pipeline, and application endpoint.
30+
Once that's done, you've successfully created a CodeStar project! You should be at the dashboard, with a view of the wiki, change log, build pipeline, and application endpoint.
3131

3232
### Create SendGrid API Key
3333
Log in to your SendGrid account. Click on your user name on the left hand side of the UI and choose "Setup Guide" from the drop-down menu. On the "Welcome" menu, choose "Send Your First Email", and then "Integrate using our Web API or SMTP relay." Choose "Web API" as the recommended option on the next screen, as we'll be using that for this tutorial. For more information about creating API keys, see https://sendgrid.com/docs/Classroom/Send/How_Emails_Are_Sent/api_keys.html
@@ -44,7 +44,7 @@ For the rest of the tutorial, we'll be working out of the git repository we clon
4444
```
4545
$ cd hello-email
4646
```
47-
note: this assumes you cloned the git repo inside your current directory. My directory is:
47+
note: this assumes you cloned the Git repo inside your current directory. My directory is:
4848

4949
```
5050
~/projects/hello-email
@@ -100,7 +100,7 @@ virtualenv venv
100100
source ./venv/bin/activate
101101
```
102102

103-
Prior to being able to deploy our Python code, we'll need to install the sendgrid Python module *locally*. One of the idiosyncracies of AWS Lambda is that all library and module dependencies that aren't part of the standard library have to be included with the code/build artifact. Virtual environments do not translate to the Lambda runtime environment.
103+
Prior to being able to deploy our Python code, we'll need to install the sendgrid Python module *locally*. One of the idiosyncracies of AWS Lambda is that all library and module dependencies that aren't part of the standard library have to be included with the code/build artifact. Virtual environments do not translate to the Lambda runtime environment.
104104

105105
In the root project directory, run the following command:
106106
```
@@ -157,16 +157,16 @@ $ git commit -m 'hello-email app'
157157
$ git push
158158
```
159159

160-
Once the code is successfully pushed, head back to the AWS CodeStar dashboard for your project. After your commit successfully registers, an automated build and deployment process should kick off.
160+
Once the code is successfully pushed, head back to the AWS CodeStar dashboard for your project. After your commit successfully registers, an automated build and deployment process should kick off.
161161

162162
One more step left before our application will work correctly. After your code has bee deployed, head to the AWS Lambda console. Click on your function name, which should start with `awscodestar-hello-email-lambda-`, or similar.
163163

164-
Scroll down to the "Environment Variables" section. Here we need to populate our SendGrid API key. Copy the value from the `sendgrid.env` file you created earlier, ensuring to capture the entire value. Make sure the key is titled:
164+
Scroll down to the "Environment Variables" section. Here we need to populate our SendGrid API key. Copy the value from the `.env` file you created earlier, ensuring to capture the entire value. Make sure the key is titled:
165165

166166
```
167167
SENDGRID_API_KEY
168168
```
169169

170-
Now, go back to your project dashboard in CodeStar. Click on the link under "Application endpoints". After a moment, you should be greeted with JSON output indicating an email was successfully sent.
170+
Now, go back to your project dashboard in CodeStar. Click on the link under "Application endpoints". After a moment, you should be greeted with JSON output indicating an email was successfully sent.
171171

172-
Congratulations, you've just used serverless technology to create an email sending app in AWS!
172+
Congratulations, you've just used serverless technology to create an email sending app in AWS!

0 commit comments

Comments
 (0)