More workflow updates

More workflow updates
Release-0.12.0
Shahana Farooqui 2 years ago
parent cd72a49beb
commit e6d4128d51

@ -1,26 +1,25 @@
.angular/
.circleci/
.git/
.github/
.settings/
.vscode/
frontend/
backend/
backup/
cookies/
coverage/
dist/
docker/
docs/
dockerfiles/
logs/
node_modules/
node_modules_old/
node_modules_prod/
node_modules_dev/
out-tsc/
product management/
screenshots/
src/
tmp/
typings/
.browserlistrc
_config.yml
.classpath
@ -34,7 +33,6 @@ _config.yml
.sass-cache
*.sublime-workspace
.vscode/*
angular.json
connect.lock
ECLDummyData.log
libpeerconnection.log
@ -49,5 +47,4 @@ RTL-Multi-Node-Conf-1.json
RTL-Config-for-BTC-Testing.json
testem.log
Thumbs.db
tsconfig.json
yarn-error.log

4
.github/README.md vendored

@ -57,7 +57,7 @@ To download from master (*not recommended*):
$ git clone https://github.com/Ride-The-Lightning/RTL.git
$ cd RTL
$ npm install
$ npm run buildapp
$ npm run buildfrontend
$ npm run buildbackend
$ npm prune --production
```
@ -68,7 +68,7 @@ $ git reset --hard HEAD
$ git clean -f -d
$ git pull
$ npm install
$ npm run buildapp
$ npm run buildfrontend
$ npm run buildbackend
$ npm prune --production
```

@ -33,7 +33,7 @@ To download from master (*not recommended*):
$ git clone https://github.com/Ride-The-Lightning/RTL.git
$ cd RTL
$ npm install
$ npm run buildapp
$ npm run buildfrontend
$ npm run buildbackend
$ npm prune --production
```
@ -45,7 +45,7 @@ $ git reset --hard HEAD
$ git clean -f -d
$ git pull
$ npm install
$ npm run buildapp
$ npm run buildfrontend
$ npm run buildbackend
$ npm prune --production
```

@ -29,7 +29,7 @@ To download from master (*not recommended*) follow the below instructions:
$ git clone https://github.com/Ride-The-Lightning/RTL.git
$ cd RTL
$ npm install
$ npm run buildapp
$ npm run buildfrontend
$ npm run buildbackend
$ npm prune --production
```
@ -40,7 +40,7 @@ $ git reset --hard HEAD
$ git clean -f -d
$ git pull
$ npm install
$ npm run buildapp
$ npm run buildfrontend
$ npm run buildbackend
$ npm prune --production
```

@ -16,31 +16,8 @@ on:
workflow_dispatch:
jobs:
prepare:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 16.x
- name: Cache node_modules
uses: actions/cache@v2
id: cache-npm-packages
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}
- name: Install NPM dependencies
if: steps.cache-npm-packages.outputs.cache-hit != 'true'
run: npm ci
build:
runs-on: ubuntu-latest
needs: prepare
steps:
- name: Checkout source code
uses: actions/checkout@v2
@ -61,19 +38,19 @@ jobs:
if: steps.cache-npm-packages.outputs.cache-hit != 'true'
run: npm ci
- name: Cache build
- name: Cache build frontend
uses: actions/cache@v2
id: cache-build-app
id: cache-build-frontend
with:
path: angular
key: ${{ runner.os }}-angular-${{ github.sha }}
path: frontend
key: ${{ runner.os }}-frontend-${{ github.sha }}
- name: Run build production application
run: npm run buildapp
run: npm run buildfrontend
- name: Cache build
- name: Cache build backend
uses: actions/cache@v2
id: cache-build-server
id: cache-build-backend
with:
path: backend
key: ${{ runner.os }}-backend-${{ github.sha }}
@ -85,35 +62,16 @@ jobs:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 16.x
- name: Cache prod node_modules
uses: actions/cache@v2
id: cache-npm-packages
with:
path: node_modules
key: ${{ runner.OS }}-prod-${{ hashFiles('**/package-lock.json') }}
- name: Install NPM dependencies
if: steps.cache-npm-packages.outputs.cache-hit != 'true'
run: npm ci --production
- name: Cache build
- name: Cache build frontend
uses: actions/cache@v2
id: cache-build-app
id: cache-build-frontend
with:
path: angular
key: ${{ runner.os }}-angular-${{ github.sha }}
path: frontend
key: ${{ runner.os }}-frontend-${{ github.sha }}
- name: Cache build
- name: Cache build backend
uses: actions/cache@v2
id: cache-build-server
id: cache-build-backend
with:
path: backend
key: ${{ runner.os }}-backend-${{ github.sha }}

4
.gitignore vendored

@ -1,6 +1,6 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/angular
/frontend
/dist
/tmp
/out-tsc
@ -64,5 +64,5 @@ ECLDummyData.log
_config.yml
.vscode/launch.json
RTL-Config-Docker.json
dockerfiles/RTL-Config-Docker-Test.json
dockerfiles/RTL-Config.json
dockerfiles/.env

@ -21,7 +21,7 @@
"builder": "@angular-devkit/build-angular:browser",
"options": {
"baseHref": "/rtl/",
"outputPath": "angular",
"outputPath": "frontend",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",

@ -1,4 +1,4 @@
# RTL Docker Dev Setup
# 1) RTL Docker Dev Setup
### This is not suitable for production deployments. ONLY FOR DEVELOPMENT.
@ -6,14 +6,16 @@ This `docker-compose` template launches `bitcoind`, `lnd` and `rtl` containers.
It is configured to run in **regtest** mode but can be modified to suit your needs.
### Notes
### 1.1) Notes
- `bitcoind` is built from an Ubuntu repository and should not be used in production.
- `lnd` will not sync to chain until Bitcoin regtest blocks are generated (see below).
- `rtl` image is from the Docker Hub repository but you can change this to your needs.
- Various ports and configs can be adjusted in the `.env` or `docker-compose.yml` files.
## How to run
It may take several minutes if containers need to be built. From the terminal in this folder:
## 1.2) How to run
It may take several minutes if containers need to be built.
1.2.1) From the terminal in this folder:
```
$ docker-compose up -d bitcoind
@ -21,18 +23,18 @@ $ bin/b-cli generate 101
$ docker-compose up -d lnd rtl
```
Check containers are up and running with:
1.2.2) Check containers are up and running with:
```
$ docker-compose ps
```
Use the cli tools to get responses from the containers:
1.2.3) Use the cli tools to get responses from the containers:
```
$ bin/ln-cli getinfo
$ bin/b-cli getblockchaininfo
```
View daemon logs as follows:
1.2.4) View daemon logs as follows:
```
$ docker-compose logs bitcoind lnd rtl
```
@ -46,19 +48,48 @@ When you are done you can destroy containers with:
```
$ docker-compose down -v
```
---
# 2) Stand alone RTL Setup
This is suitable when you already have a LND node running and configured.
# Stand alone RTL Setup
### This is suitable when you already have a LND node running and configured.
## 2.1) From docker image pull
```
RTL_VERSION=0.11.2
docker run --name rtl -d -it
RTL_VERSION=0.12.0
docker run --name rtl -d -it \
-e RTL_CONFIG_PATH=/RTLConfig \
-v /path/to/RTLConfig/dir:/RTLConfig \
-v /path/to/macaroon/dir:/path/as/specified/in/RTLConfig \
-v /path/to/database/dir:/RTL/database \
-p 3000:3000/tcp \
shahanafarooqui/rtl:${RTL_VERSION}
```
## 2.2) From local docker build
### 2.2.1) Build the image locally
```
RTL_VERSION=0.12.0
docker build -t rtl:${RTL_VERSION} -f dockerfiles/Dockerfile .
```
### 2.2.2) Create .env file
Create an environment file with your required configurations. Sample .env:
```
RTL_CONFIG_PATH=/RTLConfig
MACAROON_PATH=/LNDMacaroon
LN_SERVER_URL=https://host.docker.internal:8080
```
### 2.2.3) Run the newly built image with .env configurations
```
RTL_VERSION=0.12.0
docker run -d -it \
-v /path/to/RTLConfig/dir:/RTLConfig \
-v /path/to/macaroon/dir:/LNDMacaroon \
-v /path/to/database/dir:/RTL/database \
--env-file=.env -p 3000:3000 rtl:${RTL_VERSION}
```
Once the container is running you can access the RTL UI at http://localhost:3000
---
@hashamadeus on Twitter

@ -102,7 +102,7 @@ services:
rtl:
container_name: ${COMPOSE_PROJECT_NAME}_rtl
image: shahanafarooqui/rtl:0.11.2
image: shahanafarooqui/rtl:0.12.0
restart: unless-stopped
depends_on:
- lnd

@ -1,7 +1,7 @@
# ---------------
# Install Dependencies
# ---------------
FROM node:16-alpine as deps
FROM node:16-alpine as builder
WORKDIR /RTL
@ -13,14 +13,10 @@ RUN npm install
# ---------------
# Build App
# ---------------
FROM deps as build
WORKDIR /RTL
COPY . .
# Build the Angular application
RUN npm run buildapp
RUN npm run buildfrontend
# Build the Backend from typescript server
RUN npm run buildbackend
@ -31,16 +27,17 @@ RUN npm prune --production
# ---------------
# Release App
# ---------------
FROM node:16-alpine
FROM node:16-alpine as runner
WORKDIR /RTL
RUN apk add --no-cache tini
COPY --from=build /app/rtl.js ./rtl.js
COPY --from=build /app/angular ./angular
COPY --from=build /app/backend ./backend
COPY --from=build /app/node_modules/ ./node_modules
COPY --from=builder /RTL/rtl.js ./rtl.js
COPY --from=builder /RTL/package.json ./package.json
COPY --from=builder /RTL/frontend ./frontend
COPY --from=builder /RTL/backend ./backend
COPY --from=builder /RTL/node_modules/ ./node_modules
EXPOSE 3000

@ -1,7 +1,7 @@
# ---------------
# Install Dependencies
# ---------------
FROM node:16-stretch-slim as deps
FROM node:16-stretch-slim as builder
ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini-static-armel /tini
ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini-static-armel.asc /tini.asc
@ -17,14 +17,10 @@ RUN npm install
# ---------------
# Build App
# ---------------
FROM deps as build
WORKDIR /RTL
COPY . .
# Build the Angular application
RUN npm run buildapp
RUN npm run buildfrontend
# Build the Backend from typescript server
RUN npm run buildbackend
@ -35,15 +31,16 @@ RUN npm prune --production
# ---------------
# Release App
# ---------------
FROM arm32v7/node:16-stretch-slim
FROM arm32v7/node:16-stretch-slim as runner
WORKDIR /RTL
COPY --from=build /app/rtl.js ./rtl.js
COPY --from=build /app/angular ./angular
COPY --from=build /app/backend ./backend
COPY --from=build /app/node_modules/ ./node_modules
COPY --from=build "/tini" /sbin/tini
COPY --from=builder /RTL/rtl.js ./rtl.js
COPY --from=builder /RTL/package.json ./package.json
COPY --from=builder /RTL/frontend ./frontend
COPY --from=builder /RTL/backend ./backend
COPY --from=builder /RTL/node_modules/ ./node_modules
COPY --from=builder "/tini" /sbin/tini
EXPOSE 3000

@ -1,7 +1,7 @@
# ---------------
# Install Dependencies
# ---------------
FROM node:16-stretch-slim as deps
FROM node:16-stretch-slim as builder
ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini-static-arm64 /tini
RUN chmod +x /tini
@ -16,14 +16,10 @@ RUN npm install
# ---------------
# Build App
# ---------------
FROM deps as build
WORKDIR /RTL
COPY . .
# Build the Angular application
RUN npm run buildapp
RUN npm run buildfrontend
# Build the Backend from typescript server
RUN npm run buildbackend
@ -34,15 +30,16 @@ RUN npm prune --production
# ---------------
# Release App
# ---------------
FROM arm64v8/node:16-stretch-slim
FROM arm64v8/node:16-stretch-slim as runner
WORKDIR /RTL
COPY --from=build /app/rtl.js ./rtl.js
COPY --from=build /app/angular ./angular
COPY --from=build /app/backend ./backend
COPY --from=build /app/node_modules/ ./node_modules
COPY --from=build "/tini" /sbin/tini
COPY --from=builder /RTL/rtl.js ./rtl.js
COPY --from=builder /RTL/package.json ./package.json
COPY --from=builder /RTL/frontend ./frontend
COPY --from=builder /RTL/backend ./backend
COPY --from=builder /RTL/node_modules/ ./node_modules
COPY --from=builder "/tini" /sbin/tini
EXPOSE 3000

@ -6,8 +6,8 @@
"scripts": {
"ng": "ng",
"start": "ng serve --open",
"prebuildapp": "node src/prebuild",
"buildapp": "ng build --configuration production",
"prebuildfrontend": "node src/prebuild.cjs",
"buildfrontend": "ng build --configuration production",
"buildbackend": "tsc --project tsconfig.json",
"watchbackend": "tsc --project tsconfig.json --watch",
"server": "set NODE_ENV=development&&nodemon ./rtl.js",

@ -62,10 +62,10 @@ export class ExpressApplication {
this.app.use(this.common.baseHref + '/api/lnd', lndRoutes);
this.app.use(this.common.baseHref + '/api/cl', clRoutes);
this.app.use(this.common.baseHref + '/api/ecl', eclRoutes);
this.app.use(this.common.baseHref, express.static(join(this.directoryName, '../..', 'angular')));
this.app.use(this.common.baseHref, express.static(join(this.directoryName, '../..', 'frontend')));
this.app.use((req, res, next) => {
res.cookie('XSRF-TOKEN', req.csrfToken ? req.csrfToken() : '');
res.sendFile(join(this.directoryName, '../..', 'angular', 'index.html'));
res.sendFile(join(this.directoryName, '../..', 'frontend', 'index.html'));
});
this.app.use((err, req, res, next) => this.handleApplicationErrors(err, res));
}

@ -1,5 +1,3 @@
export const VERSION = '0.12.0-beta';
export const API_URL = './api';
export const environment = {
@ -27,3 +25,5 @@ export const environment = {
BOLTZ_API: '/boltz',
Web_SOCKET_API: '/ws'
};
export const VERSION = '0.12.0-beta';

@ -1,5 +1,3 @@
export const VERSION = '0.12.0-beta';
export const API_URL = 'http://localhost:3000/rtl/api';
export const environment = {
@ -27,3 +25,5 @@ export const environment = {
BOLTZ_API: '/boltz',
Web_SOCKET_API: '/ws'
};
export const VERSION = '0.12.0-beta';

@ -1 +0,0 @@
export const VERSION = '0.12.0-beta';

@ -0,0 +1,38 @@
var path = require('path');
var fs = require('fs');
var os = require('os');
module.exports = function () {
var packageJSON = JSON.parse(fs.readFileSync(path.join(__dirname, '../', 'package.json'), 'utf-8'));
var appVersion = packageJSON.version;
try {
console.log('\n\n=============================================');
console.log('Updating application version to ' + appVersion + '.');
console.log('=============================================');
var versionFilePath = path.join(__dirname + '/environments/environment.ts');
var versionProdFilePath = path.join(__dirname + '/environments/environment.prod.ts');
var versionStr = os.EOL + 'export const VERSION = \'' + appVersion + '\';' + os.EOL;
fs.appendFileSync(versionFilePath, versionStr);
fs.appendFileSync(versionProdFilePath, versionStr);
} catch (err) {
console.error(err);
}
try {
var commonFilePath = path.join(__dirname, "..", "server", "utils", "common.ts");
var commonFileData = fs.readFileSync(commonFilePath, 'utf-8');
var commonFileLined = commonFileData.split(os.EOL);
var foundDataLine = commonFileLined.find(function(lineItem) { return lineItem.includes('public read_dummy_data =') || lineItem.includes('public read_dummy_data=') || lineItem.includes('private read_dummy_data =') || lineItem.includes('private read_dummy_data=')});
var foundDataLineIndex = commonFileLined.findIndex(function(lineItem) { return lineItem.includes('public read_dummy_data =') || lineItem.includes('public read_dummy_data=') || lineItem.includes('private read_dummy_data =') || lineItem.includes('private read_dummy_data=')});
if (foundDataLine.includes('true')) {
commonFileLined[foundDataLineIndex] = ' public read_dummy_data = false;';
fs.writeFileSync(commonFilePath, commonFileLined.path.join(os.EOL), 'utf-8');
console.log('\n==============================================================================================');
console.log('WARNING: COMMON.TS HAS BEEN REWRITTEN TO UNSET THE DUMMY DATA FLAG. PLEASE RE-CHECK THE FILE.');
console.log('==============================================================================================\n');
}
} catch (err) {
console.error(err);
}
};

@ -1,38 +0,0 @@
import { join, dirname } from 'path';
import { fileURLToPath } from 'url';
import * as fs from 'fs';
import * as os from 'os';
export class Prebuild {
constructor() {
var directoryName = dirname(fileURLToPath(import.meta.url));
var packageJSON = JSON.parse(fs.readFileSync(join(directoryName, '../', 'package.json'), 'utf-8'));
var appVersion = packageJSON.version;
var versionFilePath = join(directoryName + '/environments/version.ts');
var versionStr = 'export const VERSION = \'' + appVersion + '\';' + os.EOL;
fs.writeFileSync(versionFilePath, versionStr, 'utf-8');
console.log('\n\n=============================================');
console.log('Updating application version to ' + appVersion + '.');
console.log('=============================================');
try {
var commonFilePath = join(directoryName, "..", "server", "utils", "common.ts");
var commonFileData = fs.readFileSync(commonFilePath, 'utf-8');
var commonFileLined = commonFileData.split(os.EOL);
var foundDataLine = commonFileLined.find(lineItem => lineItem.includes('public read_dummy_data =') || lineItem.includes('public read_dummy_data=') || lineItem.includes('private read_dummy_data =') || lineItem.includes('private read_dummy_data='));
var foundDataLineIndex = commonFileLined.findIndex(lineItem => lineItem.includes('public read_dummy_data =') || lineItem.includes('public read_dummy_data=') || lineItem.includes('private read_dummy_data =') || lineItem.includes('private read_dummy_data='));
if (foundDataLine.includes('true')) {
commonFileLined[foundDataLineIndex] = ' public read_dummy_data = false;';
fs.writeFileSync(commonFilePath, commonFileLined.join(os.EOL), 'utf-8');
console.log('\n==============================================================================================');
console.log('WARNING: COMMON.TS HAS BEEN REWRITTEN TO UNSET THE DUMMY DATA FLAG. PLEASE RE-CHECK THE FILE.');
console.log('==============================================================================================\n');
}
} catch (err) {
console.error(err);
}
}
};
export var prebuild = new Prebuild();

@ -3,7 +3,7 @@
"extends": "../tsconfig.json",
"compilerOptions": {
"baseUrl": "./",
"outDir": "../angular",
"outDir": "../frontend",
"types": ["node"],
"paths": {
"crypto": ["../node_modules/crypto-browserify"],

Loading…
Cancel
Save