-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up Makefile #1055
Merged
Merged
Clean up Makefile #1055
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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 |
---|---|---|
|
@@ -10,7 +10,6 @@ help: ## Show this help | |
|
||
SERVICE_SHORT=faltrn | ||
|
||
|
||
.PHONY: aks | ||
aks: ## Sets environment variables for aks deployment | ||
$(eval PLATFORM=aks) | ||
|
@@ -80,50 +79,6 @@ install-fetch-config: ## Install the fetch-config script, for viewing/editing se | |
&& chmod +x bin/fetch_config.rb \ | ||
|| true | ||
|
||
edit-keyvault-secret: read-keyvault-config install-fetch-config set-azure-account | ||
bin/fetch_config.rb -s azure-key-vault-secret:${KEY_VAULT_NAME}/${KEY_VAULT_SECRET_NAME} \ | ||
-e -d azure-key-vault-secret:${KEY_VAULT_NAME}/${KEY_VAULT_SECRET_NAME} -f yaml -c | ||
|
||
print-keyvault-secret: read-keyvault-config install-fetch-config set-azure-account | ||
bin/fetch_config.rb -s azure-key-vault-secret:${KEY_VAULT_NAME}/${KEY_VAULT_SECRET_NAME} -f yaml | ||
|
||
validate-keyvault-secret: read-keyvault-config install-fetch-config set-azure-account | ||
bin/fetch_config.rb -s azure-key-vault-secret:${KEY_VAULT_NAME}/${KEY_VAULT_SECRET_NAME} -d quiet \ | ||
&& echo Data in ${KEY_VAULT_NAME}/${KEY_VAULT_SECRET_NAME} looks valid | ||
|
||
.PHONY: set-space-developer | ||
set-space-developer: read-deployment-config ## make dev set-space-developer [email protected] | ||
$(if $(USER_ID), , $(error Missing environment variable "USER_ID", USER_ID required for this command to run)) | ||
cf set-space-role ${USER_ID} dfe ${SPACE} SpaceDeveloper | ||
|
||
.PHONY: unset-space-developer | ||
unset-space-developer: read-deployment-config ## make dev unset-space-developer [email protected] | ||
$(if $(USER_ID), , $(error Missing environment variable "USER_ID", USER_ID required for this command to run)) | ||
cf unset-space-role ${USER_ID} dfe ${SPACE} SpaceDeveloper | ||
|
||
stop-app: read-deployment-config ## Stops api app, make dev stop-app CONFIRM_STOP=1 | ||
$(if $(CONFIRM_STOP), , $(error stop-app can only run with CONFIRM_STOP)) | ||
cf target -s ${SPACE} | ||
cf stop ${FLT_APP_NAME} | ||
|
||
get-postgres-instance-guid: read-deployment-config ## Gets the postgres service instance's guid | ||
cf target -s ${SPACE} > /dev/null | ||
cf service ${POSTGRES_DATABASE_NAME} --guid | ||
$(eval DB_INSTANCE_GUID=$(shell cf service ${POSTGRES_DATABASE_NAME} --guid)) | ||
|
||
rename-postgres-service: read-deployment-config ## make dev rename-postgres-service NEW_NAME_SUFFIX=old CONFIRM_RENAME | ||
$(if $(CONFIRM_RENAME), , $(error can only run with CONFIRM_RENAME)) | ||
$(if $(NEW_NAME_SUFFIX), , $(error NEW_NAME_SUFFIX is required)) | ||
cf target -s ${SPACE} > /dev/null | ||
cf rename-service ${POSTGRES_DATABASE_NAME} ${POSTGRES_DATABASE_NAME}-$(NEW_NAME_SUFFIX) | ||
|
||
restore-data-from-backup: read-deployment-config # make production restore-data-from-backup CONFIRM_RESTORE=YES BACKUP_FILENAME="find-a-lost-trn-production-pg-svc-2022-04-28-01" | ||
@if [[ "$(CONFIRM_RESTORE)" != YES ]]; then echo "Please enter "CONFIRM_RESTORE=YES" to run workflow"; exit 1; fi | ||
$(eval export AZURE_BACKUP_STORAGE_ACCOUNT_NAME=$(AZURE_BACKUP_STORAGE_ACCOUNT_NAME)) | ||
$(if $(BACKUP_FILENAME), , $(error can only run with BACKUP_FILENAME, eg BACKUP_FILENAME="find-a-lost-trn-production-pg-svc-2022-04-28-01")) | ||
bin/download-db-backup ${AZURE_BACKUP_STORAGE_ACCOUNT_NAME} ${AZURE_BACKUP_STORAGE_CONTAINER_NAME} ${BACKUP_FILENAME}.tar.gz | ||
bin/restore-db ${DEPLOY_ENV} ${CONFIRM_RESTORE} ${SPACE} ${BACKUP_FILENAME}.sql ${POSTGRES_DATABASE_NAME} | ||
|
||
terraform-init: bin/terrafile | ||
[[ "${SP_AUTH}" != "true" ]] && az account set -s $(AZURE_SUBSCRIPTION) || true | ||
./bin/terrafile -p terraform/aks/vendor/modules -f terraform/aks/workspace_variables/$(CONFIG)_Terrafile | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -34,57 +34,9 @@ tail -f /app/log/production.log | |
|
||
## Updating environment variables | ||
|
||
Make sure you have the `az` command line tool: | ||
The app keyvaults for Find can be found in the Azure devops portal. The development one, for example, is found [here](https://portal.azure.com/#@platform.education.gov.uk/resource/subscriptions/20da9d12-7ee1-42bb-b969-3fe9112964a7/resourceGroups/s189t01-faltrn-dv-rg/providers/Microsoft.KeyVault/vaults/s189t01-faltrn-dv-app-kv/secrets). | ||
|
||
```bash | ||
asdf plugin add azure-cli | ||
|
||
asdf install | ||
``` | ||
|
||
Login to Azure and make sure it gets the right subscriptions: | ||
|
||
```bash | ||
$ az login | ||
A web browser has been opened at https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize. Please continue the login in the web browser. If no | ||
web browser is available or if the web browser fails to open, use device code | ||
flow with `az login --use-device-code`. | ||
The following tenants don't contain accessible subscriptions. Use 'az login --allow-no-subscriptions' to have tenant level access. | ||
xxxxxxxx-yyyy-zzzz-xxxx-yyyyyyyyyyyy 'digital.education.gov.uk' | ||
[ | ||
{ | ||
"cloudName": "AzureCloud", | ||
"homeTenantId": "xxxxxxxx-yyyy-zzzz-xxxx-yyyyyyyyyyyy", | ||
"id": "xxxxxxxx-yyyy-zzzz-xxxx-yyyyyyyyyyyy", | ||
"isDefault": true, | ||
"managedByTenants": [ | ||
{ | ||
"tenantId": "xxxxxxxx-yyyy-zzzz-xxxx-yyyyyyyyyyyy" | ||
} | ||
], | ||
"name": "s189-teacher-services-cloud-test", | ||
"state": "Enabled", | ||
"tenantId": "xxxxxxxx-yyyy-zzzz-xxxx-yyyyyyyyyyyy", | ||
"user": { | ||
"name": "[email protected]", | ||
"type": "user" | ||
} | ||
}, | ||
... | ||
] | ||
``` | ||
|
||
To view all environment variables on the `dev` environment: | ||
|
||
```bash | ||
make dev print-keyvault-secret | ||
``` | ||
|
||
To edit environment variables on the `dev` environment (opens `$EDITOR`): | ||
|
||
```bash | ||
make dev edit-keyvault-secret | ||
``` | ||
Assuming you have the correct permissions, the environment variables can be edited via the portal UI. Check with the infrastructure team if you don't have access. | ||
|
||
## Logit | ||
|
||
|
Oops, something went wrong.
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.
Not 100% sure about this one - ok to delete?
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.
100% yes
We will create a new solution for DR soon