Skip to content

Commit

Permalink
Revert "Merge pull request databacker#238 from databacker/go"
Browse files Browse the repository at this point in the history
This reverts commit dd5fcda, reversing
changes made to e3f3bf6.
  • Loading branch information
isanketsaha committed Dec 2, 2023
1 parent dd5fcda commit 6d187f9
Show file tree
Hide file tree
Showing 71 changed files with 1,462 additions and 6,204 deletions.
15 changes: 0 additions & 15 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,6 @@ jobs:
steps:
- name: checkout
uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.19'
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
- name: Build
run: go build -o dist/mysql-backup -v .
- name: vet
run: make vet
- name: Test
run: make test
- name: Integration Test
run: make integration_test
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
Expand Down
20 changes: 4 additions & 16 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,12 @@ jobs:
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
${{env.IMAGE_NAME}}
# generate Docker tags based on the following events/attributes
# for any semver, including rc and alpha, etc. take the tag as is
# for ones that are exactly X.Y.Z, also tag it as latest
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}.{{patch}},value=latest
- name: Build and push semver tag
id: docker_build_push_semver
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
platforms: linux/amd64,linux/arm64
tags: |
${{ steps.meta.outputs.tags }}
${{env.IMAGE_NAME}}:${{ github.ref_name }}
${{env.IMAGE_NAME}}:latest
2 changes: 0 additions & 2 deletions .gitignore

This file was deleted.

30 changes: 16 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
# mysql backup image
FROM golang:1.19.6-alpine3.17 as build

COPY . /src/mysql-backup
WORKDIR /src/mysql-backup

RUN mkdir /out && go build -o /out/mysql-backup .

# we would do from scratch, but we need basic utilities in order to support pre/post scripts
FROM alpine:3.17
LABEL org.opencontainers.image.authors="https://github.com/databacker"
LABEL org.opencontainers.image.authors="https://github.com/deitch"

# install the necessary client
# the mysql-client must be 10.3.15 or later
RUN apk add --update 'mariadb-client>10.3.15' mariadb-connector-c bash python3 py3-pip samba-client shadow openssl coreutils && \
rm -rf /var/cache/apk/* && \
touch /etc/samba/smb.conf && \
pip3 install awscli

# set us up to run as non-root user
RUN apk add bash
RUN addgroup -g 1005 appuser && \
adduser -u 1005 -G appuser -D appuser
RUN groupadd -g 1005 appuser && \
useradd -r -u 1005 -g appuser appuser
# add home directory for user so IRSA AWS auth works
RUN mkdir -p /home/appuser && chmod 0755 /home/appuser && chown appuser /home/appuser
# ensure smb stuff works correctly
RUN mkdir -p /var/cache/samba && chmod 0755 /var/cache/samba && chown appuser /var/cache/samba && chown appuser /var/lib/samba/private
USER appuser

COPY --from=build /out/mysql-backup /mysql-backup

# install the entrypoint
COPY functions.sh /
COPY entrypoint /entrypoint

# start
Expand Down
30 changes: 20 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ push: build
docker tag $(BUILDIMAGE) $(TARGET)
docker push $(TARGET)

integration_test:
go test -v ./test --tags=integration
test_dump:
cd test && DEBUG=$(DEBUG) ./test_dump.sh

integration_test_debug:
dlv --wd=./test test ./test --build-flags="-tags=integration"
test_cron:
cd test && ./test_cron.sh

vet:
go vet --tags=integration ./...
test_source_target:
cd test && ./test_source_target.sh

test: unit_test integration_test
test_restore:
cd test && ./test_restore.sh

unit_test:
go test -v ./...
test: test_dump test_restore test_cron test_source_target

.PHONY: clean-test-stop clean-test-remove clean-test
clean-test-stop:
Expand All @@ -39,5 +39,15 @@ clean-test-remove:
$(eval IDS:=$(shell docker ps -a --filter label=mysqltest -q))
@if [ -n "$(IDS)" ]; then docker rm $(IDS); fi
@echo
@echo Remove Volumes
$(eval IDS:=$(shell docker volume ls --filter label=mysqltest -q))
@if [ -n "$(IDS)" ]; then docker volume rm $(IDS); fi
@echo

clean-test-network:
@echo Remove Networks
$(eval IDS:=$(shell docker network ls --filter label=mysqltest -q))
@if [ -n "$(IDS)" ]; then docker network rm $(IDS); fi
@echo

clean-test: clean-test-stop clean-test-remove
clean-test: clean-test-stop clean-test-remove clean-test-network
381 changes: 0 additions & 381 deletions README-bash.md

This file was deleted.

355 changes: 313 additions & 42 deletions README.md

Large diffs are not rendered by default.

8 changes: 0 additions & 8 deletions TODO.md

This file was deleted.

28 changes: 0 additions & 28 deletions cmd/common_test.go

This file was deleted.

207 changes: 0 additions & 207 deletions cmd/dump.go

This file was deleted.

Loading

0 comments on commit 6d187f9

Please sign in to comment.