Skip to content

Commit

Permalink
Merge pull request #6 from xaviermichel/feat/gs-bucket
Browse files Browse the repository at this point in the history
Feat/gs bucket
  • Loading branch information
Cyprien Andres authored Dec 18, 2020
2 parents 1e64a12 + 84b6da5 commit 77de4c2
Show file tree
Hide file tree
Showing 17 changed files with 711 additions and 83 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: ci

on:
push:
branches:
- main
- feat/gs-bucket

jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ secrets.DOCKER_HUB_IMAGE }}:latest
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Publish releases to dockerhub

on:
push:
tags:
- v*

jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ secrets.DOCKER_HUB_IMAGE }}:${{ steps.get_version.outputs.VERSION }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ config.yml
.env
mongodb-backups
vendor
keys/
34 changes: 0 additions & 34 deletions .travis.yml

This file was deleted.

12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ Parameters:
- `mongodb`:
- `host`: MongoDB host
- `port`: MongoDB port
- `bucket`:
- `bucket` (fill only one option):
- `s3`:
- `name`: bucket name
- `region`: bucket region
- `gs`:
- `name`: bucket name

Example:

Expand All @@ -62,6 +64,14 @@ bucket:
region: eu-west-1
```
Example of instant backup start :
```yaml
kubectl apply -f ./k8s/backup.yaml
# then watch status
watch kubectl -n tools get jobs
```

## Prometheus metrics

- `mongodb_backups_scheduler_backup_total`: Total number of backups (status: success / error)
Expand Down
19 changes: 0 additions & 19 deletions ci/release.sh

This file was deleted.

2 changes: 1 addition & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func uploadDumpFile(filename string, scheduler *scheduler.Scheduler) {
log.Infof("Upload file %s. Size: %s", filename, utils.GetHumanFileSize(filename))
err := scheduler.Bucket.Upload(filename, scheduler.Plan.Name)
if err != nil {
log.Errorf("Could not upload log file: %v", err)
log.Errorf("Could not upload file: %v", err)
os.Exit(1)
}
}
Expand Down
9 changes: 3 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,15 @@ module github.com/neo9/mongodb-backups
go 1.12

require (
cloud.google.com/go/storage v1.12.0
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4 // indirect
github.com/aws/aws-sdk-go v1.20.19
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27
github.com/go-chi/chi v4.0.2+incompatible
github.com/go-stack/stack v1.8.0 // indirect
github.com/golang/snappy v0.0.1 // indirect
github.com/google/pprof v0.0.0-20190723021845-34ac40c74b70 // indirect
github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c // indirect
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6 // indirect
github.com/jessevdk/go-flags v1.4.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/mongodb/mongo-tools-common v0.0.0 // indirect
github.com/prometheus/client_golang v1.1.0
github.com/prometheus/common v0.6.0
Expand All @@ -24,7 +20,8 @@ require (
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c // indirect
github.com/xdg/stringprep v1.0.0 // indirect
golang.org/x/arch v0.0.0-20190312162104-788fe5ffcd8c // indirect
golang.org/x/tools v0.0.0-20190731214159-1e85ed8060aa // indirect
google.golang.org/api v0.32.0
google.golang.org/appengine v1.6.6
gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce // indirect
gopkg.in/yaml.v2 v2.2.2
)
Loading

0 comments on commit 77de4c2

Please sign in to comment.