Skip to content

Commit dee3d77

Browse files
committed
Make Repo Public + Library on NPM
- sealer & voting-authority backend -> need bignumber.js as dev dependency due to web3js bug: web3/web3.js#3386 - remove all .npmrc files (no longer needed, @meck93/evote-crypto is a public npm package) - remove github.json and reading github config from most build scripts since it's no longer needed
1 parent c93b513 commit dee3d77

32 files changed

+11632
-6928
lines changed

.npmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,18 @@ sudo apt-get install jq
2626
sudo dnf install jq
2727
```
2828

29-
### Crypto Private Github Package
29+
### Github Packages & Github Config JSON (Important!)
3030

31-
Since the crypto library (evote-crypto) is a private npm package, you need to be logged in to the Github package registry in order to be able to download the package.
32-
`npm login --registry=https://npm.pkg.github.com`
31+
The pre-built docker images are hosted on Gitub Packages. Accessing the images is currently only possible when logged in to: `docker.pkg.github.com`.
32+
You will need a Github personal access token with `repo, package:read` permission. Unlock this in your Github account.
3333

34-
You will need a Github personal access token with `package:read, package:write` permission. Unlock this in your Github account.
35-
36-
#### Github Config JSON
37-
38-
Create a JSON file in the top-level folder (`/github.json`) which has the following structure, if it does not exist yet. Insert your credentials and personal information in there.
34+
Create a JSON file in the top-level folder (`/github.json`) which has the following structure, if it does not exist yet.
35+
Insert your credentials and personal information in there.
3936

4037
```json
4138
{
4239
"github": {
4340
"user": "",
44-
"email": "",
4541
"token": ""
4642
}
4743
}

contracts/.npmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

contracts/package-lock.json

Lines changed: 1001 additions & 741 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docker-prebuilt-up.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ GITHUB_TOKEN=$(cat $githubConfig | jq .github.token | tr -d \")
1212
GITHUB_USER=$(cat $githubConfig | jq .github.user | tr -d \")
1313

1414
# login into docker package registry
15+
# -> this is required even if the images are public (Github Packages Limitation)
1516
docker login docker.pkg.github.com --username $GITHUB_USER --password $GITHUB_TOKEN
1617

1718
# create docker network

docker-up.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ echo '##############################################'
88
echo
99

1010
if [[ $1 == '--build' ]]; then
11-
11+
1212
echo '> building docker containers'
1313
shouldBuild=1
1414
else
1515
echo '> using existing containers...'
16-
echo '> if you wish to build the docker containers, run:'
16+
echo '> if you wish to build the docker containers, run:'
1717
echo '> ./docker-up.sh --build'
1818
fi
1919

@@ -37,7 +37,7 @@ echo
3737
echo '> starting Blockchain Explorer Dashboard'
3838
./ethstats/docker-start.sh $shouldBuild
3939

40-
echo
40+
echo
4141
echo '-------------------------------------------------'
4242
echo '> Running Docker Containers'
4343
echo '-------------------------------------------------'

sealer/Dockerfile

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
FROM node:12-alpine as builder
22

3-
# variables used to perform npm-cli-login
4-
ARG GITHUB_TOKEN
5-
ARG GITHUB_USER
6-
ARG GITHUB_EMAIL
73
ARG SB_PORT
84
ARG SB_IP
95
ARG SF_PORT
@@ -36,13 +32,8 @@ WORKDIR /usr/src
3632
# install build dependencies
3733
RUN apk add --no-cache bash python make g++ gcc openssh-client git
3834

39-
# copy the backend folder
35+
# copy the backend folder and install the backend
4036
COPY ./backend ./backend
41-
42-
# install npm cli login to retrieve private package from github
43-
RUN npm install -g npm-cli-login
44-
RUN NPM_USER=${GITHUB_USER} NPM_PASS=${GITHUB_TOKEN} NPM_EMAIL=${GITHUB_EMAIL} NPM_REGISTRY=https://npm.pkg.github.com npm-cli-login
45-
4637
RUN cd ./backend && npm i
4738

4839
# copy the frontend folder and install the frontend

sealer/backend/.npmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

sealer/backend/Dockerfile

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,17 @@
11
FROM node:12-alpine as builder
22

3-
# variables used to perform npm-cli-login
4-
ARG GITHUB_TOKEN
5-
ARG GITHUB_USER
6-
ARG GITHUB_EMAIL
7-
83
# Create app directory
94
WORKDIR /usr/src/backend
105

116
# install build dependencies
127
RUN apk add --no-cache bash python make g++ gcc openssh-client git
138

14-
# copy package json
9+
# copy package json, .npmrc and install dependencies
1510
COPY package*.json ./
1611
COPY .npmrc ./
17-
18-
# install npm cli login to retrieve private package from github
19-
RUN npm install -g npm-cli-login
20-
RUN NPM_USER=${GITHUB_USER} NPM_PASS=${GITHUB_TOKEN} NPM_EMAIL=${GITHUB_EMAIL} NPM_REGISTRY=https://npm.pkg.github.com npm-cli-login
21-
2212
RUN npm install
23-
# If you are building your code for production
24-
# RUN npm ci --only=production
2513

26-
FROM node:12-alpine
14+
FROM node:12-alpine
2715

2816
# Create app directory
2917
WORKDIR /usr/src/backend

sealer/backend/dev.sh

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,6 @@ echo "The mode is: $mode"
2626
# - the config file with all IPs and ports
2727
###########################################
2828
globalConfig=$parentParentDir/system.json
29-
githubConfig=$parentParentDir/github.json
30-
31-
# check if the github config json exists -> if not we stop the process
32-
if [ ! -f "$githubConfig" ]; then
33-
echo "$githubConfig doesn't exist! Please create it!"
34-
exit
35-
fi
3629

3730
###########################################
3831
# Set Sealer Number
@@ -48,15 +41,15 @@ cp $parentParentDir/poa-blockchain/keys/sealer$sealerNr.pwd $dir/wallet/sealer.p
4841
###########################################
4942
# ENV variables
5043
###########################################
51-
# - Voting Authority Backend PORT (the port stays the same, in dev and prod mode)
44+
# - Voting Authority Backend PORT (the port stays the same, in dev and prod mode)
5245
VOTING_AUTH_BACKEND_PORT=$(cat $globalConfig | jq .services.voting_authority_backend.port)
5346
# - Voting Authority Backend IP (either 172.1.1.XXX or localhost)
5447
VOTING_AUTH_BACKEND_IP=$(cat $globalConfig | jq .services.voting_authority_backend.ip.$mode | tr -d \")
5548
# - Sealer Backend Port (the port stays the same, in dev and prod mode)
5649
SEALER_BACKEND_PORT=$(cat $globalConfig | jq .services.sealer_backend_$sealerNr.port)
5750
# - Sealer Backend IP (either 172.1.1.XXX or localhost)
5851
SEALER_BACKEND_IP=$(cat $globalConfig | jq .services.sealer_backend_$sealerNr.ip.$mode | tr -d \")
59-
# - Sealer Frontend Port (the port stays the same, in dev and prod mode)
52+
# - Sealer Frontend Port (the port stays the same, in dev and prod mode)
6053
SEALER_FRONTEND_PORT=$(cat $globalConfig | jq .services.sealer_frontend_$sealerNr.port)
6154
# - Sealer Frontend IP (either 172.1.1.XXX or localhost)
6255
SEALER_FRONTEND_IP=$(cat $globalConfig | jq .services.sealer_frontend_$sealerNr.ip.$mode | tr -d \")
@@ -66,10 +59,6 @@ PARITY_NODE_PORT=$(cat $globalConfig | jq .services.sealer_parity_1.port)
6659
PARITY_NODE_IP=$(cat $globalConfig | jq .services.sealer_parity_1.ip.$mode | tr -d \")
6760
# - Specify NODE_ENV
6861
NODE_ENV=$mode
69-
# - Specify the Github credentials
70-
GITHUB_TOKEN=$(cat $githubConfig | jq .github.token | tr -d \")
71-
GITHUB_EMAIL=$(cat $githubConfig | jq .github.email | tr -d \")
72-
GITHUB_USER=$(cat $githubConfig | jq .github.user | tr -d \")
7362

7463
###########################################
7564
# write ENV variables into .env
@@ -83,9 +72,6 @@ echo SEALER_FRONTEND_IP=${SEALER_FRONTEND_IP} >> $dir/.env
8372
echo PARITY_NODE_PORT=${PARITY_NODE_PORT} >> $dir/.env
8473
echo PARITY_NODE_IP=${PARITY_NODE_IP} >> $dir/.env
8574
echo NODE_ENV=${NODE_ENV} >> $dir/.env
86-
echo GITHUB_TOKEN=$GITHUB_TOKEN >> $dir/.env
87-
echo GITHUB_USER=$GITHUB_USER >> $dir/.env
88-
echo GITHUB_EMAIL=$GITHUB_EMAIL >> $dir/.env
8975

9076
###########################################
9177
# installing packages

0 commit comments

Comments
 (0)