-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #877 from GSA/main
API Production Deploy - 3/28/2024
- Loading branch information
Showing
264 changed files
with
685 additions
and
378 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,7 @@ You will need the following items: | |
This project currently works with these major versions of the following main | ||
components: | ||
|
||
- Python 3.9.x | ||
- Python 3.12.x | ||
- PostgreSQL 15.x (version 12.x is used in the hosted environments) | ||
|
||
These instructions will walk you through how to set your machine up with all of | ||
|
@@ -175,12 +175,12 @@ session to make the changes take effect. | |
Now we're ready to install the Python version we need with `pyenv`, like so: | ||
|
||
```sh | ||
pyenv install 3.9 | ||
pyenv install 3.12 | ||
``` | ||
|
||
This will install the latest version of Python 3.9. | ||
This will install the latest version of Python 3.12. | ||
|
||
_NOTE: This project currently runs on Python 3.9.x._ | ||
_NOTE: This project currently runs on Python 3.12.x._ | ||
|
||
#### Python Dependency Installation | ||
|
||
|
@@ -253,20 +253,20 @@ Once all of pre-requisites for the project are installed and you have a | |
cloud.gov account, you can now set up the API project and get things running | ||
locally! | ||
|
||
First, clone the respository in the directory of your choosing on your machine: | ||
First, clone the repository in the directory of your choosing on your machine: | ||
|
||
```sh | ||
git clone [email protected]:GSA/notifications-api.git | ||
``` | ||
|
||
Now go into the project directory (`notifications-api` by default), create a | ||
virtual environment, and set the local Python version to point to the virtual | ||
environment (assumes version Python `3.9.18` is what is installed on your | ||
environment (assumes version Python `3.12.2` is what is installed on your | ||
machine): | ||
|
||
```sh | ||
cd notifications-api | ||
pyenv virtualenv 3.9.18 notify-api | ||
pyenv virtualenv 3.12.2 notify-api | ||
pyenv local notify-api | ||
``` | ||
|
||
|
@@ -278,6 +278,9 @@ in the command line by using this command: | |
```sh | ||
cf login -a api.fr.cloud.gov --sso | ||
``` | ||
If you are offered a choice of orgs, select `gsa-tts-benefits-studio`. | ||
For the space, choose `notify-local-dev` to start with (assuming you are | ||
setting up local development). | ||
|
||
_REMINDER: Ensure you have access to the `notify-local-dev` and `notify-staging` spaces in cloud.gov_ | ||
|
||
|
@@ -289,9 +292,12 @@ cd terraform/development | |
./run.sh | ||
``` | ||
|
||
In addition to some infrastructure setup, this will also create a local `.env` | ||
file for you in the project's root directory, which will include a handful of | ||
project-specific environment variables. | ||
If this runs correctly, Terraform will ask you if you want to create some | ||
resources. Answer `yes`. | ||
|
||
The script will also create a local `.env` file for you in the project's | ||
root directory, which will include a handful of project-specific environment | ||
variables. | ||
|
||
Lastly, if you didn't already start PostgreSQL and Redis above, be sure to do | ||
so now: | ||
|
@@ -301,6 +307,40 @@ brew services start postgresql@15 | |
brew services start redis | ||
``` | ||
|
||
#### Upgrading Python in existing projects | ||
|
||
If you're upgrading an existing project to a newer version of Python, you can | ||
follow these steps to get yourself up-to-date. | ||
|
||
First, use `pyenv` to install the newer version of Python you'd like to use; | ||
we'll use `3.12` in our example here since we recently upgraded to this version: | ||
|
||
```sh | ||
pyenv install 3.12 | ||
``` | ||
|
||
Next, delete the virtual environment you previously had set up. If you followed | ||
the instructions above with the first-time set up, you can do this with `pyenv`: | ||
|
||
```sh | ||
pyenv virtualenv-delete notify-api | ||
``` | ||
|
||
Now, make sure you are in your project directory and recreate the same virtual | ||
environment with the newer version of Python you just installed: | ||
|
||
```sh | ||
cd notifications-api | ||
pyenv virtualenv 3.12.2 notify-api | ||
pyenv local notify-api | ||
``` | ||
|
||
At this point, proceed with the rest of the instructions here in the README and | ||
you'll be set with an upgraded version of Python. | ||
|
||
_If you're not sure about the details of your current virtual environment, you can run `poetry env info` to get more information. If you've been using `pyenv` for everything, you can also see all available virtual environments with `pyenv virtualenvs`._ | ||
|
||
|
||
### Final environment setup | ||
|
||
There's one final thing to adjust in the newly created `.env` file. This | ||
|
@@ -351,6 +391,9 @@ Now you can run the web server and background workers for asynchronous jobs: | |
make run-procfile | ||
``` | ||
|
||
If it runs correctly, you will be able to visit http://127.0.0.1:6011/ and see | ||
JSON from the API in your web browser. | ||
|
||
This will run all of the services within the same shell session. If you need to | ||
run them separately to help with debugging or tracing logs, you can do so by | ||
opening three sepearate shell sessions and running one of these commands in each | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.