Skip to content

Commit

Permalink
Merge pull request #15 from threefoldtech/single-instance
Browse files Browse the repository at this point in the history
core: prepare single-instance checking and debug
  • Loading branch information
maxux authored May 10, 2021
2 parents 1b0d759 + 51eae3d commit 7f10480
Show file tree
Hide file tree
Showing 13 changed files with 325 additions and 143 deletions.
38 changes: 20 additions & 18 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,45 +1,47 @@
name: Build release
on:
on:
release:
types: [created]
jobs:
generate:
name: Create release artifacts
runs-on: ubuntu-18.04
static:
name: Create release artifact (static)
runs-on: ubuntu-latest
container:
image: alpine:3.13
steps:
- name: Checkout the repository
uses: actions/checkout@master

- name: Install dependencies
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y git build-essential wget pkg-config \
udev libudev-dev meson libhiredis-dev
apk add alpine-sdk hiredis-dev linux-headers \
libunwind-dev xz-dev meson ninja cmake udev \
xz libunwind-static
- name: Download libfuse3
- name: Download libfuse dependency
run: |
wget https://github.com/libfuse/libfuse/releases/download/fuse-3.10.2/fuse-3.10.2.tar.xz
tar -xf fuse-3.10.2.tar.xz
- name: Build libfuse3
- name: Build static libfuse
run: |
cd fuse-3.10.2
cd fuse-3.10.2
mkdir build
cd build
meson .. --prefix /usr
meson .. --prefix /usr -Dudevrulesdir=/etc/udev/rules.d --default-library static
ninja
sudo ninja install
ninja install
- name: Building zdbfs
- name: Build production 0-db-fs
run: |
make production
version=$(grep VERSION src/zdbfs.h | awk '{ print $3 }' | sed s/'"'//g)
cp zdbfs zdbfs-${version}-amd64-linux-gnu
version=$(grep ZDBFS_VERSION src/zdbfs.h | awk '{ print $3 }' | sed s/'"'//g)
cp zdbfs zdbfs-${version}-amd64-linux-static
- name: Upload the artifacts
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: 'zdbfs-*-linux-gnu'
args: 'zdbfs-*-linux-static'

25 changes: 4 additions & 21 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: Tests and Coverage
on: [push]

jobs:
kernel:
name: Kernel Build compare
Expand All @@ -9,7 +8,7 @@ jobs:
- name: Prepare dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential libfuse3-dev libhiredis-dev redis-tools wget
sudo apt-get install -y build-essential libfuse3-dev libhiredis-dev wget libunwind-dev
sudo apt-get install -y libelf-dev flex bison libssl-dev bc
- name: Checkout development code
Expand All @@ -29,18 +28,10 @@ jobs:
run: |
cd 0-db/zdbd && ./zdb --mode seq --background
- name: Create original namespaces
run: |
echo "NSNEW zdbfs-meta" | redis-cli -p 9900
echo "NSNEW zdbfs-data" | redis-cli -p 9900
echo "NSNEW zdbfs-temp" | redis-cli -p 9900
echo "NSSET zdbfs-temp password hello" | redis-cli -p 9900
echo "NSSET zdbfs-temp public 0" | redis-cli -p 9900
- name: Run tests
run: |
sudo mkdir /mnt/zdbfs
sudo ./zdbfs -o allow_other -o background /mnt/zdbfs
sudo ./zdbfs -o allow_other -o background -o autons /mnt/zdbfs
- name: Download Linux Kernel
working-directory: /tmp
Expand Down Expand Up @@ -92,7 +83,7 @@ jobs:
- name: Prepare dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential libfuse3-dev libhiredis-dev redis-tools wget
sudo apt-get install -y build-essential libfuse3-dev libhiredis-dev wget libunwind-dev
sudo apt-get install -y libelf-dev flex bison libssl-dev bc
- name: Checkout development code
Expand All @@ -112,18 +103,10 @@ jobs:
run: |
cd 0-db/zdbd && ./zdb --mode seq --background
- name: Create original namespaces
run: |
echo "NSNEW zdbfs-meta" | redis-cli -p 9900
echo "NSNEW zdbfs-data" | redis-cli -p 9900
echo "NSNEW zdbfs-temp" | redis-cli -p 9900
echo "NSSET zdbfs-temp password hello" | redis-cli -p 9900
echo "NSSET zdbfs-temp public 0" | redis-cli -p 9900
- name: Run zdbfs
run: |
sudo mkdir /mnt/zdbfs
sudo ./zdbfs -o allow_other -o background /mnt/zdbfs
sudo ./zdbfs -o allow_other -o background -o autons /mnt/zdbfs
- name: Run sanity check
run: ./tests/basic.sh /mnt/zdbfs
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ completed or waiting some time before flushing pending changes to the backend.
# Dependencies

Only `libfuse3` and `hiredis` are required to build `zdbfs`, on Linux.
There is for now a hard dependency to `libunwind` for debug purpose. Could become optional later.

Note that, only `gcc` or `clang` are supported as C compiler.

# Build
Expand Down
8 changes: 6 additions & 2 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@ SRC = $(wildcard *.c)
OBJ = $(SRC:.c=.o)

CFLAGS += -g -std=gnu99 -O0 -W -Wall -Wextra -Wno-implicit-fallthrough -I/usr/include/fuse3
LDFLAGS += -rdynamic -lfuse3 -lpthread -lhiredis
LDFLAGS += -Wl,-Bstatic -lunwind -Wl,-Bdynamic -rdynamic -lfuse3 -lpthread -lhiredis -ldl -llzma

all: $(EXEC)

release: CFLAGS += -DRELEASE -O2 -march=native
release: clean $(EXEC)

# production: CFLAGS += -DRELEASE -O2
# production: LDFLAGS = -Wl,-Bstatic -lhiredis -lunwind -Wl,-Bdynamic -rdynamic -lfuse3 -lpthread -ldl -llzma
#production: all

production: CFLAGS += -DRELEASE -O2
production: LDFLAGS = -Wl,-Bstatic -lhiredis -Wl,-Bdynamic -rdynamic -lfuse3 -lpthread -ldl
production: LDFLAGS = -rdynamic -static -lhiredis -lunwind -lfuse3 -lpthread -ldl -llzma
production: all

$(EXEC): $(OBJ)
Expand Down
1 change: 1 addition & 0 deletions src/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "inode.h"
#include "cache.h"
#include "zdb.h"
#include "system.h"

//
// cache statistics
Expand Down
2 changes: 2 additions & 0 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <errno.h>
#include "zdbfs.h"
#include "init.h"
#include "system.h"

//
// argument options
Expand Down Expand Up @@ -37,6 +38,7 @@ static struct fuse_opt zdbfs_opts[] = {
{"autons", zdb_opt_field(autons), 0},
{"background", zdb_opt_field(background), 0},
{"logfile=%s", zdb_opt_field(logfile), 0},
FUSE_OPT_END
};

int zdbfs_init_args(zdbfs_t *fs, struct fuse_args *args, struct fuse_cmdline_opts *fopts) {
Expand Down
Loading

0 comments on commit 7f10480

Please sign in to comment.