Skip to content

Commit

Permalink
Merge branch 'main' into OSDEV-899/move-react-to-s3
Browse files Browse the repository at this point in the history
  • Loading branch information
roninzp authored Dec 18, 2024
2 parents 149d104 + 33985e2 commit b4cdf8f
Show file tree
Hide file tree
Showing 34 changed files with 1,872 additions and 673 deletions.
5 changes: 0 additions & 5 deletions deployment/clear_opensearch/clear_opensearch.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
# new index mappings or to refresh the OpenSearch cluster after
# restarting Logstash, with the lock files deleted from EFS
# storage for each pipeline.
#
# The script can be modified to delete only specific templates,
# indexes, and Logstash pipeline lock files, allowing for a more
# targeted refresh without affecting the entire OpenSearch cluster.
# This can help speed up the deployment process of new changes.

echo -e "\nDelete the custom OpenSearch indexes\n"
curl -X DELETE https://$OPENSEARCH_DOMAIN/production-locations --aws-sigv4 "aws:amz:eu-west-1:es" --user "$AWS_ACCESS_KEY_ID:$AWS_SECRET_ACCESS_KEY"
Expand Down
4 changes: 2 additions & 2 deletions deployment/environments/terraform-development.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ rds_deletion_protection = true
app_ecs_desired_count = "1"
app_ecs_deployment_min_percent = "100"
app_ecs_deployment_max_percent = "400"
app_fargate_cpu = "1024"
app_fargate_memory = "8192"
app_fargate_cpu = "512"
app_fargate_memory = "1024"

app_dd_fargate_cpu = "2048"
app_dd_fargate_memory = "4096"
Expand Down
6 changes: 3 additions & 3 deletions deployment/environments/terraform-preprod.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ bastion_instance_type = "t3.nano"
rds_allocated_storage = "256"
rds_engine_version = "12"
rds_parameter_group_family = "postgres12"
rds_instance_type = "db.m6in.8xlarge"
rds_instance_type = "db.m6in.4xlarge"
rds_database_identifier = "opensupplyhub-enc-pp"
rds_database_name = "opensupplyhub"
rds_multi_az = false
rds_storage_encrypted = true

app_ecs_desired_count = "12"
app_ecs_desired_count = "10"
app_ecs_deployment_min_percent = "100"
app_ecs_deployment_max_percent = "400"
app_fargate_cpu = "2048"
app_fargate_memory = "8192"
app_fargate_memory = "4096"

cli_fargate_cpu = "2048"
cli_fargate_memory = "8192"
Expand Down
6 changes: 3 additions & 3 deletions deployment/environments/terraform-production.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ bastion_instance_type = "t3.nano"
rds_allocated_storage = "256"
rds_engine_version = "12"
rds_parameter_group_family = "postgres12"
rds_instance_type = "db.m6in.8xlarge"
rds_instance_type = "db.m6in.4xlarge"
rds_database_identifier = "opensupplyhub-enc-prd"
rds_database_name = "opensupplyhub"
rds_multi_az = false
rds_storage_encrypted = true

app_ecs_desired_count = "12"
app_ecs_desired_count = "10"
app_ecs_deployment_min_percent = "100"
app_ecs_deployment_max_percent = "400"
app_ecs_grace_period_seconds = "420"
app_fargate_cpu = "2048"
app_fargate_memory = "8192"
app_fargate_memory = "4096"

cli_fargate_cpu = "2048"
cli_fargate_memory = "8192"
Expand Down
2 changes: 1 addition & 1 deletion deployment/environments/terraform-staging.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ app_ecs_desired_count = "4"
app_ecs_deployment_min_percent = "100"
app_ecs_deployment_max_percent = "400"
app_fargate_cpu = "1024"
app_fargate_memory = "8192"
app_fargate_memory = "2048"

cli_fargate_cpu = "1024"
cli_fargate_memory = "8192"
Expand Down
2 changes: 1 addition & 1 deletion deployment/environments/terraform-test.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ app_ecs_desired_count = "2"
app_ecs_deployment_min_percent = "100"
app_ecs_deployment_max_percent = "400"
app_fargate_cpu = "2048"
app_fargate_memory = "8192"
app_fargate_memory = "4096"

app_dd_fargate_cpu = "4096"
app_dd_fargate_memory = "8192"
Expand Down
23 changes: 22 additions & 1 deletion doc/release/RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
#### Scheme changes

### Code/API changes
* [OSDEV-1409](https://opensupplyhub.atlassian.net/browse/OSDEV-1409) - Introduced a new PATCH `/api/v1/moderation-events/{moderation_id}/production-locations/{os_id}/` endpoint. This endpoint allows the creation of a new contribution for an existing production location based on the provided moderation event.
* [OSDEV-1336](https://opensupplyhub.atlassian.net/browse/OSDEV-1336) - Introduced a new PATCH `/api/v1/production-locations/{os_id}/` endpoint based on the API v1 specification. This endpoint allows the creation of a new moderation event for updating the production location with the given details. Basically, the endpoint can be used to contribute to an existing location.
* [OSDEV-1336](https://opensupplyhub.atlassian.net/browse/OSDEV-1336) - Dynamic mapping for the new fields in the `moderation-events` index has been disabled for those that don't have an explicit mapping defined. This change helps avoid indexing conflicts, such as when a field is initially indexed with one data type (e.g., long), but later an entry with a different data type for the same field is indexed, causing the entire entry to fail indexing. After this change, fields with an explicit mapping will be indexed, while other fields will not be indexed or searchable, but will still be displayed in the document.

### Architecture/Environment changes

Expand All @@ -23,11 +26,15 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
* [OSDEV-1493](https://opensupplyhub.atlassian.net/browse/OSDEV-1493) - Fixed an issue where the backend sorts countries not by `name` but by their `alpha-2 codes` in `GET /api/v1/moderation-events/` endpoint.

### What's new
* [OSDEV-1376](https://opensupplyhub.atlassian.net/browse/OSDEV-1376) - Updated automated emails for closure reports (report_result) to remove the term "Rejected" for an improved user experience. Added link to Closure Policy and instructions for submitting a Reopening Report to make the process easier to understand for users.
* [OSDEV-1383](https://opensupplyhub.atlassian.net/browse/OSDEV-1383) - Edited text of the automated email that notifies a contributor when one of their facilities has been claimed. The new text provides more information to the contributor to understand the claim process and how they can encourage more of their facilities to claim their profile.
* [OSDEV-1474](https://opensupplyhub.atlassian.net/browse/OSDEV-1474) - Added contributor type value to response of `/api/contributors/` endpoint.

### Release instructions:
* Ensure that the following commands are included in the `post_deployment` command:
* `migrate`
* `reindex_database`
* Run `[Release] Deploy` pipeline for the target environment with the flag `Clear the custom OpenSearch indexes and templates` set to true - to refresh the index mappings for the `moderation-events` index after disabling dynamic mapping for the new fields that don't have an explicit mapping defined. The `production-locations` will also be affected since it will clean all of our custom indexes and templates within the OpenSearch cluster


## Release 1.26.0
Expand Down Expand Up @@ -74,6 +81,20 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
### Architecture/Environment changes
* [OSDEV-1170](https://opensupplyhub.atlassian.net/browse/OSDEV-1170) - Added the ability to automatically create a dump from the latest shared snapshot of the anonymized database from Production environment for use in the Test and Pre-Prod environments.
* In light of recent instances(on 12/03/2024 UTC and 12/04/2024 UTC) where the current RDS disk storage space limit was reached in Production, the RDS storage size has been increased to `256 GB` in the Production, Test, and Pre-prod environments to accommodate the processing of larger volumes of data. The configurations for the Test and Pre-prod environments have also been updated to maintain parity with the Production environment.
* Right-sized the resources for Django containers across all environments and the RDS instance in the Production and Preprod environments. This will result in a savings of approximately $2,481. The following changes have been made:
- Production:
- RDS instance type was changed from `db.m6in.8xlarge` to `db.m6in.4xlarge`.
- ECS tasks for Django containers: the number was reduced from `12` to `10`, and memory was reduced from `8GB` to `4GB`.
- Preprod:
- RDS instance type was changed from `db.m6in.8xlarge` to `db.m6in.4xlarge`.
- ECS tasks for Django containers: the number was reduced from `12` to `10`, and memory was reduced from `8GB` to `4GB`.
- These changes were made to maintain parity with the Production environment, as it is a copy of that environment.
- Staging:
- ECS tasks for Django containers: memory was reduced from `8GB` to `2GB`.
- Test:
- ECS tasks for Django containers: memory was reduced from `8GB` to `4GB`.
- Development:
- ECS tasks for Django containers: memory was reduced from `8GB` to `1GB`, and CPU was reduced from `1 vCPU` to `0.5 vCPU`.

### Bugfix
* [OSDEV-1388](https://opensupplyhub.atlassian.net/browse/OSDEV-1388) - The waiter from boto3 cannot wait more than half an hour so we replaced it with our own.
Expand All @@ -91,7 +112,7 @@ This issue has been fixed by adding additional requests to delete the appropriat
* Ensure that the following commands are included in the `post_deployment` command:
* `migrate`
* `reindex_database`
* Run `[Release] Deploy` pipeline for the target environment with the flag `Clear custom OpenSearch indexes and templates` set to true - to refresh the index mappings for the `production-locations` and `moderation-events` indexes after fixing the process of clearing the custom OpenSearch indexes.
* Run `[Release] Deploy` pipeline for the target environment with the flag `Clear the custom OpenSearch indexes and templates` set to true - to refresh the index mappings for the `production-locations` and `moderation-events` indexes after fixing the process of clearing the custom OpenSearch indexes. It will clean all of our custom indexes and templates within the OpenSearch cluster.


## Release 1.25.0
Expand Down
18 changes: 18 additions & 0 deletions src/django/api/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ class APIV1CommonErrorMessages:
'Open Supply Hub is undergoing maintenance and not accepting new data '
'at the moment. Please try again in a few minutes.'
)
LOCATION_NOT_FOUND = 'The location with the given id was not found.'
LOCATION_ID_NOT_VALID = 'The value must be a valid id.'


class APIV1LocationContributionErrorMessages:
Expand All @@ -233,6 +235,12 @@ def invalid_data_type_error(data_type: str) -> str:
f'but got {data_type}.')


class APIV1ModerationEventErrorMessages:
EVENT_NOT_FOUND = 'Moderation event not found.'
EVENT_NOT_PENDING = 'The moderation event should be in PENDING status.'
INVALID_UUID_FORMAT = 'Invalid UUID format.'


# If the error isn’t field-specific, the non_field_errors key will be used
# for issues spanning multiple fields or related to the overall data
# object.
Expand All @@ -242,3 +250,13 @@ def invalid_data_type_error(data_type: str) -> str:
class APIV1LocationContributionKeys:
LNG = 'lng'
LAT = 'lat'


class APIV1MatchTypes:
NEW_PRODUCTION_LOCATION = 'moderation_event_new_production_location'
CONFIRMED_MATCH = 'moderation_event_confirmed_match'


LOCATION_CONTRIBUTION_APPROVAL_LOG_PREFIX = (
'[API V1 Location Contribution Approval]'
)
Loading

0 comments on commit b4cdf8f

Please sign in to comment.