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

feat: retry apns notifications on 429 response code #50

Merged
merged 16 commits into from
Mar 19, 2024
Merged
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
3 changes: 2 additions & 1 deletion .github/workflows/integration-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ jobs:
- name: Install dependencies
run: |
cd /go/src/github.com/topfreegames/pusher
dep ensure
go mod tidy
go mod vendor
- name: Initialize DB for testing
run: |
cd /go/src/github.com/topfreegames/pusher
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:
- 'Dockerfile.ci-test'
- '.dockerignore'
- '.github/workflows/*-tests.yaml'
pull_request:
branches:
- '**'
jobs:
test:
name: Build, Unit Tests and Linter
Expand Down Expand Up @@ -42,8 +45,6 @@ jobs:
restore-keys: |
${{ runner.os }}-build-${{ hashFiles('Gopkg.lock') }}
${{ runner.os }}-build-
- name: Install dependencies
run: docker run -v $PWD:/go/src/github.com/topfreegames/pusher tfgco/pusher:ci-test dep ensure
- name: Build
run: docker run -v $PWD:/go/src/github.com/topfreegames/pusher tfgco/pusher:ci-test go build -v -o bin/pusher main.go
- name: Test
Expand Down
34 changes: 18 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#
# Copyright (c) 2016 TFG Co <[email protected]>
# Author: TFG Co <[email protected]>
# Permission is hereby granted, free of charge, to any person obtaining a copy
Expand All @@ -18,31 +17,34 @@
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

FROM golang:1.10-alpine AS dependencies

Label MAINTAINER="TFG Co <[email protected]>"
FROM golang:1.21 AS dependencies

ENV LIBRDKAFKA_VERSION 0.11.5
ENV LIBRDKAFKA_VERSION 2.2.0
ENV CPLUS_INCLUDE_PATH /usr/local/include
ENV LIBRARY_PATH /usr/local/lib
ENV LD_LIBRARY_PATH /usr/local/lib

WORKDIR /go/src/github.com/topfreegames/pusher

RUN apk add --no-cache make git g++ bash python wget pkgconfig && \
wget -O /root/librdkafka-${LIBRDKAFKA_VERSION}.tar.gz https://github.com/edenhill/librdkafka/archive/v${LIBRDKAFKA_VERSION}.tar.gz && \
tar -xzf /root/librdkafka-${LIBRDKAFKA_VERSION}.tar.gz -C /root && \
cd /root/librdkafka-${LIBRDKAFKA_VERSION} && \
./configure && make && make install && make clean && ./configure --clean && \
go get -u github.com/golang/dep/cmd/dep && \
mkdir -p /go/src/github.com/topfreegames/pusher
# RUN apk add --no-cache make git g++ bash python wget pkgconfig && \
# wget -O /root/librdkafka-${LIBRDKAFKA_VERSION}.tar.gz https://github.com/confluentinc/librdkafka/archive/v${LIBRDKAFKA_VERSION}.tar.gz && \
# tar -xzf /root/librdkafka-${LIBRDKAFKA_VERSION}.tar.gz -C /root && \
# cd /root/librdkafka-${LIBRDKAFKA_VERSION} && \
# ./configure && make && make install && make clean && ./configure --clean && \
# mkdir -p /go/src/github.com/topfreegames/pusher

RUN apt update && \
apt install -y wget && \
wget -qO - https://packages.confluent.io/deb/7.5/archive.key | apt-key add - && \
apt update && \
apt install -y librdkafka-dev

RUN mkdir -p /go/src/github.com/topfreegames/pusher

ADD . /go/src/github.com/topfreegames/pusher

RUN dep ensure && \
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH && \
make build && \
mkdir /app && \
RUN make build
RUN mkdir /app && \
mv /go/src/github.com/topfreegames/pusher/bin/pusher /app/pusher && \
mv /go/src/github.com/topfreegames/pusher/config /app/config && \
mv /go/src/github.com/topfreegames/pusher/tls /app/tls && \
Expand Down
45 changes: 15 additions & 30 deletions Dockerfile.ci-test
Original file line number Diff line number Diff line change
Expand Up @@ -18,45 +18,30 @@
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

FROM golang:1.10
FROM golang:1.21

ENV LIBRDKAFKA_VERSION 0.11.5
ENV CPLUS_INCLUDE_PATH /usr/local/include
ENV LIBRARY_PATH /usr/local/lib
ENV LD_LIBRARY_PATH /usr/local/lib
ENV GOLANGCI_LINT_VERSION 1.15.0
ENV GINKGO_VERSION 1.4.0

RUN apt-get install make git g++ bash python wget pkg-config
RUN apt update
RUN apt install -y postgresql
RUN export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
RUN wget --no-check-certificate -O /root/librdkafka-${LIBRDKAFKA_VERSION}.tar.gz https://github.com/edenhill/librdkafka/archive/v${LIBRDKAFKA_VERSION}.tar.gz && \
tar -xzf /root/librdkafka-${LIBRDKAFKA_VERSION}.tar.gz -C /root && \
cd /root/librdkafka-${LIBRDKAFKA_VERSION} && \
./configure && make && make install && make clean && ./configure --clean
RUN apt update \
&& apt install -y wget \
&& wget -qO - https://packages.confluent.io/deb/7.5/archive.key | apt-key add - \
&& apt update \
&& apt install -y librdkafka-dev \
&& apt install -y postgresql

# golangci-lint
RUN wget -O /go/bin/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCI_LINT_VERSION}/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz && \
tar -xzf /go/bin/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz -C /go/bin && \
mv /go/bin/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64/golangci-lint /go/bin/ && \
rm -rf /go/bin/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64 && \
rm /go/bin/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz
ENV GOLANGCI_LINT_VERSION 1.15.0
RUN wget -O /go/bin/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCI_LINT_VERSION}/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz \
&& tar -xzf /go/bin/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz -C /go/bin \
&& mv /go/bin/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64/golangci-lint /go/bin/ \
&& rm -rf /go/bin/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64 \
&& rm /go/bin/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz

# ginkgo
RUN wget -O /go/bin/ginkgo-${GINKGO_VERSION}.tar.gz https://github.com/onsi/ginkgo/archive/refs/tags/v${GINKGO_VERSION}.tar.gz && \
mkdir -p /go/src/github.com/onsi && \
tar -xzf /go/bin/ginkgo-${GINKGO_VERSION}.tar.gz -C /go/src/github.com/onsi && \
mv /go/src/github.com/onsi/ginkgo-${GINKGO_VERSION} /go/src/github.com/onsi/ginkgo && \
go build -o /go/bin/ginkgo /go/src/github.com/onsi/ginkgo/ginkgo/*.go && \
rm -rf /go/bin/ginkgo-${GINKGO_VERSION} && \
rm /go/bin/ginkgo-${GINKGO_VERSION}.tar.gz && \
rm -rf /go/src

RUN go get -u github.com/golang/dep/cmd/dep
ENV GINKGO_VERSION 1.16.5
RUN go install github.com/onsi/ginkgo/ginkgo@v${GINKGO_VERSION}

WORKDIR /go/src/github.com/topfreegames/pusher

ADD . /go/src/github.com/topfreegames/pusher

# `dep ensure` must be run in the ci script using volumes to cache `vendor` dir
58 changes: 21 additions & 37 deletions Dockerfile.local
Original file line number Diff line number Diff line change
Expand Up @@ -18,64 +18,48 @@
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

FROM golang:1.10
FROM golang:1.21

ENV LIBRDKAFKA_VERSION 0.11.5
ENV CPLUS_INCLUDE_PATH /usr/local/include
ENV LIBRARY_PATH /usr/local/lib
ENV LD_LIBRARY_PATH /usr/local/lib
ENV KAFKA_DEV_VERSION 3.3.2
ENV KAFKA_SCRIPTS_VERSION 2.13-${KAFKA_DEV_VERSION}
ENV GOLANGCI_LINT_VERSION 1.15.0
ENV GINKGO_VERSION 1.4.0

RUN apt-get install \
make \
git \
g++ \
bash \
python \
wget \
pkg-config
RUN export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
RUN wget --no-check-certificate -O /root/librdkafka-${LIBRDKAFKA_VERSION}.tar.gz https://github.com/edenhill/librdkafka/archive/v${LIBRDKAFKA_VERSION}.tar.gz \
&& tar -xzf /root/librdkafka-${LIBRDKAFKA_VERSION}.tar.gz -C /root \
&& cd /root/librdkafka-${LIBRDKAFKA_VERSION} \
&& ./configure && make && make install && make clean && ./configure --clean

RUN apt update
RUN apt update \
&& apt install -y wget \
&& wget -qO - https://packages.confluent.io/deb/7.5/archive.key | apt-key add - \
&& apt update \
&& apt install -y librdkafka-dev

# psql to test db connection
RUN apt install -y postgresql

# kafka bin to test kafka connection, available at /root/kafka/bin/<script_name>
RUN apt install -y openjdk-8-jdk
RUN wget --no-check-certificate -O /root/kafka_${KAFKA_SCRIPTS_VERSION}.tgz https://dlcdn.apache.org/kafka/${KAFKA_DEV_VERSION}/kafka_${KAFKA_SCRIPTS_VERSION}.tgz \
&& tar -xzf /root/kafka_${KAFKA_SCRIPTS_VERSION}.tgz -C /root \
&& mv /root/kafka_${KAFKA_SCRIPTS_VERSION} /root/kafka \
&& rm /root/kafka_${KAFKA_SCRIPTS_VERSION}.tgz
# kafka bin to test kafka connection, available at /opt/kafka/bin/<script_name>
RUN wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | tee /etc/apt/keyrings/adoptium.asc \
&& echo "deb [signed-by=/etc/apt/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list \
&& apt update \
&& apt install -y temurin-8-jdk
ENV KAFKA_DEV_VERSION 3.6.0
ENV KAFKA_SCRIPTS_VERSION 2.13-${KAFKA_DEV_VERSION}
RUN wget --no-check-certificate -O /opt/kafka_${KAFKA_SCRIPTS_VERSION}.tgz https://dlcdn.apache.org/kafka/${KAFKA_DEV_VERSION}/kafka_${KAFKA_SCRIPTS_VERSION}.tgz \
&& tar -xzf /opt/kafka_${KAFKA_SCRIPTS_VERSION}.tgz -C /opt \
&& mv /opt/kafka_${KAFKA_SCRIPTS_VERSION} /opt/kafka \
&& rm /opt/kafka_${KAFKA_SCRIPTS_VERSION}.tgz \
&& export PATH=$PATH:/opt/kafka/bin

# golangci-lint
ENV GOLANGCI_LINT_VERSION 1.15.0
RUN wget -O /go/bin/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCI_LINT_VERSION}/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz \
&& tar -xzf /go/bin/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz -C /go/bin \
&& mv /go/bin/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64/golangci-lint /go/bin/ \
&& rm -rf /go/bin/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64 \
&& rm /go/bin/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz

# ginkgo
RUN wget -O /ginkgo-v${GINKGO_VERSION}.tar.gz https://github.com/onsi/ginkgo/archive/refs/tags/v${GINKGO_VERSION}.tar.gz \
&& mkdir -p /go/src/github.com/onsi \
&& tar -xzf /ginkgo-v${GINKGO_VERSION}.tar.gz -C /go/src/github.com/onsi \
&& mv /go/src/github.com/onsi/ginkgo-${GINKGO_VERSION} /go/src/github.com/onsi/ginkgo \
&& cd /go/src/github.com/onsi/ginkgo/ginkgo \
&& go build -o /go/bin/ginkgo . \
&& rm -rf /ginkgo-v${GINKGO_VERSION}.tar.gz
ENV GINKGO_VERSION 1.16.5
RUN go install github.com/onsi/ginkgo/ginkgo@v${GINKGO_VERSION}

# vim to ease development
RUN apt install -y vim

RUN go get -u github.com/golang/dep/cmd/dep

WORKDIR /go/src/github.com/topfreegames/pusher

CMD bash
Loading
Loading