---
# System prepended metadata

title: Chris TOI

---

# Chris TOI

## Table of Contents

- [Quest Settings](#Quest-setting)
- [Integration to New Channel](#Integration-to-New-Channel)
- [Operation Job](#Operation-Job)
- [Portal Specific](#Portal-Specific)
- [UserLabel System](#UserLabel-System)
- [Others](#Others)
- [Remove All Account Permissions](#Remove-All-Account-Permissions)

---

## Quest setting

1. google doc
    - account permission transfer
    - overview
    - webhook plugin/settings
2. mbs-webhook
    - overview
    - repo
    - data flow
3. rules-create-rule-activity
    - overview


## Integration to New Channel
- prerequisite
- data flow
    - case by case

## Operation Job

### 1. AWS switch role with aws-cli
### 2. postgres upgrade
### 3. SQS dlq redrive sop
    - Prod上面有Code
### 4. Redis clean script and command
##### Batch Remove User-Trail Logs (from Peter's Note)
```
redis-cli -h {redis_host} -n {redis_db} KEYS “user_trail|*” | xargs redis-cli -h {redis_host} -n {redis_db} DEL
```
### 5. Online troubleshooting
    - log
    - dashboard 
    
### 6. Workspace Image 修改
```
1. django-admin-hub 修改 requirement.txt或是docker file
2. cicd 會在 django 佈版的時候push一版到gitlab image repo
3. docker-compose -f {COMPOSE_FILE} pull
```

### 7. Django admin不能讀寫分離

## Portal Specific
1. API
    - user_binding
2. Data flow
3. Data Model
    - integrity
    - unique constraint 

## DB壓測
### tsenart/Vegeta
###

## UserLabel System
0. Data Model
```
                                                                 ┌─ updated_date
                                                                 │
                                                                 ├─ created_date
                                                                 │
                                                           ┌─────┴─────────────────────┐
                                                           │                           │
                                                           │                           ├── read_by  ◄───┐
                                       M:N                 │   UserLabelGroupConfig    │                │
                                      ┌───────────────────►│                           ├── write_by     │
                                      │                    │                           │                │
 ┌──────┐    ┌─────────┐              │                    └──────┬────────────────────┘      ▲         │
 │ User │    │ Project │◄─────────┐   │                           │                           │         │
 └──────┘    └─────────┘          │   │                           ├─ name                     │         │
     ▲                            │   │                           │                           │         │
     │                            │   │                           ├─ title                    │         │
     │                            │   │                           │                           │         │
     │                            │   │                           ├─ description              │         │
     │                            │   │  ┌─ created_date          │                           │         │
     │                       F.K. │   │  │                        ├─ image_source             │         │
     │                            │   │  ├─ updated_date          │                           │         │
     │                            │   │  │               ┌─ name  └─ visibility               │         │
     │                            │   ▼  │               │                                    │         │
     │                          ┌─┴──────┴────────┐      ├─ title                             │         │
     │                          │                 │      │                                    │   M:N   │
     │                          │                 │      ├─ description                       │         │
     │     ┌───────────────────►│ UserLabelConfig ├──────┤                                    │         │
     │     │      F.K.          │                 │      ├─ image_source                      │         │
     │     │                    │                 │      │                                    │         │
     │     │                    └─────────┬───────┘      ├─ visibility                        │         │
     │     │                              │              │                                    │         │
     │     │                              │              ├─ read_by ◄────────────────────┐    │         │
     │     │                              │              │                               ▼    │         ▼
┌────┴─────┴┐   ┌─ start_date             │              └─ write_by ◄────┐    M:N      ┌─────┴───────────┐
│ UserLabel ├───┤                         │                               │             │                 │
└───────────┘   ├─ expire_date            ├─ timelife_type                │             │                 │
                │                         │                               │             │                 │
                ├─ created_date           ├─ start_date                   └───────────► │ ClientAppConfig │
                │                         │                                             │                 │
                └─ update_date            ├─ end_date                                   │                 │
                                          │                                             └─────────────────┘
                                          └─ scalar
```
2. Spec
3. API
    - apply_user_label
    - user_label
4. Console Job
    - batch_apply_user_label
        - data flow
        - architecture

## Others

1. DB Migration
    - sop
    - 
2. SOP for deploying new component api
    - sop
3. How to rollback
4. API Hub Virtualization
    - relationship of each component
    - overview
5. Redash
    - overview
    - data flow
6. AWS上其他同名的Infra是誰在使用?
7. Serverless上的 `Should Provision` 不太確定此Condition用途
8. 

## Finally, Remove Permission

1. django
- [ ] ut
- [ ] uat
- [ ] prod
2. gitlab
- [ ] apihub group
3. redash
- [ ] prod
4. aws
- [ ] orcahub
- [ ] quest
5. trello
7. ...


### Attachments

1. rule engine 任務牆 快速設定：

uat:
https://docs.google.com/forms/d/e/1FAIpQLSf31WefguuqqrfKvm9eYWOxBuVsRPk8B9pDCEFLfIj9VqttjQ/viewform?usp=pp_url&entry.410192931=13eacebf-a030-47b8-a15b-5058a55016c1&entry.1304584627=myrewards&entry.1886227272=1&entry.238240548=https://tmr.cathaybkdev.com.tw:8082/zuul/mobile-device-service/mds/postBackEvents/postBack&entry.1327412945=https://at-uat-api.orca-qst-dev.com/v1/task-process-async&entry.1268550800=mmo://TaskList?tab%3D0&entry.97709762=1

prod:
https://docs.google.com/forms/d/e/1FAIpQLSfE88ZWbDTMyYaqFSnWUD_-e5JtRXGOqnkVLP1tHrZQtekkrw/viewform?usp=pp_url&entry.410192931=276ec71a-e288-4828-8afb-09bb9565c54b&entry.1304584627=myrewards&entry.1886227272=1&entry.238240548=https://myrewards-app.com.tw:8082/zuul/mobile-device-service/mds/postBackEvents/postBack&entry.1327412945=https://prod-api.orca-quest.com/v1/task-process-async&entry.1268550800=mmo://TaskList?tab%3D0&entry.97709762=1


---

# Handover for Peter
## AWS
### IAM
#### 1. admin-account在command line下的切換方式
### RDS
#### 1. Upgrade PostGres
### SQS
#### 1. DLQ處理腳本
#### 2. Redis清掃腳本
## Membership
### 1. Migration是否有需要特別注意的事項
    - sop
### 2. 再確認上一隻全新的API需要過哪些流程
    - apihub
        - rpc-contract
        - double-confirm
## API-Hub
### 上線遇到問題後，退版處理的Know How
    - rollback
        - revert
### 虛級化的Layout更新流程再確認
    - relationship of apihub-wsgi-new

### 未經api-hub直接call func的component現況

## Google Form
### Architecture
### mbs-webhook專案

## DataMapping
- Portal與這個專案的know how
    - data
- UserLabel與這個專案的know how

### Integration to New Channel
- data flow

## UserLabel
### 目前跟舊有tag的關係
### 待交接
- API規格文件

## Django Admin
### 待補充

## Release
### 待補充

## Repo
### Trello / Gitlab帳號權限

## Redesh
### 維護Know how
- host where ?
- aws flow direct ?