This repository has been archived by the owner on Mar 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
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 #475 from alphagov/paas-migration
Paas migration
- Loading branch information
Showing
36 changed files
with
296 additions
and
116 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 |
---|---|---|
|
@@ -18,3 +18,4 @@ tmp/* | |
|
||
# vim swap files | ||
.*.swp | ||
venv/ |
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 @@ | ||
2.7.13 |
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
Empty file.
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,24 @@ | ||
import os | ||
import json | ||
from base64 import b64decode | ||
|
||
|
||
def load_paas_settings(): | ||
paas = {} | ||
if 'VCAP_SERVICES' in os.environ: | ||
vcap = json.loads(os.environ['VCAP_SERVICES']) | ||
if 'mongodb' in vcap: | ||
for service in vcap['mongodb']: | ||
if service['name'] == 'gds-performance-platform-mongodb-service': | ||
credentials = service['credentials'] | ||
paas['DATABASE_URL'] = credentials['uri'] | ||
ca_cert = b64decode(credentials['ca_certificate_base64']) | ||
paas['CA_CERTIFICATE'] = ca_cert | ||
if 'REDIS_DATABASE_NUMBER' in os.environ: | ||
for service in vcap['user-provided']: | ||
if service['name'] == 'redis-poc': | ||
database_number = os.environ['REDIS_DATABASE_NUMBER'] | ||
url = service['credentials']['url'] | ||
url += '/' + database_number | ||
paas['REDIS_URL'] = url | ||
return paas |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import os | ||
from ...core.config.common import load_paas_settings | ||
|
||
PAAS = load_paas_settings() | ||
DATABASE_URL = PAAS.get('DATABASE_URL') | ||
CA_CERTIFICATE = PAAS.get('CA_CERTIFICATE') | ||
STAGECRAFT_URL = os.getenv('STAGECRAFT_URL') | ||
SIGNON_API_USER_TOKEN = os.getenv('SIGNON_API_USER_TOKEN') | ||
LOG_LEVEL = "INFO" | ||
SESSION_COOKIE_SECURE = True |
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,10 @@ | ||
import os | ||
from ...core.config.common import load_paas_settings | ||
|
||
PAAS = load_paas_settings() | ||
DATABASE_URL = PAAS.get('DATABASE_URL') | ||
CA_CERTIFICATE = PAAS.get('CA_CERTIFICATE') | ||
STAGECRAFT_URL = os.getenv('STAGECRAFT_URL') | ||
SIGNON_API_USER_TOKEN = os.getenv('SIGNON_API_USER_TOKEN') | ||
LOG_LEVEL = "INFO" | ||
SESSION_COOKIE_SECURE = True |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import os | ||
from ...core.config.common import load_paas_settings | ||
|
||
PAAS = load_paas_settings() | ||
BROKER_URL = PAAS.get('REDIS_URL') or os.getenv('REDIS_URL') | ||
BROKER_FAILOVER_STRATEGY = "round-robin" | ||
STAGECRAFT_URL = 'https://performance-platform-stagecraft-production.cloudapps.digital' | ||
STAGECRAFT_OAUTH_TOKEN = os.getenv('STAGECRAFT_OAUTH_TOKEN') | ||
BACKDROP_READ_URL = 'https://performance-platform-backdrop-read-production.cloudapps.digital/data' | ||
BACKDROP_WRITE_URL = 'https://performance-platform-backdrop-write-production.cloudapps.digital/data' |
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,10 @@ | ||
import os | ||
from ...core.config.common import load_paas_settings | ||
|
||
PAAS = load_paas_settings() | ||
BROKER_URL = PAAS.get('REDIS_URL') or os.getenv('REDIS_URL') | ||
BROKER_FAILOVER_STRATEGY = "round-robin" | ||
STAGECRAFT_URL = 'https://performance-platform-stagecraft-staging.cloudapps.digital' | ||
STAGECRAFT_OAUTH_TOKEN = os.getenv('STAGECRAFT_OAUTH_TOKEN') | ||
BACKDROP_READ_URL = 'https://performance-platform-backdrop-read-staging.cloudapps.digital/data' | ||
BACKDROP_WRITE_URL = 'https://performance-platform-backdrop-write-staging.cloudapps.digital/data' |
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.