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

Issue/120 #1

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM golang:1.10 AS BUILD

#install external dependencies first
ADD /main.go $GOPATH/src/schelly-mysql/main.go
RUN go get -v schelly-mysql

#now build source code
ADD schelly-mysql $GOPATH/src/schelly-mysql
RUN go get -v schelly-mysql


FROM ubuntu:18.04

RUN apt-get update
RUN apt-get install -y ca-certificates

EXPOSE 7070

ENV LOG_LEVEL 'debug'

ENV S3_PATH mysql
ENV S3_BUCKET bem-backups-dev
ENV S3_REGION us-west-1
ENV DUMP_CONNECTION_NAME bem_saude
ENV DUMP_CONNECTION_HOST docker.for.win.localhost:3306
ENV DUMP_CONNECTION_AUTH_USERNAME bem_saude
ENV DUMP_CONNECTION_AUTH_PASSWORD bem_saude
ENV AWS_ACCESS_KEY_ID key
ENV AWS_SECRET_ACCESS_KEY sec

COPY --from=BUILD /go/bin/* /bin/
ADD startup.sh /

CMD [ "/startup.sh" ]
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 stutzlab
Copyright (c) 2018 Flavio Stutz

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
64 changes: 62 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,62 @@
# schelly-restic-mysql
Schelly Restic MySQL container for doing MySQL backups using dumps and Restic storages
# schelly-mysql

Backup MySQL

See more about Schelly at http://github.com/flaviostutz/schelly

# Usage

docker-compose .yml

```
version: '3.5'

services:

schelly:
image: flaviostutz/schelly
ports:
- 8080:8080
environment:
- LOG_LEVEL=debug
- BACKUP_NAME=schelly-pgdump
- WEBHOOK_URL=http://localhost:7070/backups
- BACKUP_CRON_STRING=0 */1 * * * *
- RETENTION_MINUTELY=5
- WEBHOOK_GRACE_TIME=20

mysql-api:
build: .
ports:
- 7070:7070
environment:
- LOG_LEVEL=debug
- S3_PATH=mysql
- S3_BUCKET=bucket
- S3_REGION=us-west-1
- DUMP_CONNECTION_NAME=name
- DUMP_CONNECTION_HOST=server:port
- DUMP_CONNECTION_AUTH_USERNAME=user
- DUMP_CONNECTION_AUTH_PASSWORD=pass
- AWS_ACCESS_KEY_ID=key
- AWS_SECRET_ACCESS_KEY=sec
```

* execute ```docker-compose up``` and see logs

* run:

```
// #create a new backup
// curl POST localhost:7070/backups

// #list all backups
// curl localhost:7070/backups

// #list existing backup
// curl localhost:7070/backups/abc123

// #remove existing backup
// curl DELETE localhost:7070/backups/abc123
```

32 changes: 32 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: '3.5'

services:

schelly:
image: flaviostutz/schelly
ports:
- 8080:8080
environment:
- LOG_LEVEL=debug
- BACKUP_NAME=schelly-pgdump
- WEBHOOK_URL=http://localhost:7070/backups
- BACKUP_CRON_STRING=0 */1 * * * *
- RETENTION_MINUTELY=5
- WEBHOOK_GRACE_TIME=20

mysql-api:
build: .
ports:
- 7070:7070
environment:
- LOG_LEVEL=debug
- S3_PATH=mysql
- S3_BUCKET=bem-backups-dev
- S3_REGION=us-west-1
- DUMP_CONNECTION_NAME=bem_saude
- DUMP_CONNECTION_HOST=docker.for.win.localhost:3306
- DUMP_CONNECTION_AUTH_USERNAME=bem_saude
- DUMP_CONNECTION_AUTH_PASSWORD=bem_saude
- AWS_ACCESS_KEY_ID=key
- AWS_SECRET_ACCESS_KEY=sec

19 changes: 19 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package main

import (
_ "encoding/json"
_ "flag"
_ "fmt"
_ "io/ioutil"
"log"
_ "net/http"
_ "os"
_ "regexp"
_ "strings"

_ "github.com/sirupsen/logrus"
)

func main() {
log.Print("Should not start this class.")
}
Loading