Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 6 additions & 6 deletions .github/workflows/client_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: arm64
#-
# name: Set up QEMU
# uses: docker/setup-qemu-action@v2
# with:
# platforms: arm64

-
name: Set up Docker Buildx
Expand All @@ -35,7 +35,7 @@ jobs:
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
#platforms: linux/amd64,linux/arm64
push: true
file: command/docker/client/client.Dockerfile
cache-from: type=gha
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/client_build_arm64.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: fornet arm64 client build
# run at self-hosted mac min M2
# But it does not success for SSL timeout. we may try other methods to do this
on:
workflow_dispatch:
inputs:
Expand Down Expand Up @@ -35,7 +36,7 @@ jobs:
file: command/docker/client/client.Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ env.REGISTRY }}/fornetcode/fornet:${{github.event.inputs.version}}, ${{ env.REGISTRY }}/fornetcode/fornet:latest
tags: ${{ env.REGISTRY }}/fornetcode/fornet:${{github.event.inputs.version}}
- name: copy binary from docker to release directory
run: |
mkdir -p release
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/client_mac_arm64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: fornet arm64 client build
# run at self-hosted mac min M2
on:
workflow_dispatch:
inputs:
version:
required: true
description: "version to release"
env:
REGISTRY: ghcr.io
jobs:
mac_arm64:
strategy:
max-parallel: 1
fail-fast: true
matrix:
settings:
- host: self-hosted
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@v1
with:
toolchain: stable
target: ${{ matrix.settings.target }}
profile: minimal
- name: Set up cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
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/*
if-no-files-found: error
8 changes: 8 additions & 0 deletions .github/workflows/server_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true

- uses: coursier/cache-action@v6
- uses: coursier/setup-action@v1
with:
Expand Down Expand Up @@ -44,3 +47,8 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ env.REGISTRY }}/fornetcode/fornet-backend:${{github.event.inputs.version}}
- name: Upload jar to artifact
uses: actions/upload-artifact@v2
with:
path: release/*
if-no-files-found: error
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ release-mac-x86_64:
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

# brew install cmake wget
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/
Expand Down Expand Up @@ -51,4 +52,6 @@ release-backend:
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 ../
mkdir release
cp backend/target/universal/app-*.zip release/
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 admin-web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "admin-web",
"version": "0.0.3",
"version": "0.0.4",
"private": true,
"dependencies": {
"@reduxjs/toolkit": "^1.8.6",
Expand Down
2 changes: 1 addition & 1 deletion backend/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ lazy val webSugar = RootProject(file("../third/web-sugar"))
lazy val app = project
.in(file("."))
.settings(
version := "0.0.3",
version := "0.0.4",
scalaVersion := scala3Version,
libraryDependencies ++=
Seq(
Expand Down
4 changes: 2 additions & 2 deletions client/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/bin/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fornet"
version = "0.0.3"
version = "0.0.4"
edition = "2021"

[[bin]]
Expand Down
2 changes: 1 addition & 1 deletion client/lib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fornet-lib"
version = "0.0.3"
version = "0.0.4"
edition = "2021"

# For test
Expand Down
2 changes: 1 addition & 1 deletion command/docker-compose/simple/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: "3"
services:

mqtt:
image: rmqtt/rmqtt:0.2.11
image: rmqtt/rmqtt:latest
container_name: mqtt
ports:
- 1883:1883
Expand Down
7 changes: 3 additions & 4 deletions command/docker/client/client.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ARG BASE_IMAGE=rust:1.65
#ARG RUNTIME_IMAGE=alpine
ARG RUNTIME_IMAGE=rust:1.65

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

RUN apt update && apt install -y cmake bash

Expand All @@ -20,19 +20,18 @@ RUN apt update && apt install -y cmake bash
ADD protobuf /source/protobuf
ADD third /source/third
ADD client /source/client
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

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

ENV FORNET_CONFIG=/config

RUN mkdir /config && apt-get update && apt install -y iproute2
RUN mkdir /config && apt update && apt install -y iproute2

COPY --from=builder /source/client/target/release/fornet /usr/bin
COPY --from=builder /source/client/target/release/fornet-cli /usr/bin
Expand Down
Empty file modified command/docker/client/docker_build.sh
100644 → 100755
Empty file.
Empty file modified command/docker/client/script.sh
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion command/docker/mqtt/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

# 1883(mqtt) 6060(http) 5363(grpc)
# docker rm -f mqtt
docker run -d --name mqtt --network=host -v $(pwd)/log:/var/log/rmqtt -v $(pwd)/config/rmqtt.toml:/app/rmqtt/rmqtt.toml -v $(pwd)/config/plugin:/app/rmqtt/plugin rmqtt/rmqtt:0.2.11
docker run -d --name mqtt --network=host -v $(pwd)/log:/var/log/rmqtt -v $(pwd)/config/rmqtt.toml:/app/rmqtt/rmqtt.toml -v $(pwd)/config/plugin:/app/rmqtt/plugin rmqtt/rmqtt:latest
# docker logs -f --tail 50 mqtt