This repository has been archived by the owner on May 5, 2023. It is now read-only.
Add documentation for cloudify #381
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
37312a8
Add documentation for cloudify.
wangxf123456 7b9919f
Fix
wangxf123456 fdd5ab4
Merge remote-tracking branch 'origin/master' into cloudify-doc
wangxf123456 e8c655e
Fix typo
wangxf123456 1dcde3c
Merge branch 'cloudify-doc' of github.com:GoogleCloudPlatform/django-…
wangxf123456 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,171 @@ | ||
# Deploy an existing Django application | ||
|
||
This guide will walk you through the steps need to deploy an existing | ||
Django application. | ||
|
||
## Before you begin | ||
|
||
Before running this guide, you must install the Cloud SDK, Cloud SQK Proxy. | ||
|
||
1. Download and install the | ||
[Cloud SDK](https://cloud.google.com/sdk/docs/quickstarts) | ||
|
||
2. Download and install the | ||
[Cloud SQL Proxy](https://cloud.google.com/sql/docs/mysql/connect-admin-proxy#install) | ||
|
||
3. Download and install [Docker](https://docs.docker.com/install/overview/) | ||
(any edition) | ||
|
||
4. Prepare your environment for Python development. You have the Python 3.5 or | ||
later, pip and virtualenv installed on your system. For instructions, refer | ||
to the [Python Development Environment Setup Guide](https://cloud.google.com/python/setup). | ||
|
||
5. If you don't already one, you need to create a | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we assume they will accept the ToS by this step? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried to create a new account and go to https://console.cloud.google.com/billing. The TOS automatically pops up after I visit this page. |
||
[Google Cloud Platform billing account](https://console.cloud.google.com/billing). | ||
If you are new to Google Cloud Platform, you may be able to take advantage of | ||
a [free trial](https://cloud.google.com/free/). | ||
|
||
## Types of deployment | ||
|
||
When deploying your Django application, you can choose which Google serving | ||
technology to use: | ||
|
||
### App Engine Standard Environment | ||
|
||
A serverless deployment environment that requires minimal configuration and | ||
no server maintenance | ||
[[learn more]](https://cloud.google.com/appengine/). | ||
|
||
### Google Kubernetes Engine | ||
|
||
A managed container environment that allows extensive customization of the | ||
application's execution environment | ||
[[learn more]](https://cloud.google.com/kubernetes-engine/). | ||
|
||
## Setup Django Deploy | ||
|
||
1. Change directory to your Django application: | ||
|
||
```bash | ||
cd <path/to/your/Django/application> | ||
``` | ||
|
||
#### If you are already using virtual environment for your Django application | ||
|
||
2. Activate your existing virtual environment: | ||
|
||
```bash | ||
source <virtualenv_name>/bin/activate | ||
``` | ||
|
||
3. Install Django Deploy | ||
|
||
```bash | ||
pip install django-cloud-deploy | ||
``` | ||
|
||
#### If you do not use virtual environment for your Django application | ||
|
||
2. Create a new virtual environment to run Django Deploy: | ||
|
||
```bash | ||
virtualenv -p python3 venv | ||
``` | ||
|
||
3. Activate the new virtual environment: | ||
|
||
```bash | ||
source venv/bin/activate | ||
``` | ||
|
||
4. Install Django Deploy | ||
|
||
```bash | ||
pip install django-cloud-deploy | ||
``` | ||
|
||
5. Install dependencies of your Django application: | ||
|
||
```bash | ||
pip install -r <path/to/your/requirements.txt> | ||
``` | ||
|
||
## Deploy your Django application | ||
|
||
1. Start Django Deploy to create and deploy a new Django application. | ||
|
||
When using App Engine: | ||
|
||
```bash | ||
django-cloud-deploy cloudify --backend=gae | ||
``` | ||
|
||
When using Google Kubernetes Engine: | ||
|
||
```bash | ||
django-cloud-deploy cloudify --backend=gke | ||
``` | ||
|
||
After running one of the above commands, you should see: | ||
```bash | ||
12 steps to setup your new project | ||
... | ||
``` | ||
|
||
2. Follow the prompts displayed in the terminal. Make sure that you remember | ||
the following information: | ||
- the database password for the default user | ||
- the username and password for the | ||
[Django admin site](https://docs.djangoproject.com/en/2.2/ref/contrib/admin/) | ||
|
||
3. Once you have answered all of the prompts, your new Django project will be | ||
deployed. | ||
|
||
At the end of the process, you will see: | ||
``` | ||
Your app is running at <url> | ||
``` | ||
|
||
4. Open `<url>` in your browser to see your application running. | ||
|
||
|
||
## Redeploying | ||
|
||
When you are done testing your code locally, you can redeploy to the cloud. | ||
|
||
1. Start Django Deploy to update your application: | ||
|
||
```bash | ||
django-cloud-deploy update | ||
``` | ||
|
||
After running the above commands, you should see: | ||
```bash | ||
3 steps to update your new project | ||
... | ||
``` | ||
|
||
2. Follow the prompts displayed in the terminal. | ||
|
||
3. Once you have answered all of the prompts, your Django project will be | ||
updated. | ||
|
||
At the end of the process, you will see: | ||
``` | ||
Your app is running at <url> | ||
``` | ||
|
||
4. Open `<url>` in your browser to see your updated application running. | ||
|
||
## Clean up | ||
To avoid incurring charges to your GCP account for the resources used in this | ||
guide: | ||
|
||
1. In the GCP Console, go to the | ||
[Projects page](https://console.cloud.google.com/iam-admin/projects). | ||
|
||
2. In the project list, select the project you want to delete and click | ||
**Delete**. | ||
|
||
3. In the dialog, type the project ID, and then click **Shut down** to delete | ||
the 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: SQK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.