Skip to content

Commit

Permalink
Merge pull request #3 from Iapetus999/VAULT-893_supervisord
Browse files Browse the repository at this point in the history
VAULT-893 Supervisord
  • Loading branch information
Iapetus999 authored Feb 10, 2021
2 parents d75e005 + 7ddb470 commit b1c76a9
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 5 deletions.
29 changes: 25 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ version: 2
job-defaults: &job-defaults
working_directory: &working_directory
/go/src/github.com/lyft/ratelimit/
environment:
- AWS_DEFAULT_REGION: us-west-2
- AWS_REGION: us-west-2
- AWS_ACCOUNT_ID: "883127560329"
- AWS_PROFILE: dev/vault

jobs:
build:
Expand All @@ -13,20 +18,36 @@ jobs:
- REDIS_SOCKET_TYPE=tcp
- REDIS_URL=localhost:6379
docker:
- image: circleci/golang:1.9
- image: circleci/golang:1.14
- image: redis:alpine
steps:
- checkout
- setup_remote_docker
- run:
name: Compile
command: |
make bootstrap
make compile
release-image-quay:
machine:
docker_layer_caching: true
<<: *job-defaults
steps:
- run:
name: Build Docker Image and Run Tests
name: push to Quay
command: |
make docker
unset AWS_ACCESS_KEY_ID; unset AWS_SECRET_ACCESS_KEY;
./ops/docker-login-quay.sh
export VERSION=${CIRCLE_TAG}
docker-compose ratelimit-build
docker-compose push
if [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
VERSION=latest docker-compose push
fi
workflows:
version: 2
Expand Down
9 changes: 8 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ COPY script script

RUN CGO_ENABLED=0 GOOS=linux go build -o /go/bin/ratelimit -ldflags="-w -s" -v github.com/envoyproxy/ratelimit/src/service_cmd

FROM alpine:3.11 AS final
FROM alpine:3.11
RUN apk --no-cache add ca-certificates

FROM ubuntu:latest
RUN apt-get update && apt-get install -y supervisor
RUN mkdir -p /var/log/supervisor
COPY --from=build /go/bin/ratelimit /bin/ratelimit
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf

ENTRYPOINT ["/usr/bin/supervisord"]
3 changes: 3 additions & 0 deletions ops/docker-login-quay.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

docker login quay.io --username "$QUAY_DOCKER_LOGIN" --password "$QUAY_DOCKER_LOGIN_PASSWORD"
16 changes: 16 additions & 0 deletions supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[supervisord]
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
nodaemon=true

[unix_http_server]
file = /var/tmp/supervisor.sock

[supervisorctl]
serverurl=unix:///var/tmp/supervisor.sock

[program:app]
command=/bin/ratelimit
redirect_stderr=true
stdout_logfile=/dev/stdout ; Just dump to stdout, Docker should find it
stdout_logfile_maxbytes = 0

0 comments on commit b1c76a9

Please sign in to comment.