Skip to content
This repository was archived by the owner on Nov 24, 2022. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .env
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
REACT_APP_SERVICE_HOST=//127.0.0.1
REACT_APP_SERVICE_PORT=3000
REACT_APP_SERVICE_HOST=//127.0.0.1:3000

REACT_APP_NODE_HOST=127.0.0.1
REACT_APP_NODE_WS_PORT=9944
REACT_APP_NODE_HOST=ws://127.0.0.1:9944

REACT_APP_FAUCET_URL=https://faucet.kilt.io

Expand Down
6 changes: 2 additions & 4 deletions .env.devnet
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
REACT_APP_SERVICE_HOST=https://services.devnet.kilt.io
REACT_APP_SERVICE_PORT=443
REACT_APP_SERVICE_HOST=https://services.devnet.kilt.io:443

REACT_APP_NODE_HOST=full-nodes-lb.devnet.kilt.io
REACT_APP_NODE_WS_PORT=443
REACT_APP_NODE_HOST=wss://full-nodes-lb.devnet.kilt.io:443

REACT_APP_FAUCET_URL=https://faucet-devnet.kilt.io

Expand Down
6 changes: 2 additions & 4 deletions .env.production
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
REACT_APP_SERVICE_HOST=https://services.kilt.io
REACT_APP_SERVICE_PORT=443
REACT_APP_SERVICE_HOST=https://services.kilt.io:443

REACT_APP_NODE_HOST=full-nodes.kilt.io
REACT_APP_NODE_WS_PORT=443
REACT_APP_NODE_HOST=wss://full-nodes.kilt.io:443

REACT_APP_FAUCET_URL=https://faucet.kilt.io

Expand Down
46 changes: 41 additions & 5 deletions .github/workflows/aws-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ on:

name: Deploy to Amazon ECS

env:
ECR_REPOSITORY: kilt/demo-client
ECR_IMAGE_TAG: latest-develop

jobs:
deploy:
name: Deploy
Expand All @@ -55,15 +59,13 @@ jobs:
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: kilt/demo-client
IMAGE_TAG: latest-develop
run: |
# Build a docker container and
# push it to ECR so that it can
# be deployed to ECS.
docker build -f Dockerfile.devnet -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
docker build -f Dockerfile.devnet -t $ECR_REGISTRY/$ECR_REPOSITORY:$ECR_IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$ECR_IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$ECR_IMAGE_TAG"

- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def
Expand All @@ -80,3 +82,37 @@ jobs:
service: demo-client
cluster: kilt-devnet
wait-for-service-stability: true

publish_to_docker:
name: Publish develop image to docker
needs: deploy
runs-on: ubuntu-latest

steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Login to Docker Hub
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
run: |
echo $DOCKER_PASS | docker login --username=$DOCKER_USER --password-stdin
- name: Tag and push dev image to Docker Hub
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
DOCKER_REPOSITORY: kiltprotocol/demo-client
DOCKER_IMAGE_TAG: develop
run: |
SOURCE_IMAGE=$ECR_REGISTRY/$ECR_REPOSITORY:$ECR_IMAGE_TAG
docker pull $SOURCE_IMAGE
docker tag $SOURCE_IMAGE $DOCKER_REPOSITORY:$DOCKER_IMAGE_TAG
docker push $DOCKER_REPOSITORY:$DOCKER_IMAGE_TAG
10 changes: 4 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,13 @@ services:
volumes:
- ./src:/app/src
environment:
- REACT_APP_SERVICE_HOST=//127.0.0.1
- REACT_APP_SERVICE_PORT=3000
- REACT_APP_NODE_HOST=127.0.0.1
- REACT_APP_NODE_WS_PORT=9944
- REACT_APP_SERVICE_HOST=//127.0.0.1:3000
- REACT_APP_NODE_HOST=ws://127.0.0.1:9944
- REACT_APP_FAUCET_URL=http://127.0.0.1:3002
- PUBLIC_URL=.
# if you experience issues where the watcher does not trigger rebuilds
# if you experience issues where the watcher does not trigger rebuilds
# when changing files in src/ the following option may help
#- CHOKIDAR_USEPOLLING=true
#- CHOKIDAR_USEPOLLING=true

ports:
- 3001:3001
Expand Down
3 changes: 1 addition & 2 deletions src/services/BlockchainService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ class BlockchainService {
}

public static getNodeWebsocketUrl(): string {
const protocol = window.location.protocol === 'https:' ? 'wss' : 'ws'
return `${protocol}://${process.env.REACT_APP_NODE_HOST}:${process.env.REACT_APP_NODE_WS_PORT}`
return `${process.env.REACT_APP_NODE_HOST}`
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/services/ContactRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { notifyFailure } from './FeedbackService'
// (for other tests)

class ContactRepository {
public static readonly URL = `${process.env.REACT_APP_SERVICE_HOST}:${process.env.REACT_APP_SERVICE_PORT}/contacts`
public static readonly URL = `${process.env.REACT_APP_SERVICE_HOST}/contacts`

public static async findAll(): Promise<IContact[]> {
return fetch(`${ContactRepository.URL}`)
Expand Down
2 changes: 1 addition & 1 deletion src/services/CtypeRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class CTypeRepository {
})
}

private static readonly URL = `${process.env.REACT_APP_SERVICE_HOST}:${process.env.REACT_APP_SERVICE_PORT}/ctype`
private static readonly URL = `${process.env.REACT_APP_SERVICE_HOST}/ctype`
}

export default CTypeRepository
2 changes: 1 addition & 1 deletion src/services/DidService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import ContactRepository from './ContactRepository'
import MessageRepository from './MessageRepository'

class DidService {
public static readonly URL = `${process.env.REACT_APP_SERVICE_HOST}:${process.env.REACT_APP_SERVICE_PORT}/contacts/did`
public static readonly URL = `${process.env.REACT_APP_SERVICE_HOST}/contacts/did`

public static async resolveDid(
identifier: string
Expand Down
2 changes: 1 addition & 1 deletion src/services/MessageRepository.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface IMessageOutput extends sdk.IMessage {
// (for other tests)

class MessageRepository {
public static readonly URL = `${process.env.REACT_APP_SERVICE_HOST}:${process.env.REACT_APP_SERVICE_PORT}/messaging`
public static readonly URL = `${process.env.REACT_APP_SERVICE_HOST}/messaging`

/**
* takes contact or list of contacts
Expand Down