Skip to content

Commit 7f10480

Browse files
authored
Merge pull request #15 from threefoldtech/single-instance
core: prepare single-instance checking and debug
2 parents 1b0d759 + 51eae3d commit 7f10480

File tree

13 files changed

+325
-143
lines changed

13 files changed

+325
-143
lines changed

.github/workflows/release.yaml

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,47 @@
11
name: Build release
2-
on:
2+
on:
33
release:
44
types: [created]
55
jobs:
6-
generate:
7-
name: Create release artifacts
8-
runs-on: ubuntu-18.04
6+
static:
7+
name: Create release artifact (static)
8+
runs-on: ubuntu-latest
9+
container:
10+
image: alpine:3.13
911
steps:
1012
- name: Checkout the repository
1113
uses: actions/checkout@master
1214

13-
- name: Install dependencies
15+
- name: Install system dependencies
1416
run: |
15-
sudo apt-get update
16-
sudo apt-get install -y git build-essential wget pkg-config \
17-
udev libudev-dev meson libhiredis-dev
17+
apk add alpine-sdk hiredis-dev linux-headers \
18+
libunwind-dev xz-dev meson ninja cmake udev \
19+
xz libunwind-static
1820
19-
- name: Download libfuse3
21+
- name: Download libfuse dependency
2022
run: |
2123
wget https://github.com/libfuse/libfuse/releases/download/fuse-3.10.2/fuse-3.10.2.tar.xz
2224
tar -xf fuse-3.10.2.tar.xz
23-
24-
- name: Build libfuse3
25+
26+
- name: Build static libfuse
2527
run: |
26-
cd fuse-3.10.2
28+
cd fuse-3.10.2
2729
mkdir build
2830
cd build
29-
meson .. --prefix /usr
31+
meson .. --prefix /usr -Dudevrulesdir=/etc/udev/rules.d --default-library static
3032
ninja
31-
sudo ninja install
33+
ninja install
3234
33-
- name: Building zdbfs
35+
- name: Build production 0-db-fs
3436
run: |
3537
make production
36-
version=$(grep VERSION src/zdbfs.h | awk '{ print $3 }' | sed s/'"'//g)
37-
cp zdbfs zdbfs-${version}-amd64-linux-gnu
38+
version=$(grep ZDBFS_VERSION src/zdbfs.h | awk '{ print $3 }' | sed s/'"'//g)
39+
cp zdbfs zdbfs-${version}-amd64-linux-static
3840
3941
- name: Upload the artifacts
4042
uses: skx/github-action-publish-binaries@master
4143
env:
4244
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4345
with:
44-
args: 'zdbfs-*-linux-gnu'
46+
args: 'zdbfs-*-linux-static'
4547

.github/workflows/tests.yaml

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
name: Tests and Coverage
22
on: [push]
3-
43
jobs:
54
kernel:
65
name: Kernel Build compare
@@ -9,7 +8,7 @@ jobs:
98
- name: Prepare dependencies
109
run: |
1110
sudo apt-get update
12-
sudo apt-get install -y build-essential libfuse3-dev libhiredis-dev redis-tools wget
11+
sudo apt-get install -y build-essential libfuse3-dev libhiredis-dev wget libunwind-dev
1312
sudo apt-get install -y libelf-dev flex bison libssl-dev bc
1413
1514
- name: Checkout development code
@@ -29,18 +28,10 @@ jobs:
2928
run: |
3029
cd 0-db/zdbd && ./zdb --mode seq --background
3130
32-
- name: Create original namespaces
33-
run: |
34-
echo "NSNEW zdbfs-meta" | redis-cli -p 9900
35-
echo "NSNEW zdbfs-data" | redis-cli -p 9900
36-
echo "NSNEW zdbfs-temp" | redis-cli -p 9900
37-
echo "NSSET zdbfs-temp password hello" | redis-cli -p 9900
38-
echo "NSSET zdbfs-temp public 0" | redis-cli -p 9900
39-
4031
- name: Run tests
4132
run: |
4233
sudo mkdir /mnt/zdbfs
43-
sudo ./zdbfs -o allow_other -o background /mnt/zdbfs
34+
sudo ./zdbfs -o allow_other -o background -o autons /mnt/zdbfs
4435
4536
- name: Download Linux Kernel
4637
working-directory: /tmp
@@ -92,7 +83,7 @@ jobs:
9283
- name: Prepare dependencies
9384
run: |
9485
sudo apt-get update
95-
sudo apt-get install -y build-essential libfuse3-dev libhiredis-dev redis-tools wget
86+
sudo apt-get install -y build-essential libfuse3-dev libhiredis-dev wget libunwind-dev
9687
sudo apt-get install -y libelf-dev flex bison libssl-dev bc
9788
9889
- name: Checkout development code
@@ -112,18 +103,10 @@ jobs:
112103
run: |
113104
cd 0-db/zdbd && ./zdb --mode seq --background
114105
115-
- name: Create original namespaces
116-
run: |
117-
echo "NSNEW zdbfs-meta" | redis-cli -p 9900
118-
echo "NSNEW zdbfs-data" | redis-cli -p 9900
119-
echo "NSNEW zdbfs-temp" | redis-cli -p 9900
120-
echo "NSSET zdbfs-temp password hello" | redis-cli -p 9900
121-
echo "NSSET zdbfs-temp public 0" | redis-cli -p 9900
122-
123106
- name: Run zdbfs
124107
run: |
125108
sudo mkdir /mnt/zdbfs
126-
sudo ./zdbfs -o allow_other -o background /mnt/zdbfs
109+
sudo ./zdbfs -o allow_other -o background -o autons /mnt/zdbfs
127110
128111
- name: Run sanity check
129112
run: ./tests/basic.sh /mnt/zdbfs

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ completed or waiting some time before flushing pending changes to the backend.
3434
# Dependencies
3535

3636
Only `libfuse3` and `hiredis` are required to build `zdbfs`, on Linux.
37+
There is for now a hard dependency to `libunwind` for debug purpose. Could become optional later.
38+
3739
Note that, only `gcc` or `clang` are supported as C compiler.
3840

3941
# Build

src/Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,19 @@ SRC = $(wildcard *.c)
33
OBJ = $(SRC:.c=.o)
44

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

88
all: $(EXEC)
99

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

13+
# production: CFLAGS += -DRELEASE -O2
14+
# production: LDFLAGS = -Wl,-Bstatic -lhiredis -lunwind -Wl,-Bdynamic -rdynamic -lfuse3 -lpthread -ldl -llzma
15+
#production: all
16+
1317
production: CFLAGS += -DRELEASE -O2
14-
production: LDFLAGS = -Wl,-Bstatic -lhiredis -Wl,-Bdynamic -rdynamic -lfuse3 -lpthread -ldl
18+
production: LDFLAGS = -rdynamic -static -lhiredis -lunwind -lfuse3 -lpthread -ldl -llzma
1519
production: all
1620

1721
$(EXEC): $(OBJ)

src/cache.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "inode.h"
1515
#include "cache.h"
1616
#include "zdb.h"
17+
#include "system.h"
1718

1819
//
1920
// cache statistics

src/init.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <errno.h>
1111
#include "zdbfs.h"
1212
#include "init.h"
13+
#include "system.h"
1314

1415
//
1516
// argument options
@@ -37,6 +38,7 @@ static struct fuse_opt zdbfs_opts[] = {
3738
{"autons", zdb_opt_field(autons), 0},
3839
{"background", zdb_opt_field(background), 0},
3940
{"logfile=%s", zdb_opt_field(logfile), 0},
41+
FUSE_OPT_END
4042
};
4143

4244
int zdbfs_init_args(zdbfs_t *fs, struct fuse_args *args, struct fuse_cmdline_opts *fopts) {

0 commit comments

Comments
 (0)