-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor deployment scripts and updated README.md
- Loading branch information
1 parent
d88fe67
commit 6c3de47
Showing
5 changed files
with
36 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ tests: | |
|
||
.PHONY: deploy | ||
deploy: clean | ||
./scripts/create_app.sh | ||
./scripts/deploy.sh | ||
|
||
.PHONY: run | ||
|
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 |
---|---|---|
@@ -1,41 +1,51 @@ | ||
# Developpment Workflow | ||
# Development Workflow | ||
|
||
## Local development | ||
|
||
## Local developpment | ||
The workflow described here works from CloudShell or any node with the [gcloud CLI](https://cloud.google.com/sdk/docs/install) has been properly installed and authenticated. | ||
|
||
The workflow described here works from CloudShell or any node with the gcloud SDK authenticated | ||
,that is, you can do the developpement fully locally on your laptop, which is the preferred | ||
development environment. | ||
This means that you can develop your application fully locally on your laptop for example, as long as you have run `make auth` after installing the [gcloud CLI](https://cloud.google.com/sdk/docs/install) on it. | ||
|
||
The first step is to add your `PROJECT` and `BUCKET` names in the following files: | ||
* `./scripts/config.sh` | ||
* `app.yaml` | ||
|
||
For local development, install then the gcloud CLI following [these instructions](https://cloud.google.com/sdk/docs/install). | ||
|
||
Make sure to accept upgrading Python to 3.10 if prompted, then authenticate for local development by running: | ||
|
||
For local development, first install the Google SDK following these instructions(https://cloud.google.com/sdk/docs/install#mac). | ||
Make sure to accept upgrading Python to 3.10 when prompted, then authenticate for local development by running: | ||
```bash | ||
make auth | ||
``` | ||
|
||
Then create and populate the virtual environment: | ||
The second step is to create and populate the virtual environment with | ||
|
||
```bash | ||
make venv | ||
``` | ||
After this step you should find a new folder called `venv` containing the virtual environment. | ||
|
||
To run the tests: | ||
At this point you should already be able to run the tests by running | ||
```bash | ||
make tests | ||
``` | ||
|
||
Run the answernaut locally with | ||
To run the app locally, simply run | ||
```bash | ||
make run | ||
``` | ||
|
||
Deploy on AppEngine | ||
At last to deploy the application on AppEngine run | ||
```bash | ||
make deploy | ||
``` | ||
|
||
## Developpement workflow | ||
**Note:** `make clean` will remove all the built artifacts as long as the virtual environment created by `make venv`. This target is invoked by `make deploy` so that the built artifacts are not uploaded to AppEngine. The down-side is that the virtual environment will need to be recreated after each deployment. | ||
|
||
## Development workflow | ||
|
||
1. Edit the code | ||
1. Run the tests with `make tests` | ||
1. Test the app local with `make run` | ||
1. Deploy the app on AppEngine with `make deploy` | ||
|
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
runtime: python310 | ||
entrypoint: gunicorn -b :$PORT asl.server:app | ||
entrypoint: gunicorn -b :$PORT app.server:app | ||
|
||
runtime_config: | ||
operating_system: "ubuntu22" | ||
|
||
env_variables: | ||
BUCKET: "dherin-dev" | ||
BUCKET: "<YOUR_BUCKET>" | ||
LOCATION: "us-central1" | ||
PROJECT: "dherin-dev" | ||
PROJECT: "<YOUR_PROJECT>" |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
. $(cd $(dirname $BASH_SOURCE) && pwd)/config.sh | ||
|
||
gcloud app describe --project=$PROJECT 2> /dev/null || { | ||
echo "No App on AppEngine existing. Creating one." | ||
gcloud app create --region=$LOCATION --project=$PROJECT | ||
} |