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

Commit 06df695

Browse files
Hubert KosterHubert Koster
authored andcommitted
chore: fixing merge conflict
2 parents c5478bc + 65c4538 commit 06df695

File tree

32 files changed

+495
-18644
lines changed

32 files changed

+495
-18644
lines changed

.circleci/config.yml

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
version: 2.1
2+
orbs:
3+
k8s: circleci/kubernetes@0.7.0
4+
slack: circleci/slack@3.4.2
5+
commands:
6+
npm_install_from_cache:
7+
description: "npm install and save cache"
8+
steps:
9+
- restore_cache:
10+
key: v1-deps-{{ checksum "package-lock.json" }}
11+
- run:
12+
name: Install npm dependencies
13+
command: npm install
14+
- save_cache:
15+
key: v1-deps-{{ checksum "package-lock.json" }}
16+
paths:
17+
- node_modules
18+
build:
19+
description: "Build Docusaurus project"
20+
steps:
21+
- run:
22+
name: Building Docusaurus project
23+
command: npm run build
24+
25+
versioning:
26+
description: "Versioning the image"
27+
parameters:
28+
version_name:
29+
type: string
30+
default: "staging"
31+
steps:
32+
- run:
33+
name: Tag build
34+
command: echo "<< parameters.version_name >> $(date -u +'%Y-%m-%dT%H:%M:%SZ')" > build/version
35+
36+
docker_build_push:
37+
description: "Build and push Docker image to Docker Hub"
38+
parameters:
39+
docker_latest_image_tag:
40+
type: string
41+
default: "latest-staging"
42+
docker_image_tag:
43+
type: string
44+
default: ${CIRCLE_SHA1}
45+
steps:
46+
- setup_remote_docker
47+
- run:
48+
name: Building docker image
49+
command: |
50+
docker build -t ${DOCKHUB_ORGANISATION}/deriv-com-api:<< parameters.docker_image_tag >> -t ${DOCKHUB_ORGANISATION}/deriv-com-api:<< parameters.docker_latest_image_tag >> .
51+
- run:
52+
name: Pushing Image to docker hub
53+
command: |
54+
echo $DOCKERHUB_PASSWORD | docker login -u $DOCKERHUB_USERNAME --password-stdin
55+
docker push ${DOCKHUB_ORGANISATION}/deriv-com-api:<< parameters.docker_image_tag >>
56+
docker push ${DOCKHUB_ORGANISATION}/deriv-com-api:<< parameters.docker_latest_image_tag >>
57+
k8s_deploy:
58+
description: "Deploy to k8s cluster"
59+
parameters:
60+
target:
61+
type: string
62+
default: "beta"
63+
k8s_version:
64+
type: string
65+
default: ${CIRCLE_SHA1}
66+
k8s_namespace:
67+
type: string
68+
default: "deriv-com-api-staging"
69+
steps:
70+
- k8s/install-kubectl
71+
- run:
72+
name: Deploying to k8s cluster for service << parameters.k8s_namespace >>
73+
command: |
74+
export NAMESPACE=<< parameters.k8s_namespace >>
75+
git clone https://github.com/binary-com/devops-ci-scripts
76+
cd devops-ci-scripts/k8s-build_tools
77+
echo $CA_CRT | base64 --decode > ca.crt
78+
./release.sh deriv-com-api << parameters.k8s_version >>
79+
notify_slack:
80+
description: "Notify slack"
81+
steps:
82+
- slack/status:
83+
include_project_field: false
84+
failure_message: "Release failed for api.deriv.com with version *$(cat build/version)*"
85+
success_message: "Release succeeded for api.deriv.com with version *$(cat build/version)*"
86+
webhook: ${SLACK_WEBHOOK}
87+
publish_to_pages_staging:
88+
description: "Publish to cloudflare pages"
89+
steps:
90+
- run:
91+
name: "Publish to cloudflare pages (staging)"
92+
command: |
93+
npm i wrangler@2.0.19
94+
cd build
95+
npx wrangler pages publish . --project-name=deriv-developers-portal-pages --branch=staging
96+
echo "New staging website - https://staging-api.deriv.com/"
97+
98+
publish_to_pages_production:
99+
description: "Publish to cloudflare pages"
100+
steps:
101+
- run:
102+
name: "Publish to cloudflare pages (production)"
103+
command: |
104+
npm i wrangler@2.0.19
105+
cd build
106+
npx wrangler pages publish . --project-name=deriv-developers-portal-pages --branch=main
107+
echo "New website - https://api.deriv.com"
108+
109+
jobs:
110+
build:
111+
docker:
112+
- image: cimg/node:18.16.0
113+
steps:
114+
- checkout
115+
- npm_install_from_cache
116+
- build
117+
118+
release_staging:
119+
docker:
120+
- image: cimg/node:18.16.0
121+
steps:
122+
- checkout
123+
- npm_install_from_cache
124+
- build
125+
- versioning
126+
- docker_build_push
127+
- k8s_deploy
128+
- publish_to_pages_staging
129+
- notify_slack
130+
environment:
131+
NODE_ENV: staging
132+
133+
release_production:
134+
docker:
135+
- image: cimg/node:18.16.0
136+
steps:
137+
- checkout
138+
- npm_install_from_cache
139+
- build
140+
- versioning:
141+
version_name: production
142+
- docker_build_push:
143+
docker_latest_image_tag: latest
144+
docker_image_tag: ${CIRCLE_SHA1}
145+
- k8s_deploy:
146+
k8s_namespace: "deriv-com-api-production"
147+
k8s_version: ${CIRCLE_SHA1}
148+
- publish_to_pages_production
149+
- notify_slack
150+
environment:
151+
NODE_ENV: production
152+
153+
workflows:
154+
release_staging:
155+
jobs:
156+
- release_staging:
157+
context: binary-frontend-artifact-upload
158+
filters:
159+
branches:
160+
only: /^master$/
161+
release_production:
162+
jobs:
163+
- release_production:
164+
context: binary-frontend-artifact-upload
165+
filters:
166+
branches:
167+
ignore: /.*/
168+
tags:
169+
only: /^production.*/

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM nginx:alpine
2+
COPY ./build /usr/share/nginx/html
3+
COPY ./developers.deriv.com.conf /etc/nginx/conf.d/default.conf
4+
RUN chown -R nginx:nginx /usr/share/nginx/html

developers.deriv.com.conf

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
server {
2+
listen 80;
3+
server_name _;
4+
root /usr/share/nginx/html;
5+
index index.html index.htm;
6+
7+
charset UTF-8;
8+
9+
error_page 404 /404.html;
10+
11+
location @custom_error_503 {
12+
return 503;
13+
}
14+
15+
location ~ /\.git {
16+
return 404;
17+
}
18+
19+
location ~* \.(html)$ {
20+
add_header Cache-Control "public, max-age=0, must-revalidate";
21+
}
22+
23+
location ~ (manifest\.json|robots\.txt|service-worker\.js|sitemap\.xml|favicon\.ico)$ {
24+
add_header Cache-Control "public, max-age=0, must-revalidate";
25+
}
26+
27+
location /playground {
28+
return 301 https://$http_host/api-explorer/;
29+
}
30+
31+
location / {
32+
try_files $uri /index.html;
33+
}
34+
}

docs/core-concepts/authorization-authentication/index.md

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Please make sure you have all the requirements mentioned below to continue.
2525
3. Deriv app ID
2626

2727
:::note
28-
Please refer to [Setting up a Deriv application](docs/setting-up-a-deriv-application) for detailed instructions how to create a Deriv API token and application.
28+
Please refer to [Setting up a Deriv application](docs/setting-up-a-deriv-application.md) for detailed instructions how to create a Deriv API token and application.
2929
:::
3030

3131
### API token
@@ -54,15 +54,13 @@ For more information on OAuth2, visit [this guide](https://aaronparecki.com/oau
5454

5555
Here is the visual representation of how the OAuth authorisation connection works:
5656

57-
![OAuth flow](/img/how_oauth_works.png "OAuth flow")
57+
![OAuth flow](/img/how_oauth_works.png 'OAuth flow')
5858

5959
## The authentication process
6060

6161
In order to authenticate your user, specify the URL that will be used as the OAuth Redirect URL on the [Dashboard](/dashboard) page, **Register application** tab in the **OAuth details** fields. Then, add a login button on your website or app and direct users to **`https://oauth.binary.com/oauth2/authorize?app_id=your_app_id`** where your_app_id is the ID of your app.
6262

63-
64-
65-
![Deriv OAuth Login](/img/oauth_login.png "Deriv OAuth Login")
63+
![Deriv OAuth Login](/img/oauth_login.png 'Deriv OAuth Login')
6664

6765
Once a user signs up/logs in, they will be redirected to the URL that you entered as the Redirect URL. This URL will have arguments added to it with the user's session tokens, and will look similar to this:
6866

@@ -74,17 +72,17 @@ The query parameters in the redirect URL are the user's accounts and their relat
7472

7573
```js
7674
const user_accounts = [
77-
{
78-
account: "cr799393",
79-
token: "a1-f7pnteezo4jzhpxclctizt27hyeot",
80-
currency: "usd"
81-
},
82-
{
83-
account: "vrtc1859315",
84-
token: "a1clwe3vfuuus5kraceykdsoqm4snfq",
85-
currency: "usd"
86-
},
87-
]
75+
{
76+
account: 'cr799393',
77+
token: 'a1-f7pnteezo4jzhpxclctizt27hyeot',
78+
currency: 'usd',
79+
},
80+
{
81+
account: 'vrtc1859315',
82+
token: 'a1clwe3vfuuus5kraceykdsoqm4snfq',
83+
currency: 'usd',
84+
},
85+
];
8886
```
8987
To authorise the user based on the user's **selected** account, call the [authorize](https://api.deriv.com/api-explorer#authorize) API call with the user's **selected** account **session token**:
9088
```js
@@ -147,4 +145,4 @@ The response for the `authorize` call would be an object as below:
147145
"user_id": 12345678
148146
}
149147
```
150-
Now, the user is authorised, and you use Deriv API calls on behalf of the account.
148+
Now, the user is authorised, and you use Deriv API calls on behalf of the account.

docusaurus.config.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,21 @@ const config = {
2727
locales: ['en'],
2828
},
2929

30-
plugins: ['@docusaurus/theme-live-codeblock', 'docusaurus-plugin-sass'],
30+
plugins: [
31+
'@docusaurus/theme-live-codeblock',
32+
'docusaurus-plugin-sass',
33+
[
34+
'@docusaurus/plugin-client-redirects',
35+
{
36+
redirects: [
37+
{
38+
to: '/docs/intro',
39+
from: '/docs',
40+
},
41+
],
42+
},
43+
],
44+
],
3145

3246
presets: [
3347
[
@@ -106,10 +120,6 @@ const config = {
106120
disableSwitch: true,
107121
respectPrefersColorScheme: false,
108122
},
109-
announcementBar: {
110-
id: 'announcementBar-2', // Increment on change
111-
content: `⭐️ This project is still in progress, we'll add more contents and features everyday, so stay tuned!`,
112-
},
113123
}),
114124
};
115125

0 commit comments

Comments
 (0)