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

Upgrade dependencies #203

Merged
merged 5 commits into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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
94 changes: 46 additions & 48 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ executors:
parameters:
erlang_version:
type: string
default: "22.0"
default: "24.3.4.5"
elixir_version:
type: string
default: "1.9"
default: "1.13.4"
env:
type: string
default: test
docker:
- image: mongooseim/beam-builder:erlang-<< parameters.erlang_version >>_elixir-<< parameters.elixir_version >>
- image: hexpm/elixir:<< parameters.elixir_version >>-erlang-<< parameters.erlang_version >>-ubuntu-focal-20211006
- image: mongooseim/fcm-mock-server
- image: kamilwaz/apns-mock-server
working_directory: ~/app
Expand All @@ -45,6 +45,16 @@ commands:
test:
steps:
- checkout
- run:
name: Install dockerize
command: |
apt-get update && apt-get install -y wget && \
wget https://github.com/jwilder/dockerize/releases/download/v0.6.1/dockerize-linux-amd64-v0.6.1.tar.gz && \
chmod +x dockerize-linux-amd64-v0.6.1.tar.gz && \
tar -C /usr/local/bin -xzvf dockerize-linux-amd64-v0.6.1.tar.gz && \
chmod +x /usr/local/bin/dockerize && \
rm dockerize-linux-amd64-v0.6.1.tar.gz
- run: apt-get update && apt-get install -y git
- restore_cache:
keys:
- mix-cache-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ .Revision }}
Expand Down Expand Up @@ -74,6 +84,7 @@ jobs:

steps:
- checkout
- run: apt-get update && apt-get install -y git
- run: mix local.hex --force
- run: mix local.rebar --force
- run: mix deps.get
Expand All @@ -89,6 +100,7 @@ jobs:
executor: elixir-builder
steps:
- checkout
- run: apt-get update && apt-get install -y git
- run: echo "$OTP_VERSION $ELIXIR_VERSION" > .version_file
- restore_cache:
keys:
Expand All @@ -111,21 +123,12 @@ jobs:
name: Execute dialyzer
command: mix deps.get && mix dialyzer --halt-exit-status

test-erlang-22_elixir-1-9:
executor:
name: elixir-builder
env: test
erlang_version: "22.0"
elixir_version: "1.9"
steps:
- test

build-dev-certs:
executor:
name: elixir-builder
env: dev
erlang_version: "22.0"
elixir_version: "1.9"
erlang_version: "24.3"
elixir_version: "1.13"
steps:
- checkout
- restore_cache:
Expand All @@ -142,48 +145,39 @@ jobs:
paths:
- priv

test-erlang-22_elixir-1-8:
test-erlang-24_elixir-1-13:
executor:
name: elixir-builder
env: test
erlang_version: "22.0"
elixir_version: "1.8"
erlang_version: "24.3.4.5"
elixir_version: "1.13.4"
steps:
- test

test-erlang-22_elixir-1-7:
test-erlang-24_elixir-1-12:
executor:
name: elixir-builder
env: test
erlang_version: "22.0"
elixir_version: "1.7"
erlang_version: "24.3.4.5"
elixir_version: "1.13.4"
steps:
- test

test-erlang-21_elixir-1-9:
test-erlang-23_elixir-1-13:
executor:
name: elixir-builder
env: test
erlang_version: "21.3"
elixir_version: "1.9"
erlang_version: "23.3.4.17"
elixir_version: "1.12.3"
steps:
- test

test-erlang-21_elixir-1-8:
test-erlang-23_elixir-1-12:
executor:
name: elixir-builder
env: test
erlang_version: "21.3"
elixir_version: "1.8"
steps:
- test

test-erlang-21_elixir-1-7:
executor:
name: elixir-builder
env: test
erlang_version: "21.3"
elixir_version: "1.7"
erlang_version: "23.3.4.17"
elixir_version: "1.12.3"
steps:
- test

Expand All @@ -203,6 +197,7 @@ jobs:
env: prod
steps:
- checkout
- run: apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y docker.io
- setup_remote_docker:
docker_layer_caching: true
- restore_cache:
Expand Down Expand Up @@ -234,21 +229,22 @@ jobs:
sudo apt-key add erlang_solutions.asc && \
echo 'deb https://packages.erlang-solutions.com/ubuntu focal contrib' | sudo tee /etc/apt/sources.list.d/esl.list && \
sudo apt-get update && \
sudo apt-get install -y esl-erlang=1:21.3.8.17-1 && \
sudo apt-get install -y elixir=1.10.2-1
sudo apt-get install -y esl-erlang=1:24.3.3-1 && \
sudo apt-get install -y elixir=1.13.0-1
wget https://github.com/jwilder/dockerize/releases/download/v0.6.1/dockerize-linux-amd64-v0.6.1.tar.gz && \
sudo chmod +x dockerize-linux-amd64-v0.6.1.tar.gz && \
sudo tar -C /usr/local/bin -xzvf dockerize-linux-amd64-v0.6.1.tar.gz && \
sudo chmod +x /usr/local/bin/dockerize && \
sudo rm dockerize-linux-amd64-v0.6.1.tar.gz

- run: docker-compose -v
- restore_cache:
keys:
- mix-cache-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ .Revision }}
- restore_cache:
keys:
- certs-cache-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ .Revision }}
- run: *DOCKER_TAGS
- run: mix local.hex --force && mix local.rebar --force
- run:
name: Compile mix deps
command: MIX_ENV=integration mix do deps.get, deps.compile
Expand All @@ -271,6 +267,7 @@ jobs:
env: prod
steps:
- checkout
- run: apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y docker.io
- setup_remote_docker:
docker_layer_caching: true
- run: *DOCKER_TAGS
Expand All @@ -289,17 +286,18 @@ jobs:

gh-pages-deploy:
machine:
image: ubuntu-1604:201903-01
image: ubuntu-2004:2022.07.1
steps:
- checkout
- run:
name: Install elixir
command: |
wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb && \
sudo dpkg -i erlang-solutions_1.0_all.deb && \
wget https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc && \
sudo apt-key add erlang_solutions.asc && \
echo 'deb https://packages.erlang-solutions.com/ubuntu focal contrib' | sudo tee /etc/apt/sources.list.d/esl.list && \
sudo apt-get update && \
sudo apt-get install -y esl-erlang=1:21.0 && \
sudo apt-get install -y elixir=1.8.0-1
sudo apt-get install -y esl-erlang=1:24.3.3-1 && \
sudo apt-get install -y elixir=1.13.0-1
- restore_cache:
keys:
- mix-cache-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ .Revision }}
Expand Down Expand Up @@ -343,19 +341,19 @@ workflows:
requires:
- pre-build
filters: *all_tags
- test-erlang-22_elixir-1-9:
- test-erlang-24_elixir-1-13:
requires:
- pre-build
filters: *all_tags
- test-erlang-22_elixir-1-8:
- test-erlang-24_elixir-1-12:
requires:
- pre-build
filters: *all_tags
- test-erlang-21_elixir-1-9:
- test-erlang-23_elixir-1-13:
requires:
- pre-build
filters: *all_tags
- test-erlang-21_elixir-1-8:
- test-erlang-23_elixir-1-12:
requires:
- pre-build
filters: *all_tags
Expand All @@ -373,7 +371,7 @@ workflows:
requires:
- integration-tests
- build-docker-image
- test-erlang-22_elixir-1-9
- test-erlang-23_elixir-1-13
filters: *all_tags

- gh-pages-deploy:
Expand Down
16 changes: 11 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
FROM rslota/beam-builder:erlang-22.0_elixir-1.9 AS builder
ARG ELIXIR_VERSION=1.13.4
ARG OTP_VERSION=24.3.4.5

FROM hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-ubuntu-focal-20211006 as builder

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
git \
software-properties-common

USER root

Expand All @@ -8,7 +15,7 @@ ENV MIX_ENV=prod

COPY mix.exs mix.lock ./
COPY config config
COPY asn.1 asn.1
COPY asn1 asn1
COPY rel rel
COPY lib lib
COPY priv priv
Expand All @@ -23,7 +30,7 @@ RUN mix do certs.dev, distillery.release
RUN tar -czf mongoose_push.tar.gz -C _build/prod/rel/mongoose_push .


FROM debian:stretch-slim
FROM ubuntu:20.04
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the final docker image inside which the built MongoosePush will run. We used debian:stretch-slim to make the final image as small as possible. Do we have something similar to ubuntu:20.04 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, not. I changed the final image back to debian.



# set locales
Expand All @@ -37,14 +44,13 @@ ENV LANGUAGE en_US.UTF-8
ENV LC_ALL en_US.UTF-8

# required packages
RUN echo 'deb http://deb.debian.org/debian jessie main' >> /etc/apt/sources.list
RUN apt-get update && apt-get upgrade -y && apt-get install --no-install-recommends -y \
bash \
bash-completion \
curl \
dnsutils \
libtinfo6 \
libssl1.1 \
libssl1.0.0 \
vim && \
apt-get clean

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
use Mix.Config
import Config

config :logger,
handle_otp_reports: true,
Expand Down
2 changes: 1 addition & 1 deletion config/dev.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use Mix.Config
import Config

config :mongoose_push,
openapi: [
Expand Down
2 changes: 1 addition & 1 deletion config/integration.exs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
use Mix.Config
import Config
2 changes: 1 addition & 1 deletion config/prod.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use Mix.Config
import Config

config :mix_docker, image: "mongoose_push"

Expand Down
2 changes: 1 addition & 1 deletion config/test.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use Mix.Config
import Config

config :mongoose_push, :logging,
level: :error,
Expand Down
36 changes: 0 additions & 36 deletions lib/mix/tasks/compile_asn1.ex

This file was deleted.

20 changes: 14 additions & 6 deletions lib/mongoose_push/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ defmodule MongoosePush.Application do
use Application
require Logger

# APNS supports only:
# - ECDHE-RSA-AES128-GCM-SHA256
# - ECDHE-RSA-AES256-GCM-SHA384
@apns_ciphers [
%{key_exchange: :ecdhe_rsa, cipher: :aes_128_gcm, mac: :aead, prf: :sha256},
%{key_exchange: :ecdhe_rsa, cipher: :aes_256_gcm, mac: :aead, prf: :sha384}
]

@typedoc "Possible keys in FCM config"
@type fcm_key :: :key | :pool_size | :mode | :endpoint
@typedoc "Possible keys in APNS config"
Expand Down Expand Up @@ -209,12 +217,12 @@ defmodule MongoosePush.Application do
end
end

defp check_apns_ciphers() do
apns_ciphers_present =
Enum.any?(:ssl.cipher_suites(), fn x ->
x == {:ecdhe_rsa, :aes_128_gcm, :aead, :sha256} ||
x == {:ecdhe_rsa, :aes_256_gcm, :aead, :sha384}
end)
def check_apns_ciphers() do
all_ciphers =
:ssl.versions()[:supported]
|> Enum.flat_map(&:ssl.cipher_suites(:all, &1))

apns_ciphers_present = Enum.any?(all_ciphers, &(&1 in @apns_ciphers))

case apns_ciphers_present do
true ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ defmodule MongoosePushWeb.APIv1.NotificationController do
%Operation{
tags: ["apiv1"],
summary: "sends a push",
deprecated: true,
description: "performs the sending of push notification",
operationId: "APIv1.NotificationController.send",
parameters: [
Expand Down
Loading