Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into websocket-update
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjam-deriv committed Dec 7, 2023
2 parents 9bb647d + 9831bc0 commit 17f58a8
Show file tree
Hide file tree
Showing 137 changed files with 11,116 additions and 12,827 deletions.
42 changes: 42 additions & 0 deletions .github/actions/deploy_to_kubernetes/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: k8s_deploy
description: Deploy to Kubernetes
inputs:
K8S_VERSION:
description: Kubernetes version
required: true
K8S_NAMESPACE:
description: Kubernetes namespace
required: false
default: 'deriv-com-api-staging'
CA_CRT:
description: Kubernetes CA certificate
required: true
KUBE_SERVER:
description: Kubernetes server
required: true
SERVICEACCOUNT_TOKEN:
description: Kubernetes service account token
required: true
DOCKERHUB_ORGANISATION:
description: Dockerhub organisation
required: true
runs:
using: composite
steps:
- name: Setup Environment variables
run: |
echo "NAMESPACE=${{ inputs.K8S_NAMESPACE }}" >> "$GITHUB_ENV"
echo "KUBE_SERVER=${{ inputs.KUBE_SERVER }}" >> "$GITHUB_ENV"
echo "SERVICEACCOUNT_TOKEN=${{ inputs.SERVICEACCOUNT_TOKEN }}" >> "$GITHUB_ENV"
echo "DOCKERHUB_ORGANISATION=${{ inputs.DOCKERHUB_ORGANISATION }}" >> "$GITHUB_ENV"
echo "CA_CRT=${{ inputs.CA_CRT }}" >> "$GITHUB_ENV"
echo "APP_NAME=deriv-com-api" >> "$GITHUB_ENV"
shell: bash
- name: Deploying to k8s cluster for service ${{ inputs.K8S_NAMESPACE }} 🚀
run: |
git clone https://github.com/binary-com/devops-ci-scripts
cd devops-ci-scripts/k8s-build_tools
echo ${{ inputs.CA_CRT }} | base64 --decode > ca.crt
export CA="ca.crt"
./release.sh ${APP_NAME} ${{ inputs.K8S_VERSION }}
shell: bash
38 changes: 38 additions & 0 deletions .github/actions/publish_to_docker/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: docker_build_push
description: Build and push Docker image to Docker Hub
inputs:
DOCKER_LATEST_IMAGE_TAG:
description: Docker image tag
required: false
default: 'latest-staging'
DOCKER_IMAGE_TAG:
description: Docker image tag
required: true
DOCKERHUB_ORGANISATION:
description: Docker Hub organisation
required: true
DOCKERHUB_USERNAME:
description: Docker Hub username
required: true
DOCKERHUB_PASSWORD:
description: Docker Hub password
required: true
runs:
using: composite
steps:
- name: Building docker image 🐳
run: |
docker build -t ${{ inputs.DOCKERHUB_ORGANISATION }}/deriv-com-api:${{ inputs.DOCKER_IMAGE_TAG }} -t ${{ inputs.DOCKERHUB_ORGANISATION }}/deriv-com-api:${{ inputs.DOCKER_LATEST_IMAGE_TAG }} .
shell: bash
- name: Verify nginx image
run: |
set -e
docker run --rm ${{ inputs.DOCKERHUB_ORGANISATION }}/deriv-com-api:${{ inputs.DOCKER_LATEST_IMAGE_TAG }} nginx -t
echo "docker image validated successfully"
shell: bash
- name: Pushing Image to docker hub 🐳
run: |
echo ${{ inputs.DOCKERHUB_PASSWORD }} | docker login -u ${{ inputs.DOCKERHUB_USERNAME }} --password-stdin
docker push ${{ inputs.DOCKERHUB_ORGANISATION }}/deriv-com-api:${{ inputs.DOCKER_IMAGE_TAG }}
docker push ${{ inputs.DOCKERHUB_ORGANISATION }}/deriv-com-api:${{ inputs.DOCKER_LATEST_IMAGE_TAG }}
shell: bash
18 changes: 18 additions & 0 deletions .github/workflows/release_production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,24 @@ jobs:
with:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
- name: Publish to Docker
uses: ./.github/actions/publish_to_docker
with:
DOCKER_LATEST_IMAGE_TAG: 'latest'
DOCKER_IMAGE_TAG: ${{ github.ref_name }}
DOCKERHUB_ORGANISATION: ${{ secrets.DOCKERHUB_ORGANISATION }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Deploy to Kubernetes
uses: ./.github/actions/deploy_to_kubernetes
with:
K8S_VERSION: ${{ github.ref_name }}
K8S_NAMESPACE: 'deriv-com-api-production'
CA_CRT: ${{ secrets.CA_CRT }}
SERVICEACCOUNT_TOKEN: ${{ secrets.SERVICEACCOUNT_TOKEN }}
KUBE_SERVER: ${{ secrets.KUBE_SERVER }}
DOCKERHUB_ORGANISATION: ${{ secrets.DOCKERHUB_ORGANISATION }}

send_slack_notification:
name: Send Slack Notification
environment: Production
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/release_staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,20 @@ jobs:
with:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
- name: Publish to Docker
uses: ./.github/actions/publish_to_docker
with:
DOCKER_LATEST_IMAGE_TAG: 'latest-staging'
DOCKER_IMAGE_TAG: ${{ github.ref_name }}
DOCKERHUB_ORGANISATION: ${{ secrets.DOCKERHUB_ORGANISATION }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Deploy to Kubernetes
uses: ./.github/actions/deploy_to_kubernetes
with:
K8S_VERSION: ${{ github.ref_name }}
K8S_NAMESPACE: 'deriv-com-api-staging'
CA_CRT: ${{ secrets.CA_CRT }}
SERVICEACCOUNT_TOKEN: ${{ secrets.SERVICEACCOUNT_TOKEN }}
KUBE_SERVER: ${{ secrets.KUBE_SERVER }}
DOCKERHUB_ORGANISATION: ${{ secrets.DOCKERHUB_ORGANISATION }}
2 changes: 2 additions & 0 deletions _data/v3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ groups:
title: 'Copy Trading: Statistics'
- name: crypto_config
title: Cryptocurrency configurations
- name: crypto_estimations
title: Cryptocurrency Estimations
- name: document_upload
title: Document Upload
- name: economic_calendar
Expand Down
121 changes: 59 additions & 62 deletions config/v3/active_symbols/send.json
Original file line number Diff line number Diff line change
@@ -1,65 +1,62 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Active Symbols (request)",
"description": "Retrieve a list of all currently active symbols (underlying markets upon which contracts are available for trading).",
"type": "object",
"auth_required": 0,
"additionalProperties": false,
"required": [
"active_symbols"
],
"properties": {
"active_symbols": {
"description": "If you use `brief`, only a subset of fields will be returned.",
"type": "string",
"enum": [
"brief",
"full"
]
},
"landing_company": {
"description": "Deprecated - replaced by landing_company_short.",
"type": "string",
"enum": [
"iom",
"malta",
"maltainvest",
"svg",
"virtual",
"vanuatu",
"champion",
"champion-virtual"
]
},
"landing_company_short": {
"description": "[Optional] If you specify this field, only symbols available for trading by that landing company will be returned. If you are logged in, only symbols available for trading by your landing company will be returned regardless of what you specify in this field.",
"type": "string",
"enum": [
"iom",
"malta",
"maltainvest",
"svg",
"virtual",
"vanuatu",
"champion",
"champion-virtual"
]
},
"product_type": {
"description": "[Optional] If you specify this field, only symbols that can be traded through that product type will be returned.",
"type": "string",
"enum": [
"basic"
]
},
"passthrough": {
"description": "[Optional] Used to pass data through the websocket, which may be retrieved via the `echo_req` output field. Maximum size is 3500 bytes.",
"type": "object",
"maxSize": 3500
},
"req_id": {
"description": "[Optional] Used to map request to response.",
"type": "integer"
}
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Active Symbols (request)",
"description": "Retrieve a list of all currently active symbols (underlying markets upon which contracts are available for trading).",
"type": "object",
"auth_required": 0,
"additionalProperties": false,
"required": ["active_symbols"],
"properties": {
"active_symbols": {
"description": "If you use `brief`, only a subset of fields will be returned.",
"type": "string",
"enum": ["brief", "full"]
},
"landing_company": {
"description": "Deprecated - replaced by landing_company_short.",
"type": "string",
"enum": [
"iom",
"malta",
"maltainvest",
"svg",
"virtual",
"vanuatu",
"champion",
"champion-virtual"
]
},
"landing_company_short": {
"description": "[Optional] If you specify this field, only symbols available for trading by that landing company will be returned. If you are logged in, only symbols available for trading by your landing company will be returned regardless of what you specify in this field.",
"type": "string",
"enum": [
"iom",
"malta",
"maltainvest",
"svg",
"virtual",
"vanuatu",
"champion",
"champion-virtual"
]
},
"product_type": {
"description": "[Optional] If you specify this field, only symbols that can be traded through that product type will be returned.",
"type": "string",
"enum": ["basic"]
},
"loginid": {
"description": "[Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id.",
"type": "string",
"pattern": "^[A-Za-z]+[0-9]+$"
},
"passthrough": {
"description": "[Optional] Used to pass data through the websocket, which may be retrieved via the `echo_req` output field. Maximum size is 3500 bytes.",
"type": "object"
},
"req_id": {
"description": "[Optional] Used to map request to response.",
"type": "integer"
}
}
}
115 changes: 52 additions & 63 deletions config/v3/api_token/send.json
Original file line number Diff line number Diff line change
@@ -1,66 +1,55 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "API Token (request)",
"description": "This call manages API tokens",
"type": "object",
"auth_required": 1,
"auth_scopes": [
"admin"
],
"additionalProperties": false,
"required": [
"api_token"
],
"properties": {
"api_token": {
"description": "Must be `1`",
"type": "integer",
"enum": [
1
]
},
"delete_token": {
"description": "[Optional] The token to remove.",
"type": "string",
"pattern": "^\\w+$"
},
"new_token": {
"description": "[Optional] The name of the created token.",
"type": "string",
"pattern": "^[A-Za-z0-9\\s_]+$"
},
"new_token_scopes": {
"description": "[Optional] List of permission scopes to provide with the token.",
"type": "array",
"items": {
"description": "Required when create new token",
"type": "string",
"enum": [
"read",
"trade",
"trading_information",
"payments",
"admin"
]
},
"uniqueItems": true
},
"valid_for_current_ip_only": {
"description": "[Optional] If you set this parameter during token creation, then the token created will only work for the IP address that was used to create the token",
"type": "integer",
"enum": [
0,
1
]
},
"passthrough": {
"description": "[Optional] Used to pass data through the websocket, which may be retrieved via the `echo_req` output field. Maximum size is 3500 bytes.",
"type": "object",
"maxSize": 3500
},
"req_id": {
"description": "[Optional] Used to map request to response.",
"type": "integer"
}
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "API Token (request)",
"description": "This call manages API tokens",
"type": "object",
"auth_required": 1,
"auth_scopes": ["admin"],
"additionalProperties": false,
"required": ["api_token"],
"properties": {
"api_token": {
"description": "Must be `1`",
"type": "integer",
"enum": [1]
},
"delete_token": {
"description": "[Optional] The token to remove.",
"type": "string",
"pattern": "^\\w+$"
},
"new_token": {
"description": "[Optional] The name of the created token.",
"type": "string",
"pattern": "^[A-Za-z0-9\\s_]+$"
},
"new_token_scopes": {
"description": "[Optional] List of permission scopes to provide with the token.",
"type": "array",
"items": {
"description": "Required when create new token",
"type": "string",
"enum": ["read", "trade", "trading_information", "payments", "admin"]
},
"uniqueItems": true
},
"valid_for_current_ip_only": {
"description": "[Optional] If you set this parameter during token creation, then the token created will only work for the IP address that was used to create the token",
"type": "integer",
"enum": [0, 1]
},
"loginid": {
"description": "[Optional] The login id of the user. If left unspecified, it defaults to the initial authorized token's login id.",
"type": "string",
"pattern": "^[A-Za-z]+[0-9]+$"
},
"passthrough": {
"description": "[Optional] Used to pass data through the websocket, which may be retrieved via the `echo_req` output field. Maximum size is 3500 bytes.",
"type": "object"
},
"req_id": {
"description": "[Optional] Used to map request to response.",
"type": "integer"
}
}
}
Loading

0 comments on commit 17f58a8

Please sign in to comment.