Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pid file support #543

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
ad73c1e
feat(pid): Write pid file
Aug 13, 2020
758eba2
Update pid-file flag
zachomedia Sep 17, 2020
d2fb266
feat(sparse): Allow for sparse file uploads
sylus Jan 9, 2021
58a2c2f
Merge pull request #1 from StatCan/feat-sparse
sylus Jan 10, 2021
dbd06ba
test:
Jose-Matsuda Apr 9, 2024
69a13ab
forcibly inc buffer size, will definitely crash if above 625
Jose-Matsuda Apr 9, 2024
8eaaec3
10Gb
Jose-Matsuda Apr 10, 2024
e45008f
4.5
Jose-Matsuda Apr 10, 2024
a1fb9da
a little bit under 5Gb
Jose-Matsuda Apr 11, 2024
5a80de4
replaced log.fatalf with .og.printf
mathis-marcotte Jun 19, 2024
f7ea803
Merge pull request #2 from mathis-marcotte/remove-multipart-and-fatal
Souheil-Yazji Jul 2, 2024
be896e8
updated to point to statcan fork instead of original
Jul 9, 2024
9db676b
added meta-fuse-csi-plugin code and made dockerfile
Jul 9, 2024
34bca56
updated github workflow
Jul 9, 2024
af12b04
removes fatal and os.exit
Jul 9, 2024
b912810
removed push from push step for debugging
Jul 11, 2024
4ed1be6
fixed registry name in build-push
Jul 11, 2024
63d32d9
going back to wget goofys to test build
Jul 12, 2024
a1fbdf7
added missing files to meta-fuse folder
Jul 12, 2024
e1011bb
updated goofys build step in dockerfile
Jul 12, 2024
6d91bc0
removed unecessary files
Jul 12, 2024
31f0903
replaced build command with makefile command
Jul 15, 2024
a3ccbd4
clean up dockerfile
Jul 15, 2024
758dfd5
cleaned up makefile
Jul 15, 2024
e62c2e1
updated repo reference
Jul 15, 2024
1109e13
fixed curl url
Jul 15, 2024
ecc5000
Merge pull request #4 from StatCan/add-dockerfile-and-workflow
Souheil-Yazji Jul 18, 2024
2dee47d
chore(documentation): point out meta-fuse-csi-plugin
Jose-Matsuda Aug 22, 2024
f409095
Merge pull request #5 from StatCan/docs-update
Jose-Matsuda Aug 23, 2024
a4aa306
update(security): Ubuntu to alpine, update go pkgs (#6)
bryanpaget Sep 13, 2024
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
69 changes: 69 additions & 0 deletions .github/workflows/build-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: build-and-push
on:
push:
branches:
- master
pull_request:
types:
- 'opened'
- 'synchronize'
- 'reopened'

env:
REGISTRY_NAME: k8scc01covidacr
TRIVY_VERSION: "v0.43.1"
HADOLINT_VERSION: "2.12.0"
jobs:
build-push:
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
- uses: actions/checkout@v4

# Push image to ACR
# Pushes if this is a push to master or an update to a PR that has auto-deploy label
- name: Test if we should push to ACR
id: should-i-push
if: |
github.event_name == 'push' ||
(
github.event_name == 'pull_request' &&
contains( github.event.pull_request.labels.*.name, 'auto-deploy')
)
run: echo "::set-output name=boolean::true"

# Connect to Azure Container registry (ACR)
- uses: azure/docker-login@v1
with:
login-server: ${{ env.REGISTRY_NAME }}.azurecr.io
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: Run Hadolint
run: |
sudo curl -L https://github.com/hadolint/hadolint/releases/download/v${{ env.HADOLINT_VERSION }}/hadolint-Linux-x86_64 --output hadolint
sudo chmod +x hadolint
./hadolint ./Dockerfile --no-fail

- name: Build image locally
run: |
docker build -f Dockerfile -t localhost:5000/mfcp-proxy-goofys-multi-inc:${{ github.sha }} .
docker push localhost:5000/mfcp-proxy-goofys-multi-inc:${{ github.sha }}
docker image prune

- name: Aqua Security Trivy image scan
run: |
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin ${{ env.TRIVY_VERSION }}
trivy image localhost:5000/mfcp-proxy-goofys-multi-inc:${{ github.sha }} --exit-code 1 --timeout=20m --security-checks vuln --severity CRITICAL

# Container build and push to a Azure Container registry (ACR)
- name: Push to ACR if necessary
if: steps.should-i-push.outputs.boolean == 'true'
run: |
docker pull localhost:5000/mfcp-proxy-goofys-multi-inc:${{ github.sha }}
docker tag localhost:5000/mfcp-proxy-goofys-multi-inc:${{ github.sha }} ${{ env.REGISTRY_NAME }}.azurecr.io/mfcp-proxy-goofys-multi-inc:${{ github.sha }}
docker push ${{ env.REGISTRY_NAME }}.azurecr.io/mfcp-proxy-goofys-multi-inc:${{ github.sha }}
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ install:
script: travis_retry ./test/run-tests.sh GoofysTest
go:
- 1.16
go_import_path: github.com/kahing/goofys
go_import_path: github.com/StatCan/goofys
matrix:
include:
- name: "S3Proxy"
Expand Down
52 changes: 52 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
FROM golang:1.20.7-alpine AS fusermount3-proxy-builder

# Install required build dependencies
RUN apk update && apk upgrade && apk --no-cache add make gcc g++ libc-dev fuse-dev

WORKDIR /meta-fuse-csi-plugin
ADD ./meta-fuse-csi-plugin .
# Build the fusermount3-proxy
RUN make fusermount3-proxy BINDIR=/bin

FROM golang:1.20.7-alpine AS goofys-builder

# Install required build dependencies
RUN apk update && apk upgrade && apk --no-cache add git make gcc g++ libc-dev fuse-dev

WORKDIR /goofys
ADD . .
# Build the goofys app
RUN make build

# 3.20.3 is the latest as of this commit (September 09 2024)
FROM alpine:3.20.3

# Install necessary runtime dependencies
RUN apk update && apk upgrade && apk --no-cache add ca-certificates bash wget

# Download MinIO client (mc)
RUN wget https://dl.min.io/client/mc/release/linux-amd64/mc -O /usr/bin/mc && \
chmod +x /usr/bin/mc && \
apk del wget && rm -rf /var/cache/apk/*

# Copy the test file
COPY <<EOF /test.txt
This is a test file for minio
EOF

# Copy and configure MinIO
COPY <<EOF /configure_minio.sh
#!/bin/bash
set -eux
/usr/bin/mc alias set k8s-minio-dev http://localhost:9000 minioadmin minioadmin
/usr/bin/mc mb k8s-minio-dev/test-bucket
/usr/bin/mc cp /test.txt k8s-minio-dev/test-bucket
EOF
RUN chmod +x /configure_minio.sh

# Get goofys build from the build stage
COPY --from=goofys-builder /goofys/goofys .

# Get fusermount3-proxy from the build stage and set up symlink
COPY --from=fusermount3-proxy-builder /bin/fusermount3-proxy /usr/bin/fusermount3
RUN ln -sf /usr/bin/fusermount3 /bin/fusermount
2 changes: 1 addition & 1 deletion README-azure.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ $ $GOPATH/bin/goofys adl://servicename.azuredatalakestore.net:prefix <mountpoint

# Azure Data Lake Storage Gen2

Configure your credentials the same way as [Azure Blob Storage](https://github.com/kahing/goofys/blob/master/README-azure.md#azure-blob-storage) above, and then:
Configure your credentials the same way as [Azure Blob Storage](https://github.com/StatCan/goofys/blob/master/README-azure.md#azure-blob-storage) above, and then:

```ShellSession
$ $GOPATH/bin/goofys abfs://container <mountpoint>
Expand Down
29 changes: 17 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<img src="doc/goofys.png" height="32" width="32" align="middle" /> Goofys is a high-performance, POSIX-ish [Amazon S3](https://aws.amazon.com/s3/) file system written in Go

[![Build Status](https://travis-ci.org/kahing/goofys.svg?branch=master)](https://travis-ci.org/kahing/goofys)
[![Github All Releases](https://img.shields.io/github/downloads/kahing/goofys/total.svg)](https://github.com/kahing/goofys/releases/)
[![Build Status](https://travis-ci.org/StatCan/goofys.svg?branch=master)](https://travis-ci.org/StatCan/goofys)
[![Github All Releases](https://img.shields.io/github/downloads/StatCan/goofys/total.svg)](https://github.com/StatCan/goofys/releases/)
[![Twitter Follow](https://img.shields.io/twitter/follow/s3goofys.svg?style=social&label=Follow)](https://twitter.com/s3goofys)
[![Stack Overflow Questions](https://img.shields.io/stackexchange/stackoverflow/t/goofys?label=Stack%20Overflow%20questions)](https://stackoverflow.com/search?q=%5Bgoofys%5D+is%3Aquestion)

Expand All @@ -14,12 +14,12 @@ for performance first and POSIX second. Particularly things that are
difficult to support on S3 or would translate into more than one
round-trip would either fail (random writes) or faked (no per-file
permission). Goofys does not have an on disk data cache (checkout
[catfs](https://github.com/kahing/catfs)), and consistency model is
[catfs](https://github.com/StatCan/catfs)), and consistency model is
close-to-open.

# Installation

* On Linux, install via [pre-built binaries](https://github.com/kahing/goofys/releases/latest/download/goofys).
* On Linux, install via [pre-built binaries](https://github.com/StatCan/goofys/releases/latest/download/goofys).
You may also need to install fuse too if you want to mount it on startup.

* On macOS, install via [Homebrew](https://brew.sh/):
Expand All @@ -33,8 +33,8 @@ $ brew install goofys

```ShellSession
$ export GOPATH=$HOME/work
$ go get github.com/kahing/goofys
$ go install github.com/kahing/goofys
$ go get github.com/StatCan/goofys
$ go install github.com/StatCan/goofys
```

# Usage
Expand All @@ -59,28 +59,28 @@ configured for `root`, and can add this to `/etc/fstab`:
goofys#bucket /mnt/mountpoint fuse _netdev,allow_other,--file-mode=0666,--dir-mode=0777 0 0
```

See also: [Instruction for Azure Blob Storage, Azure Data Lake Gen1, and Azure Data Lake Gen2](https://github.com/kahing/goofys/blob/master/README-azure.md).
See also: [Instruction for Azure Blob Storage, Azure Data Lake Gen1, and Azure Data Lake Gen2](https://github.com/StatCan/goofys/blob/master/README-azure.md).

Got more questions? Check out [questions other people asked](https://github.com/kahing/goofys/issues?utf8=%E2%9C%93&q=is%3Aissue%20label%3Aquestion%20)
Got more questions? Check out [questions other people asked](https://github.com/StatCan/goofys/issues?utf8=%E2%9C%93&q=is%3Aissue%20label%3Aquestion%20)

# Benchmark

Using `--stat-cache-ttl 1s --type-cache-ttl 1s` for goofys
`-ostat_cache_expire=1` for s3fs to simulate cold runs. Detail for the
benchmark can be found in
[bench.sh](https://github.com/kahing/goofys/blob/master/bench/bench.sh). [Raw data](https://github.com/kahing/goofys/blob/master/bench/)
[bench.sh](https://github.com/StatCan/goofys/blob/master/bench/bench.sh). [Raw data](https://github.com/StatCan/goofys/blob/master/bench/)
is available as well. The test was run on an EC2 m5.4xlarge in us-west-2a
connected to a bucket in us-west-2. Units are seconds.

![Benchmark result](/bench/bench.png?raw=true "Benchmark")

To run the benchmark, configure EC2's instance role to be able to write to `$TESTBUCKET`, and then do:
```ShellSession
$ sudo docker run -e BUCKET=$TESTBUCKET -e CACHE=false --rm --privileged --net=host -v /tmp/cache:/tmp/cache kahing/goofys-bench
$ sudo docker run -e BUCKET=$TESTBUCKET -e CACHE=false --rm --privileged --net=host -v /tmp/cache:/tmp/cache StatCan/goofys-bench
# result will be written to $TESTBUCKET
```

See also: [cached benchmark result](https://github.com/kahing/goofys/blob/master/bench/cache/README.md) and [result on Azure](https://github.com/kahing/goofys/blob/master/bench/azure/README.md).
See also: [cached benchmark result](https://github.com/StatCan/goofys/blob/master/bench/cache/README.md) and [result on Azure](https://github.com/StatCan/goofys/blob/master/bench/azure/README.md).

# License

Expand Down Expand Up @@ -123,12 +123,17 @@ Additionally, goofys also works with the following non-S3 object stores:
* Azure Data Lake Gen1
* Azure Data Lake Gen2

## Integration with [meta-fuse-csi-plugin](https://github.com/pfnet-research/meta-fuse-csi-plugin/tree/main)

This repository also contains files from the the meta-fuse-csi-plugin repository with more information being found [here](https://github.com/StatCan/aaw/blob/master/docs/dev/features/netapp-mounting/overview.md#integration-with-netapp). The initial commit to add them is [here](https://github.com/StatCan/goofys/commit/9db676b41fd4546c06d7fd1df6afbac44d29bde5) with subsequent commits refining the process.
The purpose of this was to [simplify the process described here](https://github.com/StatCan/aaw/blob/master/docs/dev/features/netapp-mounting/overview.md#deployment-checklist).

# References

* Data is stored on [Amazon S3](https://aws.amazon.com/s3/)
* [Amazon SDK for Go](https://github.com/aws/aws-sdk-go)
* Other related fuse filesystems
* [catfs](https://github.com/kahing/catfs): caching layer that can be used with goofys
* [catfs](https://github.com/StatCan/catfs): caching layer that can be used with goofys
* [s3fs](https://github.com/s3fs-fuse/s3fs-fuse): another popular filesystem for S3
* [gcsfuse](https://github.com/googlecloudplatform/gcsfuse):
filesystem for
Expand Down
4 changes: 2 additions & 2 deletions api/api.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package goofys

import (
. "github.com/kahing/goofys/api/common"
"github.com/kahing/goofys/internal"
. "github.com/StatCan/goofys/api/common"
"github.com/StatCan/goofys/internal"

"context"
"fmt"
Expand Down
2 changes: 2 additions & 0 deletions api/common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import (
)

type FlagStorage struct {
PidFile string

// File system
MountOptions map[string]string
MountPoint string
Expand Down
6 changes: 3 additions & 3 deletions bench/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ RUN curl -L -O https://github.com/kahing/catfs/releases/download/v0.8.0/catfs &&
# ideally I want to clear out all the go deps too but there's no
# way to do that with ADD
ENV PATH=$PATH:/root/go/bin
ADD . /root/go/src/github.com/kahing/goofys
WORKDIR /root/go/src/github.com/kahing/goofys
ADD . /root/go/src/github.com/StatCan/goofys
WORKDIR /root/go/src/github.com/StatCan/goofys
RUN go get . && make install

ENTRYPOINT ["/root/go/src/github.com/kahing/goofys/bench/run_bench.sh"]
ENTRYPOINT ["/root/go/src/github.com/StatCan/goofys/bench/run_bench.sh"]
6 changes: 3 additions & 3 deletions bench/Dockerfile.azure
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ RUN curl -L -O https://github.com/kahing/catfs/releases/download/v0.8.0/catfs &&
# ideally I want to clear out all the go deps too but there's no
# way to do that with ADD
ENV PATH=$PATH:/root/go/bin
ADD . /root/go/src/github.com/kahing/goofys
WORKDIR /root/go/src/github.com/kahing/goofys
ADD . /root/go/src/github.com/StatCan/goofys
WORKDIR /root/go/src/github.com/StatCan/goofys
RUN go get . && make install

ENTRYPOINT ["/root/go/src/github.com/kahing/goofys/bench/run_bench.sh"]
ENTRYPOINT ["/root/go/src/github.com/StatCan/goofys/bench/run_bench.sh"]
8 changes: 4 additions & 4 deletions bench/Dockerfile.gcs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM golang:1.14 AS goofys-builder

# install goofys
WORKDIR $GOPATH/src/github.com/kahing/goofys
WORKDIR $GOPATH/src/github.com/StatCan/goofys

COPY . .

Expand Down Expand Up @@ -33,12 +33,12 @@ RUN pip install numpy
ENV PATH=$PATH:/root/go/bin

# copy go binaries
COPY --from=goofys-builder /go/src/github.com/kahing/goofys/goofys /root/go/bin/goofys
COPY --from=goofys-builder /go/src/github.com/StatCan/goofys/goofys /root/go/bin/goofys
COPY --from=goofys-builder /go/bin/gcsfuse /root/go/bin/gcsfuse

WORKDIR /root/go/src/github.com/kahing/goofys
WORKDIR /root/go/src/github.com/StatCan/goofys

# copy bench scripts
COPY bench bench

ENTRYPOINT ["/root/go/src/github.com/kahing/goofys/bench/run_bench.sh"]
ENTRYPOINT ["/root/go/src/github.com/StatCan/goofys/bench/run_bench.sh"]
2 changes: 1 addition & 1 deletion bench/azure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ To run the benchmark, do:
```ShellSession
$ export AZURE_STORAGE_ACCOUNT=myaccount
$ export AZURE_STORAGE_KEY=STORAGE-ACCESS-KEY
$ sudo docker run -e BUCKET=$TESTBUCKET -e AZURE_STORAGE_ACCOUNT=$AZURE_STORAGE_ACCOUNT -e AZURE_STORAGE_KEY=$AZURE_STORAGE_KEY --rm --privileged --net=host -v /mnt/cache:/tmp/cache kahing/goofys-bench:azure-latest
$ sudo docker run -e BUCKET=$TESTBUCKET -e AZURE_STORAGE_ACCOUNT=$AZURE_STORAGE_ACCOUNT -e AZURE_STORAGE_KEY=$AZURE_STORAGE_KEY --rm --privileged --net=host -v /mnt/cache:/tmp/cache StatCan/goofys-bench:azure-latest
# result will be written to $TESTBUCKET
```
2 changes: 1 addition & 1 deletion bench/cache/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ To run the benchmark, configure EC2's instance role to be able to write to `$TES
```ShellSession
$ export AWS_ACCESS_KEY_ID=AKID1234567890
$ export AWS_SECRET_ACCESS_KEY=MY-SECRET-KEY
$ sudo docker run -e BUCKET=$TESTBUCKET -e CACHE=true --rm --privileged --net=host -v /tmp/cache:/tmp/cache kahing/goofys-bench
$ sudo docker run -e BUCKET=$TESTBUCKET -e CACHE=true --rm --privileged --net=host -v /tmp/cache:/tmp/cache StatCan/goofys-bench
# result will be written to $TESTBUCKET
```
6 changes: 3 additions & 3 deletions example/test_api.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package main

import (
goofys "github.com/kahing/goofys/api"
common "github.com/kahing/goofys/api/common"
goofys "github.com/StatCan/goofys/api"
common "github.com/StatCan/goofys/api/common"

"fmt"
"context"
"fmt"
)

func main() {
Expand Down
18 changes: 10 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module github.com/kahing/goofys
module github.com/StatCan/goofys

go 1.14

require (
cloud.google.com/go/storage v1.14.0
cloud.google.com/go/storage v1.30.1
github.com/Azure/azure-pipeline-go v0.2.3
github.com/Azure/azure-sdk-for-go v61.4.0+incompatible
github.com/Azure/azure-storage-blob-go v0.14.0
Expand All @@ -17,21 +17,23 @@ require (
github.com/aws/aws-sdk-go v1.44.37
github.com/go-ole/go-ole v1.2.5 // indirect
github.com/gofrs/uuid v4.2.0+incompatible
github.com/google/uuid v1.2.0
github.com/google/uuid v1.3.0
github.com/gopherjs/gopherjs v0.0.0-20210413103415-7d3cbed7d026 // indirect
github.com/jacobsa/fuse v0.0.0-20221016084658-a4cd154343d8
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0
github.com/mitchellh/go-homedir v1.1.0
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b
github.com/sevlyar/go-daemon v0.1.5
github.com/shirou/gopsutil v0.0.0-20190731134726-d80c43f9c984
github.com/sirupsen/logrus v1.4.3-0.20190807103436-de736cf91b92
github.com/smartystreets/assertions v1.2.0 // indirect
github.com/urfave/cli v1.21.1-0.20190807111034-521735b7608a
golang.org/x/oauth2 v0.0.0-20210323180902-22b0adad7558
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/sys v0.2.0
google.golang.org/api v0.43.0
golang.org/x/net v0.23.0 // indirect
golang.org/x/oauth2 v0.10.0
golang.org/x/sync v0.3.0
golang.org/x/sys v0.18.0
google.golang.org/api v0.126.0
google.golang.org/grpc v1.58.3 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c
gopkg.in/ini.v1 v1.51.0
)
Loading