Skip to content

Commit

Permalink
Merging develop to master (#10)
Browse files Browse the repository at this point in the history
* Add artifacts view, fix console rendering

* Add spinning icon to build button to indicate long running tasks

* Adding helm chart, still certs to be finished

* Updating config

* Temporarely updated plugin url to point to staging

* Updating cerfiticates and issuers

* Updating plugin dockerfile

* Add circle ci config

* add +x to build.sh

* Finished updating certificates

* Removing access token for digital ocean

* Fixing tags and ports

* change default nginx port

* Changes to run locally

* add alert component

* cargo-contract service.js tested with Mocha framework

* added tests for contract manager

* All tests done except asserts for cargoContractManager.build

* Tested whole backend flow

* Reverted all config values

* added pictures for readme update

* Update README.md

* Update README.md

* Adding CD to cluster (#9)

* Adding first instance of helm publish config

* Fixing typo in config

* Removing parameters

* Adding permissions to scripts for cluster

* Adding deploy script

* Updating build workflow

* Updating config

* Removing circleci config

* Adding debug option

* Adding branch extraction

* Adding branch extraction

* Updating workflow

* Reducing jobs

* Updating build

* Removing uses

* Removing typo

* Adding checkout

* Fixing typo

* Changing chart name

* Updating chart path

* Changing helm path

* Updating namespace config

* Adding hook to automatic deployment

* Adding permissions to deploy file

* Adding environments to json

* Updating imagePullPolicy

* Moving cert to chart

* WIP: Adding stress testing

* Feature kubernetes ci (#11)

* Adding first instance of helm publish config

* Fixing typo in config

* Removing parameters

* Adding permissions to scripts for cluster

* Adding deploy script

* Updating build workflow

* Updating config

* Removing circleci config

* Adding debug option

* Adding branch extraction

* Adding branch extraction

* Updating workflow

* Reducing jobs

* Updating build

* Removing uses

* Removing typo

* Adding checkout

* Fixing typo

* Changing chart name

* Updating chart path

* Changing helm path

* Updating namespace config

* Adding hook to automatic deployment

* Adding permissions to deploy file

* Adding environments to json

* Updating imagePullPolicy

* Moving cert to chart

* WIP: Adding stress testing

* Adding basic stress testing to script

* Removing venv

Co-authored-by: Darko Macesic <[email protected]>
Co-authored-by: Jakov Buratovic <[email protected]>
  • Loading branch information
3 people authored Dec 27, 2019
1 parent 22d2610 commit 46b6113
Show file tree
Hide file tree
Showing 95 changed files with 2,240 additions and 236 deletions.
65 changes: 65 additions & 0 deletions .github/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Canary release using track=canary. Release a few pods that will be served by
# the stable chart service.
# canary:
# production_environment: true
# required_contexts: ["build"]
# environment: production
# description: 'Canary'
# payload:
# value_files: ["./config/production.yml", "./config/_common.yml"]
# release: production-ink
# namespace: ink
# track: canary
# values:
# replicaCount: 1

# Deployment to a production environment is kicked off manually. This actually
# runs two deployment, one is to remove the canary pods if it exists and the
# other deploys to production.
production:
production_environment: true
required_contexts: ["build"]
environment: production
description: 'Production'
payload:
value_files: ["./config/production.yml", "./config/_common.yml"]
# Remove the canary deployment if it exists when doing a full prod deploy.
remove_canary: true
release: production-ink
namespace: ink
track: stable
values:
replicaCount: 1

# Automatic deployment to a staging environment on every push to master.
staging:
auto_deploy_on: refs/heads/master
required_contexts: ["build"]
environment: staging
description: 'Staging'
payload:
value_files: ["./config/staging.yml", "./config/_common.yml"]
release: staging-ink
namespace: ink
track: stable
values:
replicaCount: 1

# # Review environments can be triggered with /deploy review inside a pull
# # request.
# review:
# # Set the transient environment flag to let GitHub and deliverybot know that
# # this environment should be destroyed when the PR is closed.
# transient_environment: true
# production_environment: false
# required_contexts: ["build"]

# environment: pr${{ pr }}
# description: 'Review'
# payload:
# value_files: ["./config/review.yml", "./config/_common.yml"]
# release: review-myapp-${{ pr }}
# namespace: example-helm
# track: stable
# values:
# replicaCount: 1
16 changes: 16 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: 'Push'
on: ['push']

jobs:
build:
runs-on: 'ubuntu-latest'
steps:
- uses: 'actions/checkout@v1'
- name: 'Run build scripts'
run: 'CIRCLE_BRANCH=${GITHUB_REF##*/} scripts/build.sh'
env:
DOCKER_USER: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASS: ${{ secrets.DOCKER_PASSWORD }}
- name: 'Trigger deployment'
run: scripts/deploy.sh

21 changes: 21 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

name: 'Deploy'
on: ['deployment']

jobs:
deployment:
runs-on: 'ubuntu-latest'
steps:
- name: 'Checkout'
uses: 'actions/checkout@v1'
- name: 'Deploy'
# Parameters are pulled directly from the GitHub deployment event so the
# configuration for the job here is very minimal.
uses: 'deliverybot/helm@master'
with:
token: '${{ github.token }}'
secrets: '${{ toJSON(secrets) }}'
version: '${{ github.sha }}'
chart: 'kubernetes/ink-network'
env:
KUBECONFIG_FILE: '${{ secrets.KUBECONFIG }}'
27 changes: 0 additions & 27 deletions .github/workflows/ci.yml

This file was deleted.

22 changes: 22 additions & 0 deletions .github/workflows/pr-cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: PRCleanup
on:
pull_request:
types: [closed]

jobs:
deployment:
runs-on: 'ubuntu-latest'
steps:
- name: 'Deploy'
uses: 'deliverybot/helm@v1'
with:
# Task remove means to remove the helm release.
task: 'remove'
release: 'review-ink-${{ github.event.pull_request.number }}'
version: '${{ github.sha }}'
track: 'stable'
chart: 'ink'
namespace: 'ink'
token: '${{ github.token }}'
env:
KUBECONFIG_FILE: '${{ secrets.KUBECONFIG }}'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea
.vscode
node_modules
**/storage
33 changes: 22 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,48 @@ For more info on the ink! join us on [chat](https://riot.im/app/#/room/#ink:matr

## How to use

Go to [Remix](https://remix-alpha.ethereum.org/) then to Plugin manager.
Go to [Remix alpha](https://remix-alpha.ethereum.org/), or [Remix](https://remix.ethereum.org/) and then to *Plugin manager*.

Then in the plugin manager click on Connect to a Local Plugin.
Then in the plugin manager click on *Connect to a Local Plugin*.

![plugin-manager](static/plugin_manager.png)

You can set Plugin Name and Display Name to any string.
Url is: <https://develop.ink-remix.blockchain-it.hr>
You can set *Plugin Name* and *Display Name* to any string.
Url is:
* <https://develop.ink-remix.blockchain-it.hr> for development
* <https://develop.ink-remix.blockchain-it.hr> for staging
Click ok.

![load_plugin](static/load_plugin.png)

You should have now clean loaded ink.
You should have now clean loaded ink.
Accept any permissions that Remix is asking of you.

Next step is to create a project.
Input project/contract name and click on Create project.

![ink_clean](static/ink_clean.png)

Next step is to create a project.
Input *project/contract name* and click on *Create project*.

![project_created](static/project_created.png)

There will be a couple of permission screens, accept them all. :)

![permissions](static/permissions.png)

Next click on Testing. It will open a screen like on the next image.
Next click on *Testing*. It will open a screen like on the next image.

![ink_remix_plugin](static/building.png)

Click on the build button. As building progresses you will see logs from the backend building logs in real-time.
Click on the build button. As building progresses you will see logs from the backend building logs in real-time.

Your log should look something like this after a successful build.

![finished_output](static/finished_output.png)

Congratulations you’ve managed to create and build your first ink! project. :)
Now, you can select tab *ARTIFACTS* above output window which will give you the option to download generated *testing.wasm* and *metadata.json* files using buttons on the right side.

Congratulations you’ve managed to create and build your first ink! project. :)
![artifacts](static/artifacts.png)

Feel free to change the project and update the code and build it again, create a new project or anything else.

Expand Down
7 changes: 7 additions & 0 deletions config/_common.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
secrets:
- name: API_KEY
value: '${{ secrets.API_KEY }}'

# Example image pull secrets:
# imagePullSecrets:
# - name: regcred
3 changes: 3 additions & 0 deletions config/production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
env:
- name: ENVIRONMENT
value: production
3 changes: 3 additions & 0 deletions config/staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
env:
- name: ENVIRONMENT
value: staging
42 changes: 21 additions & 21 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
version: "3"
services:
plugin:
container_name: plugin
build:
context: ./plugin
dockerfile: Dockerfile
ports:
- "3000:3000"
networks:
- ink-remix-dev
server:
container_name: server
build:
context: ./server
dockerfile: Dockerfile
ports:
- "65520:65520"
networks:
- ink-remix-dev
volumes:
- ./storage:/usr/src/app/storage
plugin:
container_name: plugin
build:
context: ./plugin
dockerfile: Dockerfile
ports:
- "3000:3000"
networks:
- ink-network
server:
container_name: server
build:
context: ./server
dockerfile: Dockerfile
ports:
- "65520:65520"
networks:
- ink-network
volumes:
- ./storage:/usr/src/app/storage
networks:
ink-remix-dev:
ink-network:
83 changes: 83 additions & 0 deletions kubernetes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
## Flow of the process

### Prerequisites

* Minikube or your GKE/AKS/EKS cluster
* Helm (https://helm.sh/docs/intro/install/)
* Tiller

### Configure default values

Update values in values.yaml file to your requirements (can be used as is)

#### Running in minikube

Start minikube with default values.

```bash
minkube start
```

Once it's finished you can proceed to next step.

### Running in any kubernetes provider

#### Run helm and install the chart

```bash
helm install --namespace ink --name ink .
```

Once it finishes you can open dashboard on your cloud provider or with minikube use:

```bash
minikube dashboard &
```

#### Upgrade

```bash
helm upgrade ink .
```

#### Delete

If you want to delete just run

```bash
helm del --purge ink
```

#### Troubleshooting

If you are missing Tiller just run:

```bash
helm init
```

Hacky solution for tiller problems:

```bash
kubectl --namespace kube-system create serviceaccount tiller

kubectl create clusterrolebinding tiller-cluster-rule \
--clusterrole=cluster-admin --serviceaccount=kube-system:tiller

kubectl --namespace kube-system patch deploy tiller-deploy \
-p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'
```

https://github.com/helm/helm/issues/3130

### Installing Ingress

```bash
helm install stable/nginx-ingress --namespace ink --name ink-ingress --set controller.replicaCount=2 --set rbac.create=true
```

#### Apply the rules

```bash
kubectl apply -f ingress-rules.yaml
```
23 changes: 23 additions & 0 deletions kubernetes/cert/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
generated_config/
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
Loading

0 comments on commit 46b6113

Please sign in to comment.