Skip to content

Commit

Permalink
Merge pull request #7 from cthit/feat/users
Browse files Browse the repository at this point in the history
Add user features and other improvements
  • Loading branch information
molleer authored May 23, 2019
2 parents afd45fb + 5a55c09 commit cb74a10
Show file tree
Hide file tree
Showing 42 changed files with 2,622 additions and 1,214 deletions.
22 changes: 15 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Dockerfile for goldapps production
FROM golang:alpine AS buildStage
FROM golang:1.12-alpine AS buildStage
MAINTAINER digIT <[email protected]>

# Install git
Expand All @@ -8,32 +8,40 @@ RUN apk upgrade
RUN apk add --update git

# Copy sources
RUN mkdir -p $GOPATH/src/github.com/cthit/goldapps
COPY . $GOPATH/src/github.com/cthit/goldapps
WORKDIR $GOPATH/src/github.com/cthit/goldapps/cmd
RUN mkdir -p /goldapps
COPY . /goldapps
WORKDIR /goldapps/cmd/goldapps

# Grab dependencies
RUN go get -d -v ./...
#RUN go get -d -v ./...

# build binary
RUN go install -v
RUN mkdir /app && mv $GOPATH/bin/cmd /app/goldapps
RUN mkdir /app && mv $GOPATH/bin/goldapps /app/goldapps

##########################
# PRODUCTION STAGE #
##########################
FROM alpine
MAINTAINER digIT <[email protected]>

# Add standard certificates
RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/*

# Set user
RUN addgroup -S app
RUN adduser -S -G app -s /bin/bash app
USER app:app

# Copy execution script
COPY ./sleep_and_run.sh /app/sleep_and_run.sh

# Copy binary
COPY --from=buildStage /app/goldapps /app/goldapps

ENV WAIT 15s

# Set good defaults
WORKDIR /app
ENTRYPOINT /app/goldapps
ENTRYPOINT ./sleep_and_run.sh
CMD -dry
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,18 @@ A system for syncing LDAP with gsuite and json files written in Go
* use the downloaded file

## Usage
[docker image](https://hub.docker.com/r/cthit/goldapps/)

Read setup first

### Docker image

`$WAIT` specifies for how long the application should wait before running. This can bes jused in conjunction with `restart: always` to make the bridge run at regular intervals. If you don't desire any waiting effect you can simply set the entrypoint to `./goldapps`.

For some reason `entrypoint` has to be specified in the compose file or the docker run command.

The command should be your flags for the `goldapps` command

See `prod.docker-compose.yaml` as reference.

### Command `goldapps`

Expand All @@ -29,5 +40,9 @@ The following flags are available:
* `-dry`: Makes sure the program does not change anything.
* `-from someString`: Set the group source to `ldap`, `gapps` or `*.json`. In case of `gapps` config value `gapps.provider` will be used.
* `-to someString`: Set the group consumer to 'gapps' or '*.json'. In case of `gapps` config value `gapps.consumer` will be used.
* `-users`: Only collect and sync users
* `-groups`: Only collect and sync groups
* `-additions *.json`: file with additions


Notice that flags should be combined on the form `goldapps -a -b` and **NOT** on the form `goldapps -ab`.
133 changes: 0 additions & 133 deletions action.go

This file was deleted.

9 changes: 0 additions & 9 deletions admin/scope.go

This file was deleted.

Loading

0 comments on commit cb74a10

Please sign in to comment.