Skip to content

Commit

Permalink
Merge pull request #4 from SubstraFoundation/dev
Browse files Browse the repository at this point in the history
0.0.10
  • Loading branch information
GuillaumeCisco authored Nov 5, 2019
2 parents 538589b + fe77a5c commit 0241594
Show file tree
Hide file tree
Showing 136 changed files with 5,518 additions and 4,554 deletions.
18 changes: 0 additions & 18 deletions .cicd/agent-build.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions .cicd/agent-test.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ build
.dockerignore
Dockerfile
docker-compose*.yml
skaffold.yaml

# NPM dependencies
node_modules/
Expand All @@ -21,6 +22,7 @@ package-lock.json
# Other
.cicd/
coverage/
charts/
test/
tools/
.csslintrc
Expand Down
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
API_URL=http://owkin.substrabac:8000
API_URL=http://substra-backend.owkin.xyz:8000

REDIS_HOST=redis
REDIS_PORT=6379
Expand Down
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# the repo. Unless a later match takes precedence,
# @global-owner1 and @global-owner2 will be requested for
# review when someone opens a pull request.
* @camillemarini @GuillaumeCisco
* @GuillaumeCisco @jmorel
3 changes: 0 additions & 3 deletions .npmrc

This file was deleted.

40 changes: 40 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
language: node_js

node_js:
- lts/*

branches:
only:
- master
- dev

cache: yarn

addons:
snaps:
- name: helm
confinement: classic
channel: stable

before_script:
- helm init --client-only

script:
- helm lint charts/substra-frontend
- yarn eslint
- yarn test
- yarn build:main

after_script:
- 'if ! git diff --quiet --exit-code $TRAVIS_COMMIT_RANGE charts; then CHART_CHANGED="true"; else CHART_CHANGED="false"; fi'
- 'if [ "$CHART_CHANGED" == "true" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then helm dep update charts/substra-frontend; fi'
- 'if [ "$CHART_CHANGED" == "true" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then helm package charts/substra-frontend; fi'
- 'if [ "$CHART_CHANGED" == "true" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then git config --global user.email "[email protected]"; fi'
- 'if [ "$CHART_CHANGED" == "true" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then git config --global user.name "Travis CI"; fi'
- 'if [ "$CHART_CHANGED" == "true" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then git clone https://${GH_TOKEN}@github.com/SubstraFoundation/charts.git substra-charts; fi'
- 'if [ "$CHART_CHANGED" == "true" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then mv substra-frontend-* substra-charts/; fi'
- 'if [ "$CHART_CHANGED" == "true" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then cd substra-charts; fi'
- 'if [ "$CHART_CHANGED" == "true" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then helm repo index .; fi'
- 'if [ "$CHART_CHANGED" == "true" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then git add .; fi'
- 'if [ "$CHART_CHANGED" == "true" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then git commit --message "Travis build: $TRAVIS_BUILD_NUMBER"; fi'
- 'if [ "$CHART_CHANGED" == "true" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then git push --quiet --set-upstream origin master; fi'
2 changes: 0 additions & 2 deletions .yarnrc

This file was deleted.

11 changes: 5 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FROM node:alpine AS build

RUN apk add python2 make g++

WORKDIR /workspace

COPY package-build.json /workspace/package.json
COPY package.json /workspace/package.json
COPY packages/ssr /workspace/packages/ssr
COPY packages/base /workspace/packages/base
COPY packages/plugins /workspace/packages/plugins
COPY .npmrc .npmrc
COPY .yarnrc .yarnrc

RUN yarn config list
RUN yarn install
Expand All @@ -23,9 +23,8 @@ FROM node:alpine

WORKDIR /workspace

COPY --from=build /workspace/packages/ssr/package.json /workspace/package.json
COPY .npmrc .npmrc
COPY .yarnrc .yarnrc
COPY --from=build /workspace/package.json /workspace/package.json
COPY --from=build /workspace/packages/ssr /workspace/packages/ssr

RUN yarn install

Expand Down
64 changes: 0 additions & 64 deletions Jenkinsfile

This file was deleted.

52 changes: 25 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SubstraFront
# Substra Frontend

## Installation

Expand All @@ -7,14 +7,6 @@ This project use yarn and the experimental yarn workspaces for package.json spli
Please install the last version of yarn and run:<br/>
`yarn config set workspaces-experimental true`

Configure yarn/npm to use our private registry (use the credentials that we provided to you):

```bash
npm config set registry https://substra-npm.owkin.com
npm login
npm config set always-auth true
```

Then run:<br/>
`yarn install`

Expand All @@ -28,6 +20,7 @@ And make sure the redis server is running by executing:<br/>

For testing and developing on the projet with true hot module replacement, run
`yarn start`
Then head to `http://substra-frontend.owkin.xyz:3000/` `substra-backend.owkin.xyz` is important for working with same site cookie policy

For testing with prod config:<br/>
`yarn start:prod`
Expand Down Expand Up @@ -57,46 +50,50 @@ https://docs.aws.amazon.com/AmazonElastiCache/latest/UserGuide/GettingStarted.Co
Then run `flushall`. You should automatize this part.
More information in the cache part below.

## Building the docker container

You'll need to update the `.npmrc` file in this repository with your credentials for the private substra npm registry.
## Docker launch

Assuming the auth token for the registry is in the `VERDACCIO_TOKEN` env variable, you can do:
The `docker-compose.yaml` file will launch substra-frontend and redis docker instances.
substra-frontend will be launch with prod settings, which is a bit different from the settings.
Launch it with:
```bash
$> docker-compose up -d --force-recreate
```

If you want to update the docker images, execute:
```bash
echo "//substra-npm.owkin.com/:_authToken=\"${VERDACCIO_TOKEN}\"" >> .npmrc
```
$> docker-compose up -d --force-recreate --build
```

If your substra-backend instance use basicauth settings, you need to pass the `BACK_AUTH_USER` and `BACK_AUTH_PASSWORD` variables to your current environment for not triggering 403 responses.


Alternatively, you can `npm login` into our private repository and copy/paste the credentials from `~/.npmrc` in the local `.npmrc`.
## Substra-UI

This project depends on [https://github.com/SubstraFoundation/substra-ui](substra-ui) for some of its components.

Normal install relies on a private npm registry (see the [installation instructions](#Installation)).
If you need to add/move a component to substra-ui and need to test its integration within
substrafront, you'll need to "link" substra-ui:
If you need to add/move a component to substra-ui and need to test its integration within
substra-frontend, you'll need to "link" substra-ui:

In the substra-ui directory:

```sh
yarn link
```

In the substrafront directory:
In the substra-frontend directory:

```sh
yarn link @substrafoundation/substra-ui
```

Your local built version of substra-ui will be the one used by your
local substrafront. In order to automatically rebuild substra-ui at each
Your local built version of substra-ui will be the one used by your
local substra-frontend. In order to automatically rebuild substra-ui at each
change, do:

In the substra-ui directory:

```sh
yarn build --watch
```
```

## Generate static for github pages

Expand Down Expand Up @@ -130,12 +127,13 @@ Don't forget to create a isolated security group for opening port 6379 as descri
### test
For testing your generated docker with your localhosted redis, update your `deploy.js` file and do not forget to comment the part that push to your registry, then:
```shell
$> redis-cli flushall && docker run -it -v /etc/letsencrypt/:/etc/letsencrypt/ --net="host" -p 8000:8000 docker_image_name:latest
$> redis-cli flushall && docker run -it -v /etc/letsencrypt/:/etc/letsencrypt/ --net="host" -p 8000:3000 docker_image_name:latest
```

You'll notice I also bind the let's encrypt folder, more information in the next part.

Then head to https://localhost:8001/
Then head to `https://substra-backend.owkin.xyz:3000/`
:warning: Be sure to use `substra-backend.owkin.xyz` and not `localhost` or `127.0.0.1` for being able to work with cookies.

Do not forget to `redis-cli flushall` when testing multiple times.

Expand Down Expand Up @@ -184,4 +182,4 @@ In order to debug your code within a JetBrains editor you'll need to:

This will open a new browser window that will respond to your breakpoints.

*Taken from https://blog.jetbrains.com/webstorm/2017/01/debugging-react-apps/*
*Taken from https://blog.jetbrains.com/webstorm/2017/01/debugging-react-apps/*
2 changes: 2 additions & 0 deletions assets/css/variables/colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export const
tealish = '#1dbcc0',
darkSkyBlue = '#4ba5d2',
iceBlueTwo = '#edf6fa',
red = '#ed1111',
iceRed = '#fde7e7',
// accent colors
primaryAccent = tealish,
secondaryAccent = gold,
Expand Down
Binary file removed assets/img/owkestra/launcher-icon-0-75x.png
Binary file not shown.
Binary file removed assets/img/owkestra/launcher-icon-1-5x.png
Binary file not shown.
Binary file removed assets/img/owkestra/launcher-icon-1x.png
Binary file not shown.
Binary file removed assets/img/owkestra/launcher-icon-2x.png
Binary file not shown.
Binary file removed assets/img/owkestra/launcher-icon-3x.png
Binary file not shown.
Binary file removed assets/img/owkestra/launcher-icon-4x.png
Binary file not shown.
Binary file removed assets/img/owkestra/launcher-icon-high-res.png
Binary file not shown.
1 change: 1 addition & 0 deletions charts/substra-frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
charts/
1 change: 1 addition & 0 deletions charts/substra-frontend/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.git
11 changes: 11 additions & 0 deletions charts/substra-frontend/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
name: substra-frontend
home: https://substra.org/
version: 1.0.0-alpha.2
description: Main package for Substra Frontend
icon: https://avatars1.githubusercontent.com/u/38098422?s=200&v=4
sources:
- https://github.com/SubstraFoudation/substra-frontend
maintainers:
- name: ClementGautier
email: [email protected]
22 changes: 22 additions & 0 deletions charts/substra-frontend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Main deployment package of Substra

## Requirements

Having a Kubernetes cluster working with Helm initialized. You can do thant locally by installing Minikube and grabbing Helm binary from github.
Then simply launch your cluster using `minikube start` and configure helm with `helm init`.

You will also need the Hyperledger Fabric network setup on the cluster.
Look at the corresponding chart for that (chart-hlf-k8s)

You will also need a postgresql instance on the cluster, it should already be the case if you install the network first.

## Install the package
```
helm install --name hlf-k8s substra/hlf-k8s
helm install --name substra substra/substra-frontend
```

### Cleanup
```
helm delete --purge hlf-k8s substra-frontend
```
6 changes: 6 additions & 0 deletions charts/substra-frontend/requirements.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: redis
repository: https://kubernetes-charts.storage.googleapis.com/
version: 9.0.3
digest: sha256:55cd2d57453d98712914fc1ad11fdc82ba33f72e74d5c30bc07597fc7a68ac36
generated: "2019-09-05T11:09:08.807104606+02:00"
5 changes: 5 additions & 0 deletions charts/substra-frontend/requirements.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
dependencies:
- name: redis
repository: https://kubernetes-charts.storage.googleapis.com/
version: ~9.0.1
condition: redis.enabled
16 changes: 16 additions & 0 deletions charts/substra-frontend/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "substra-frontend.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "substra-frontend.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
Loading

0 comments on commit 0241594

Please sign in to comment.