Skip to content
This repository was archived by the owner on Apr 25, 2023. It is now read-only.

Commit 63ac589

Browse files
committed
read semux API from environment, simplified deployment issue#10
1 parent 7e5b7cd commit 63ac589

File tree

14 files changed

+882
-324
lines changed

14 files changed

+882
-324
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
node_modules
22
dist
3+
build
4+
start.sh
35

46
.vscode

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.PHONY: build
2+
build:
3+
@cd front && make build
4+
@cd server && make build
5+
@test -f start.sh || cp _start.sh start.sh && chmod 700 start.sh
6+
@echo
7+
@echo adjust ./start.sh and launch it
8+
@echo
9+
10+
.PHONY: clean
11+
clean:
12+
@cd front && make clean
13+
@cd server && make clean

README.md

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11

22
# Semux Light
33

4-
This is alpha stage, beta version comming soon.
5-
64
---
75

86
![semux-light](https://github.com/witoldsz/semux-light/raw/assets/semux-light-testnet.png)
97

108
## Try it yourself:
119

12-
- install [Node.js](https://nodejs.org/) (tested with 8.x LTS)
13-
- enable Semux API
10+
- You must have a Semux node running with API enabled
11+
12+
`semux/config/semux.properties`
1413
```
14+
[…]
1515
#================
1616
# API
1717
#================
@@ -26,34 +26,33 @@ This is alpha stage, beta version comming soon.
2626
# Basic authentication
2727
api.username = user
2828
api.password = 123456
29+
[…]
2930
3031
```
31-
- launch Semux 1.2.0, requires API 2.1.x or newer (my advice: always use separate installation for testnet only)
32-
- semux-testnet/semux-cli.sh --network testnet
33-
- or
34-
- semux-testnet/semux-gui.sh --network testnet
3532

36-
- build Semux Light
37-
- frontend/GUI
33+
- git clone and build Semux Light
3834
```
39-
$ cd semux-testnet/front
40-
$ make dist
35+
$ git clone https://github.com/witoldsz/semux-light.git
36+
$ cd semux-light
37+
$ make clean build
4138
```
42-
- server
39+
40+
- adjust ./start.sh and launch it
4341
```
44-
$ cd ../server
45-
$ cat src/main/settings.ts
46-
export const settings = {
47-
semuxApiService: {
48-
address: 'http://127.0.0.1:5171/v2.0.0',
49-
user: 'user',
50-
pass: '123456',
51-
},
52-
}
53-
54-
$ make deploy
55-
server listening: { address: '::', family: 'IPv6', port: 3333 }
42+
$ cat start.sh
43+
[…]
44+
export SEMUX_API_ADDR=http://127.0.0.1:5171
45+
export SEMUX_API_USER=user
46+
export SEMUX_API_USER=123456
47+
48+
export SEMUX_LIGHT_PORT=8080
49+
export SEMUX_LIGHT_BIND_IP=127.0.0.1
50+
[…]
51+
52+
$ ./start.sh
53+
node build/app.js
54+
server listening: { address: '127.0.0.1', family: 'IPv4', port: 8080 }
5655
5756
```
5857
59-
- open browser location: http://localhost:3333/#/home
58+
- open browser location: http://localhost:8080

_start.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
export SEMUX_API_ADDR=http://127.0.0.1:5171
4+
export SEMUX_API_USER=user
5+
export SEMUX_API_PASS=123456
6+
7+
export SEMUX_LIGHT_PORT=8080
8+
export SEMUX_LIGHT_BIND_IP=127.0.0.1
9+
10+
cd server && make deploy

front/Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
export PATH := node_modules/.bin:$(PATH)
22

3-
.PHONY: dist
4-
dist: dist/COMPILED dist/DOCROOT
3+
.PHONY: build
4+
build: build/COMPILED build/DOCROOT
55

66
.PHONY: clean
77
clean:
8-
rm -rf dist
8+
rm -rf dist build
99

1010
.PHONY: compile-watch
11-
compile-watch: dist/DOCROOT
11+
compile-watch: build/DOCROOT
1212
webpack --watch
1313

1414
node_modules/INSTALLED: package.json
1515
npm install
1616
touch $@
1717

18-
dist/COMPILED: node_modules/INSTALLED $(shell find src/main -type f)
18+
build/COMPILED: node_modules/INSTALLED $(shell find src/main -type f)
1919
tslint -p src -t codeFrame
2020
webpack
2121
touch $@
2222

23-
dist/DOCROOT: $(shell find src/docroot -type f)
24-
mkdir -p dist
25-
cp -rf src/docroot/* dist
23+
build/DOCROOT: $(shell find src/docroot -type f)
24+
mkdir -p build
25+
cp -rf src/docroot/* build
2626
touch $@

0 commit comments

Comments
 (0)