Skip to content

Commit

Permalink
add: ansible
Browse files Browse the repository at this point in the history
  • Loading branch information
ActivePeter committed Nov 29, 2023
1 parent a71e5d7 commit 952442b
Show file tree
Hide file tree
Showing 42 changed files with 465 additions and 387 deletions.
38 changes: 19 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
name: Rust
# name: Rust

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
# on:
# push:
# branches: [ "main" ]
# pull_request:
# branches: [ "main" ]

env:
CARGO_TERM_COLOR: always
# env:
# CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install WasmEdge
run: bash ./scripts/install_wasmedge.sh
- name: Install Protobuf
run: bash ./scripts/install_protobuf.sh
- name: Build
run: cargo build --verbose
# jobs:
# build:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Install WasmEdge
# run: bash ./scripts/install/install_wasmedge.sh
# - name: Install Protobuf
# run: bash ./scripts/install/install_protobuf.sh
# - name: Build
# run: cargo build --verbose
17 changes: 12 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Ansible
run: sudo apt install python3 python3-pip && bash scripts/install/install_ansible.sh
- name: Setup Ansible
run: bash scripts/deploy_single_node/1.ansible_setup.sh
- name: Ansible install all
run: ansible-playbook -vvv scripts/ans/ans_install_build.yml

- name: Build release
run: ansible-playbook -vvv scripts/ans/ans_build_release.yml

- name: Build WasmEdge Image
run: bash docker/WasmEdge/build_image.sh
- name: Install WasmEdge
run: bash ./scripts/install_wasmedge.sh
- name: Install Protobuf
run: bash ./scripts/install_protobuf.sh
- name: Build WasmServerless Image
run: bash docker/WasmServerless/build_image.sh

- name: CI
run: bash docker/ci.sh
run: bash scripts/deploy_single_node/ci.sh
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
target
target
docker.zip
1 change: 1 addition & 0 deletions RunnerGo
Submodule RunnerGo added at 443094
2 changes: 2 additions & 0 deletions docker/WasmServerless/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
apps
target
11 changes: 11 additions & 0 deletions docker/WasmServerless/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ LABEL description="Wasm serverless platform"
# RUN python3 /tmp/install/wasm_edge.py -v 0.13.3

COPY target/release/wasm_serverless /usr/local/bin/wasm_serverless
COPY apps/fn2/target/wasm32-wasi/release/fn2.wasm /etc/wasm_serverless/fn1.wasm
COPY apps/fn2/target/wasm32-wasi/release/fn2.wasm /etc/wasm_serverless/fn2.wasm
COPY apps/fn2/target/wasm32-wasi/release/fn2.wasm /etc/wasm_serverless/fn3.wasm
COPY apps/fn2/target/wasm32-wasi/release/fn2.wasm /etc/wasm_serverless/fn4.wasm
COPY apps/fn2/target/wasm32-wasi/release/fn2.wasm /etc/wasm_serverless/fn5.wasm
COPY apps/fn2/target/wasm32-wasi/release/fn2.wasm /etc/wasm_serverless/fn6.wasm
COPY apps/fn2/target/wasm32-wasi/release/fn2.wasm /etc/wasm_serverless/fn7.wasm
COPY apps/fn2/target/wasm32-wasi/release/fn2.wasm /etc/wasm_serverless/fn8.wasm
COPY apps/fn2/target/wasm32-wasi/release/fn2.wasm /etc/wasm_serverless/fn9.wasm
COPY apps/fn2/target/wasm32-wasi/release/fn2.wasm /etc/wasm_serverless/fn10.wasm

# COPY node_config.yaml /etc/wasm_serverless/node_config.yaml
COPY wasm_serverless_entrypoint.sh /etc/wasm_serverless/
RUN chmod +x /etc/wasm_serverless/wasm_serverless_entrypoint.sh
Expand Down
31 changes: 20 additions & 11 deletions docker/WasmServerless/build_image.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
#!/bin/bash

CURRENT_DIR=`pwd`
TARGET_DIR="$CURRENT_DIR/target"
DOCKER_DIR="$CURRENT_DIR/docker/WasmServerless"
IMAGE_VERSION="v1"
IMAGE_NAME="wasm_serverless:$IMAGE_VERSION"

if [ ! -d $TARGET_DIR ]
then
cargo build --release
if test $? -ne 0
then
exit 1
fi
fi

# if [ ! -d $TARGET_DIR ]
# then
# cargo build --release
# if test $? -ne 0
# then
# exit 1
# fi
# fi
echo ">"
ls $CURRENT_DIR/target
echo ">"
ls $CURRENT_DIR/target/release
echo ">"
ls $CURRENT_DIR/apps/fn2/target
echo ">"
ls $CURRENT_DIR/apps/fn2/target/wasm32-wasi/release

mkdir -p $DOCKER_DIR/target/release
cp $TARGET_DIR/release/wasm_serverless $DOCKER_DIR/target/release/wasm_serverless
mkdir -p $DOCKER_DIR/apps/fn2

cp $CURRENT_DIR/target/release/wasm_serverless $DOCKER_DIR/target/release/wasm_serverless
cp -r $CURRENT_DIR/apps/fn2/target $DOCKER_DIR/apps/fn2/target

# cp "$CURRENT_DIR/node_config.yaml" $DOCKER_DIR

Expand Down
8 changes: 6 additions & 2 deletions docker/WasmServerless/wasm_serverless_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/bash

echo "Node id is ${WASM_SERVERLESS_NODEID}"
echo "Node id: ${WASM_SERVERLESS_NODEID}"
echo "Who am i: $(whoami)"

/usr/local/bin/wasm_serverless $WASM_SERVERLESS_NODEID /etc/wasm_serverless/config/node_config.yaml
cd /usr/local/bin/
ls /etc/wasm_serverless/

wasm_serverless $WASM_SERVERLESS_NODEID /etc/wasm_serverless/
93 changes: 0 additions & 93 deletions docker/deploy_cluster/build_remote_images.py

This file was deleted.

77 changes: 0 additions & 77 deletions docker/deploy_cluster/docker-stack.yml

This file was deleted.

Loading

0 comments on commit 952442b

Please sign in to comment.