-
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 #17 from fecgov/feature/40-test-cloud-gov
Deploy to cloud.gov
- Loading branch information
Showing
25 changed files
with
436 additions
and
272 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Database creation script | ||
db | ||
|
||
# git secrets config | ||
install-git-secrets-hook.sh |
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,19 +1,29 @@ | ||
# CircleCI Configuration | ||
## Environment Variables | ||
When configuring CircleCI, you will need to set environment varaialbes the database | ||
When configuring CircleCI, you will need to set environment variables the database | ||
configuration as follows: | ||
``` | ||
FECFILE_DB_HOST=localhost | ||
FECFILE_DB_USERNAME=postgres | ||
FECFILE_DB_PASSWORD=postgres | ||
FECFILE_DB_NAME=postgres | ||
DATABASE_URL = "postgres://postgres:[email protected]/postgres" | ||
FECFILE_TEST_DB_NAME = "postgres" | ||
FECFILE_FEC_WEBSITE_API_KEY= | ||
``` | ||
Notes: | ||
* There is no default FECFILE_FEC_WEBSITE_API_KEY, you must obtain and set this yourself | ||
* The FECFILE_DB_HOST value here is different than what you need for your local docker-compose configuration. | ||
|
||
# Using CircleCI local CLI | ||
CircleCI will attempt to deploy commits made to specific branches: | ||
* branch __develop__ -> cloud.gov dev space | ||
* branch __release__* (any branch starting with release) -> cloud.gov staging space | ||
* branch __prod__ -> cloud.gov prod space | ||
|
||
Authentication must be configured in a set of evironment variables: | ||
* $FEC_CF_USERNAME_DEV | ||
* $FEC_CF_PASSWORD_DEV | ||
* $FEC_CF_USERNAME_STAGE | ||
* $FEC_CF_PASSWORD_STAGE | ||
* $FEC_CF_USERNAME_PROD | ||
* $FEC_CF_PASSWORD_PROD | ||
|
||
# Using CircleCI local CLI | ||
|
||
## Install circleci local | ||
Install on Linux or Mac with: | ||
|
@@ -30,23 +40,21 @@ circleci config validate | |
``` | ||
|
||
## Run the CircleCI Job locally | ||
You can run a CircleCI job locally and avoid the change/commit/wait loop you need to | ||
do if you want to actually run the changes on Circle. | ||
You can run a CircleCI job locally and avoid the change/commit/wait loop you need to | ||
do if you want to actually run the changes on Circle. | ||
This can save a lot of time when trying to debug an issue in CI. | ||
``` | ||
circleci local execute --job JOB_NAME | ||
``` | ||
|
||
## Necessary Environment Variables | ||
The Django backend expects to find the database login info in the environment. | ||
The Django backend expects to find the database login info in the environment. | ||
To run in the local CircleCI for the django unit tests (for example), use the following: | ||
|
||
``` | ||
circleci local execute -e FECFILE_DB_HOST=localhost \ | ||
-e FECFILE_DB_USERNAME=postgres \ | ||
-e FECFILE_DB_PASSWORD=postgres \ | ||
-e FECFILE_DB_NAME=postgres \ | ||
-e FECFILE_FEC_WEBSITE_API_KEY=${FECFILE_FEC_WEBSITE_API_KEY}\ | ||
circleci local execute -e DATABASE_URL=${DATABASE_URL} \ | ||
-e FECFILE_FEC_WEBSITE_API_KEY=${FECFILE_FEC_WEBSITE_API_KEY} \ | ||
-e FECFILE_TEST_DB_NAME=${FECFILE_TEST_DB_NAME} \ | ||
--job unit-test | ||
``` | ||
|
||
|
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 |
---|---|---|
|
@@ -67,3 +67,6 @@ testem.log | |
Thumbs.db | ||
.vscode/settings.json | ||
front-end/.vscode/launch.json | ||
|
||
# cloud foundry | ||
.cfmeta |
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 @@ | ||
web: bin/run.sh |
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 |
---|---|---|
|
@@ -30,11 +30,9 @@ When running docker-compose you will need to be in the root directory of the pro | |
You should set the following environment variables in the shell where you are running 'docker-compose up -d'. | ||
Proper values for the development variables are shown here as an example | ||
``` | ||
export FECFILE_DB_HOST=db | ||
export FECFILE_DB_USERNAME=postgres | ||
export FECFILE_DB_PASSWORD=postgres | ||
export FECFILE_DB_NAME=postgres | ||
export FECFILE_URL=localhost | ||
export DATABASE_URL = "postgres://postgres:[email protected]/postgres" | ||
export FECFILE_TEST_DB_NAME = "postgres" | ||
export DJANGO_SECRET_KEY = "If_using_test_db_use_secret_key_in_cloud.gov" | ||
``` | ||
### Shut down the containers | ||
`docker-compose down` | ||
|
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 @@ | ||
cd django-backend | ||
|
||
# Run migrations | ||
./manage.py makemigrations | ||
./manage.py migrate --noinput | ||
|
||
# Run application | ||
python wait_for_db.py && gunicorn --bind 0.0.0.0:8080 fecfiler.wsgi -w 9 -t 200 --reload |
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.