Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
89903a9
fix cicd step 1
timzaak May 12, 2023
fb1ce2a
fix cicd step2
timzaak May 12, 2023
f0b8b70
fix cicd, step 3
timzaak May 12, 2023
bbadf20
fix cicd, step 4
timzaak May 12, 2023
ddb0071
fix cicd, step 5
timzaak May 12, 2023
152f19b
fix cicd, step 6
timzaak May 12, 2023
26a629d
fix cicd, step 7
timzaak May 12, 2023
b8496a1
fix cicd, step 8
timzaak May 12, 2023
be5ffc4
fix cicd, step 9
timzaak May 12, 2023
30b21e1
fix cicd, step 10
timzaak May 12, 2023
e75a7d6
fix cicd, step 11
timzaak May 12, 2023
5fbfaab
fix cicd, step 12
timzaak May 12, 2023
a6da240
fix cicd, step 13
timzaak May 12, 2023
803d14f
fix cicd, step 14
timzaak May 12, 2023
541686b
fix cicd, step 15
timzaak May 12, 2023
edf957b
fix cicd, step 16
timzaak May 12, 2023
b97460b
fix cicd, step 17
timzaak May 12, 2023
7b6d295
fix cicd, step 18
timzaak May 12, 2023
63ee472
fix cicd, step 18
timzaak May 12, 2023
c7b9b3b
fix cicd, step 19
timzaak May 13, 2023
991fee7
fix cicd, step 20
timzaak May 13, 2023
e2f48cd
fix cicd, step 21
timzaak May 13, 2023
c8be1f4
fix cicd, step 22
timzaak May 13, 2023
adc94a9
fix cicd, step 23
timzaak May 13, 2023
7fed227
fix cicd, step 23
timzaak May 13, 2023
3adb124
fix cicd, step 23
timzaak May 13, 2023
556292d
fix cicd, step 24
timzaak May 13, 2023
1edd310
fix cicd, step 25
timzaak May 13, 2023
cd8fd82
fix cicd, step 26
timzaak May 13, 2023
a969896
fix cicd, step 27
timzaak May 13, 2023
8d9fc0f
fix cicd, step 28
timzaak May 13, 2023
148b0c6
fix cicd, step 29
timzaak May 13, 2023
4843036
fix cicd, step 30
timzaak May 13, 2023
179ea3e
fix cicd, step 31
timzaak May 13, 2023
b4c0bb4
fix cicd, step 32
timzaak May 13, 2023
49b4500
fix cicd, step 32
timzaak May 13, 2023
93df238
fix cicd, step 33
timzaak May 13, 2023
9ee2c55
fix cicd, step 34
timzaak May 13, 2023
cc989be
fix cicd, step 34
timzaak May 13, 2023
2231aed
fix cicd, step 35
timzaak May 13, 2023
3c2fd85
fix cicd, step 36
timzaak May 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 26 additions & 22 deletions .github/workflows/client_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ on:
version:
required: true
description: "version to release"
branch:
default: main
description: "git branch"
env:
REGISTRY: ghcr.io
jobs:
Expand All @@ -17,7 +14,6 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
ref: ${{ github.event.inputs.branch }}
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
Expand All @@ -33,49 +29,57 @@ jobs:
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
#platforms: linux/amd64,linux/arm64
push: true
file: command/client/client.Dockerfile
file: command/docker/client/client.Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
tags: fornetcode/fornet:${{github.event.inputs.version}}
tags: ${{ env.REGISTRY }}/fornetcode/fornet:${{github.event.inputs.version}}
commandLine:
strategy:
max-parallel: 1
fail-fast: true
matrix:
settings:
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
build: make release-linux
- host: macos-latest
target: aarch64-apple-darwin
build: make release-mac-aarch_64
- host: macos-latest
target: x86_64-apple-darwin
build: make release-mac-x86_64
runs-on: ${{ matrix.settings.os }}
# - host: macos-latest # This needs aarch64 OpenSSL, will wait github action support MacOS M1(https://github.com/github/roadmap/issues/528), then run this.
# target: aarch64-apple-darwin
# build: make release-mac-aarch64
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install Rust
uses: actions-rs/toolchain@v2
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Cache cargo registry
uses: actions/cache@v2
with:
path: ~/.cargo/registry
key: ${{ matrix.settings.os }}-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v2
target: ${{ matrix.settings.target }}
profile: minimal
- name: Set up cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
path: ~/.cargo/git
key: ${{ matrix.settings.os }}-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
client/target/
key: ${{ matrix.settings.host }}-${{ matrix.settings.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ matrix.settings.host }}-cargo-${{ matrix.settings.target }}
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
- name: Build
run: ${{ matrix.settings.build }}

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
path: /release/*
path: release/*
if-no-files-found: error
14 changes: 5 additions & 9 deletions .github/workflows/server_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ on:
version:
required: true
description: "version to release"
branch:
default: main
description: "git branch"

env:
REGISTRY: ghcr.io
Expand All @@ -16,17 +13,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.branch }}
- uses: coursier/cache-action@v6
- uses: coursier/setup-action@v1
with:
jvm: temurin:1.17
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: lts
cache: 'npm'
node-version: 18
cache: 'npm'
cache-dependency-path: 'admin-web/package-lock.json'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
Expand All @@ -42,9 +38,9 @@ jobs:
name: build and push docker image
uses: docker/build-push-action@v2
with:
context: command/backend
context: command/docker/backend
#platforms: linux/amd64,linux/arm64
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: fornetcode/fornet-backend:${{github.event.inputs.version}}
tags: ${{ env.REGISTRY }}/fornetcode/fornet-backend:${{github.event.inputs.version}}
75 changes: 37 additions & 38 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,45 +1,44 @@
# This is for .github/workflows.
.PHONY: release-mac-x86_64, release-mac-aarch_64, release-linux, release-backend
.PHONY: release-mac-x86_64, release-mac-aarch64, release-linux, release-backend


release-mac-x86_64:
mkdir /protoc && cd /protoc && wget https://github.com/protocolbuffers/protobuf/releases/download/v21.9/protoc-21.9-osx.x86_64.zip && unzip protoc-21.9-osx.x86_64.zip && cp bin/* /usr/bin/
brew install cmake
mkdir -p release
cd client
cargo build --release
strip target/release/fornet
otool -L target/release/fornet
strip target/release/fornet-cli
otool -L target/release/fornet-cli
tar -C ./target/release/ -czvf ../release/fornet-mac-x86_64.tar.gz ./fornet ./fornet-cli
ls -lisah ../release/fornet-mac-x86_64.tar.gz
#base_dir := $(shell pwd)

release-mac-aarch_64:
mkdir /protoc && cd /protoc && wget https://github.com/protocolbuffers/protobuf/releases/download/v21.9/protoc-21.9-osx.aarch_64.zip && unzip protoc-21.9-osx.aarch_64.zip && cp bin/* /usr/bin/
brew install cmake
mkdir -p release
cd client
cargo build --release
strip target/release/fornet
otool -L target/release/fornet
strip target/release/fornet-cli
otool -L target/release/fornet-cli
tar -C ./target/release/ -czvf ../release/fornet-mac-aarch_64.tar.gz ./fornet ./fornet-cli
ls -lisah ../release/fornet-mac-aarch_64.tar.gz
#export PROTOC := $(shell pwd)/protoc/bin

release-linux:
mkdir /protoc && cd /protoc && wget https://github.com/protocolbuffers/protobuf/releases/download/v21.9/protoc-21.9-linux-$(uname -m).zip && unzip protoc-21.9-linux-$(uname -m).zip && cp bin/* /usr/bin/
apt-get install -y build-essential libssl-dev cmake
release-mac-x86_64:
mkdir protoc && cd protoc && wget https://github.com/protocolbuffers/protobuf/releases/download/v21.9/protoc-21.9-osx-x86_64.zip && unzip protoc-21.9-osx-x86_64.zip && sudo cp bin/protoc /usr/local/bin
cp -r protoc/include/* protobuf/
mkdir -p release
cd client
cargo build --release
strip target/release/fornet
strip target/release/fornet-cli
tar -C ./target/release/ -czvf ../release/fornet-linux-$(uname -m).tar.gz ./fornet ./fornet-cli
cd client && cargo build --release --target=x86_64-apple-darwin
strip client/target/x86_64-apple-darwin/release/fornet
otool -L client/target/x86_64-apple-darwin/release/fornet
strip client/target/x86_64-apple-darwin/release/fornet-cli
otool -L client/target/x86_64-apple-darwin/release/fornet-cli
tar -C client/target/x86_64-apple-darwin/release/ -czvf release/fornet-mac-x86_64.tar.gz ./fornet ./fornet-cli

release-mac-aarch64:
mkdir protoc && cd protoc && wget https://github.com/protocolbuffers/protobuf/releases/download/v21.9/protoc-21.9-osx-aarch_64.zip && unzip protoc-21.9-osx-aarch_64.zip && sudo cp bin/protoc /usr/local/bin
cp -r protoc/include/* protobuf/
mkdir -p release
cd client && cargo build --release --target=aarch64-apple-darwin
strip client/target/aarch64-apple-darwin/release/fornet
otool -L client/target/aarch64-apple-darwin/release/fornet
strip client/target/aarch64-apple-darwin/release/fornet-cli
otool -L client/target/aarch64-apple-darwin/release/fornet-cli
tar -C client/target/aarch64-apple-darwin/release/ -czvf release/fornet-mac-aarch64.tar.gz ./fornet ./fornet-cli

release-linux:
mkdir protoc && cd protoc && wget https://github.com/protocolbuffers/protobuf/releases/download/v21.9/protoc-21.9-linux-x86_64.zip && unzip protoc-21.9-linux-x86_64.zip && sudo cp bin/protoc /usr/bin
cp -r protoc/include/* protobuf/
sudo apt-get install -y build-essential libssl-dev cmake
mkdir release
cd client && cargo build --release --target=x86_64-unknown-linux-gnu
strip client/target/x86_64-unknown-linux-gnu/release/fornet
strip client/target/x86_64-unknown-linux-gnu/release/fornet-cli
tar -C client/target/x86_64-unknown-linux-gnu/release/ -czvf release/fornet-linux-x86_64.tar.gz ./fornet ./fornet-cli

release-backend:
cd admin-web && npm ci && npm run build:prod
cp -r /build/ ../command/docker/backend/web
cd ../backend && sbt universal:packageBin
cp ./target/universal/app-*.zip ../command/docker/backend/app.zip && cd ../command/docker/backend && unzip app.zip && rm app.zip && mv app-* app
cd admin-web && npm ci && npm run build:prod && cd ../
cp -r admin-web/build/ command/docker/backend/web
cd backend && sbt universal:packageBin && cd ../
cp backend/target/universal/app-*.zip command/docker/backend/app.zip && cd command/docker/backend && unzip app.zip && rm app.zip && mv app-* app
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ForNet is another Layer3 Virutal Private Network software, built on top of [Bori
currently, it's in `beta` stage, supports macOS and Linux, Windows is in blocked for tun driver sign.

## Document
To check out docs, visit [git page](https://fornetcode.github.io). There's also a [Roadmap](https://fornetcode.github.io/plan) to show you where the project go.
To check out docs, visit [git page](https://fornetcode.github.io/documentation). There's also a [Roadmap](https://fornetcode.github.io/documentation/plan) to show you where the project go.


## License
Expand Down
1 change: 1 addition & 0 deletions admin-web/.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
BROWSER=none
REACT_APP_BASE_API="/api"

# FAST_REFRESH=false # trigger this to force refresh less config. 来回改它可强制刷新样式配置
2 changes: 1 addition & 1 deletion admin-web/src/view/node/CreateNodePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function CreateNodePage() {
let {networkId} = useParams<{ networkId: string }>()
const [network, setNetwork] = useState<Network>()
const [form] = Form.useForm<CreateNode>()
const nodeType = Form.useWatch('nodeType', form);
Form.useWatch('nodeType', form);
const navi = useNavigate()
const intl = useIntl()
useEffect(() => {
Expand Down
3 changes: 2 additions & 1 deletion admin-web/src/view/node/NodeDetailPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {useParams} from "react-router-dom";
import {Button, Form, Input, InputNumber, message, Row, Col, Space} from "antd";
import {Button, Form, Input, InputNumber, message, Row, Col} from "antd";
import {useIntl} from "react-intl";
import {getNode, NodeType, Node, updateNode} from "../../api/nodeAPI";
import {enumToDesc} from "../../local/intl";
Expand Down Expand Up @@ -78,6 +78,7 @@ export default function NodeDetailPage() {
})

}
// eslint-disable-next-line
}, [networkId, nodeId])
if (!network) {
return <></>
Expand Down
17 changes: 9 additions & 8 deletions command/docker/client/client.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,26 @@ ARG BASE_IMAGE=rust:1.65
#ARG RUNTIME_IMAGE=alpine
ARG RUNTIME_IMAGE=rust:1.65

FROM ${BASE_IMAGE} AS builder
FROM --platform=$BUILDPLATFORM ${BASE_IMAGE} AS builder

RUN apt update && apt install -y cmake bash


RUN mkdir /protoc && cd /protoc && wget https://github.com/protocolbuffers/protobuf/releases/download/v21.9/protoc-21.9-linux-$(uname -m).zip && unzip protoc-21.9-linux-$(uname -m).zip && cp bin/* /usr/bin/
#RUN apt update && apt upgrade -y && apt install -y protobuf-compiler libprotobuf-dev
RUN apt update && apt install -y cmake

# Add our source code.
ADD protobuf /source/protobuf
RUN cp -r /protoc/include/* /source/protobuf/
ADD third /source/third
ADD client /source/client
# This is for windows, But must be in for cargo.
ADD win-tun-driver /source/win-tun-driver

ADD command/docker/client/script.sh /script.sh
RUN chmod +x /script.sh && /script.sh
#RUN ls -al && cd protobuf && ls -al && cd ../

RUN --mount=type=cache,target=/usr/local/cargo/registry \
cd /source/client && cargo build --release
cd /source/client && cargo build --release

FROM ${RUNTIME_IMAGE}
FROM --platform=$BUILDPLATFORM ${RUNTIME_IMAGE}

ENV FORNET_CONFIG=/config

Expand Down
1 change: 1 addition & 0 deletions command/docker/client/client.Dockerfile.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/app
/backend
/command
!/command/docker/client
/docs
/java_backend
/node_modules
Expand Down
15 changes: 15 additions & 0 deletions command/docker/client/script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

# this runs in Docker to build

mkdir /protoc && cd /protoc

architecture=$(uname -m)
if [ $architecture == aarch64 ];
then
architecture='aarch_64'
fi

wget https://github.com/protocolbuffers/protobuf/releases/download/v21.9/protoc-21.9-linux-$architecture.zip && unzip protoc-21.9-linux-$architecture.zip && cp bin/* /usr/bin/

cp -r /protoc/include/* /source/protobuf/