Browse Source

lint

pull/3082/head
Samuel 3 months ago
parent
commit
965c0fd79a
  1. 1
      docs/exports.md
  2. 18
      docs/rake.md

1
docs/exports.md

@ -142,6 +142,7 @@ Full exports can only be run via a **rake task**.
<!-- Update this section when sales exports are added, as they will affect rake tasks --> <!-- Update this section when sales exports are added, as they will affect rake tasks -->
If the collection size is very large, full exports may fail due to memory issues. In such cases: If the collection size is very large, full exports may fail due to memory issues. In such cases:
- Delete the incomplete export files from the S3 bucket. - Delete the incomplete export files from the S3 bucket.
- It is better to batch exports into chunks of ~60,000 records and run several partial exports over multiple days. The `values_updated_at` field can help with this. - It is better to batch exports into chunks of ~60,000 records and run several partial exports over multiple days. The `values_updated_at` field can help with this.
- Rerun the task with more memory allocated, see 'Running Rake Tasks'. - Rerun the task with more memory allocated, see 'Running Rake Tasks'.

18
docs/rake.md

@ -3,42 +3,56 @@ nav_order: 11
--- ---
# Running Rake Tasks # Running Rake Tasks
On CORE, we sometimes need to run a Rake task manually on one of our deployed environments. On CORE, we sometimes need to run a Rake task manually on one of our deployed environments.
## Rake Tasks ## Rake Tasks
Rake tasks are defined in the `lib/tasks` directory of a Rails application. Rake tasks are defined in the `lib/tasks` directory of a Rails application.
## Running Rake Tasks locally ## Running Rake Tasks locally
This can be done from the command line: This can be done from the command line:
```bash ```bash
bundle exec rake <task> bundle exec rake <task>
``` ```
## Running Rake Tasks on CORE infrastructure ## Running Rake Tasks on CORE infrastructure
### Get access to an AWS CLI ### Get access to an AWS CLI
TODO docs on this TODO docs on this
### Set up environment variables ### Set up environment variables
Set the env as appropriate: Set the env as appropriate:
```bash ```bash
export env=prod export env=prod
``` ```
Other options are `staging` or `review-XXXX`, where `XXXX` is the review app number. Other options are `staging` or `review-XXXX`, where `XXXX` is the review app number.
Set up the Rake Task as appropriate: Set up the Rake Task as appropriate:
```bash ```bash
export rake_task=<task> export rake_task=<task>
``` ```
Where `<task>` is the name of the Rake task you want to run, local equivalent would be `bundle exec rake <task>`. Where `<task>` is the name of the Rake task you want to run, local equivalent would be `bundle exec rake <task>`.
Set up the CPU and memory requirements for the task: Set up the CPU and memory requirements for the task:
```bash ```bash
export cpu_value=1024 export cpu_value=1024
export memory_value=2048 export memory_value=2048
``` ```
See [the AWS documentation](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#task_size) for valid CPU and memory pairs. See [the AWS documentation](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#task_size) for valid CPU and memory pairs.
Set the other environment variables: Set the other environment variables:
```bash ```bash
export cluster=core-$env-app export cluster=core-$env-app
export service=core-$env-app export service=core-$env-app
@ -48,11 +62,13 @@ export overrides="{ \"containerOverrides\" : [{ \"name\" : \"app\", \"command\"
``` ```
### Start the Rake Task ### Start the Rake Task
```bash ```bash
aws ecs run-task --cluster $cluster --task-definition $ad_hoc_task_definition --network-configuration "$network" --overrides "$overrides" --launch-type FARGATE --query tasks[0].taskArn aws ecs run-task --cluster $cluster --task-definition $ad_hoc_task_definition --network-configuration "$network" --overrides "$overrides" --launch-type FARGATE --query tasks[0].taskArn
``` ```
The task ARN will be printed to the console. The task ARN will be printed to the console.
### View the Task progress ### View the Task progress
This can be viewed in the AWS console by navigating to the ECS cluster specified in the environment variables, listing all tasks in the cluster, and selecting the task with the ARN printed in the previous step. This can be viewed in the AWS console by navigating to the ECS cluster specified in the environment variables, listing all tasks in the cluster, and selecting the task with the ARN printed in the previous step.

Loading…
Cancel
Save