Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Upgrade erlang/elixir/alpine stack (#2695)

Adam Rutkowskiecb552479faa
diff --git a/.github/workflows/elixir.yml b/.github/workflows/elixir.yml
index 1b2e7e811d..934dff1c80 100644
--- a/.github/workflows/elixir.yml
+++ b/.github/workflows/elixir.yml
@@ -58,8 +58,8 @@ jobs:
deps
_build
priv/plts
- key: ${{ runner.os }}-mix-v2-${{ hashFiles('**/mix.lock') }}
- restore-keys: ${{ runner.os }}-mix-v2-
+ key: ${{ runner.os }}-mix-v3-${{ hashFiles('**/mix.lock') }}
+ restore-keys: ${{ runner.os }}-mix-v3-
- name: Install dependencies
run: mix deps.get && npm install --prefix ./tracker
- name: Check Formatting
diff --git a/.tool-versions b/.tool-versions
index 01339e781b..0850981c49 100644
--- a/.tool-versions
+++ b/.tool-versions
@@ -1,4 +1,4 @@
-elixir 1.13.4-otp-24
-erlang 24.3.3
+erlang 25.2.3
+elixir 1.14.3-otp-25
nodejs 16.3.0
python 3.9.12
diff --git a/Dockerfile b/Dockerfile
index d117c558aa..b8eda2de6a 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -2,17 +2,18 @@
# platform specific, it makes sense to build it in the docker
#### Builder
-FROM hexpm/elixir:1.13.4-erlang-24.3.3-alpine-3.15.3 as buildcontainer
+FROM hexpm/elixir:1.14.3-erlang-25.2.3-alpine-3.17.0 as buildcontainer
# preparation
ENV MIX_ENV=prod
ENV NODE_ENV=production
+ENV NODE_OPTIONS=--openssl-legacy-provider
RUN mkdir /app
WORKDIR /app
# install build dependencies
-RUN apk add --no-cache git nodejs yarn python3 npm ca-certificates wget gnupg make erlang gcc libc-dev && \
+RUN apk add --no-cache git nodejs yarn python3 npm ca-certificates wget gnupg make gcc libc-dev && \
npm install npm@latest -g && \
npm install -g webpack
@@ -47,8 +48,8 @@ COPY rel rel
RUN mix release plausible
# Main Docker Image
-FROM alpine:3.15.3
-LABEL maintainer="tckb <[email protected]>"
+FROM alpine:3.17.0@sha256:c0d488a800e4127c334ad20d61d7bc21b4097540327217dfab52262adc02380c
+LABEL maintainer="plausible.io <[email protected]>"
ARG BUILD_METADATA={}
ENV BUILD_METADATA=$BUILD_METADATA
diff --git a/lib/plausible/ingestion/request.ex b/lib/plausible/ingestion/request.ex
index f557cdde4d..a233525277 100644
--- a/lib/plausible/ingestion/request.ex
+++ b/lib/plausible/ingestion/request.ex
@@ -37,7 +37,7 @@ defmodule Plausible.Ingestion.Request do
|> Changeset.change()
|> Changeset.put_change(
:timestamp,
- NaiveDateTime.utc_now()
+ NaiveDateTime.utc_now() |> NaiveDateTime.truncate(:second)
)
case parse_body(conn) do
diff --git a/lib/plausible/site/schema.ex b/lib/plausible/site/schema.ex
deleted file mode 100644
index 8b13789179..0000000000
--- a/lib/plausible/site/schema.ex
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/test/plausible_web/controllers/stats_controller_test.exs b/test/plausible_web/controllers/stats_controller_test.exs
index 71156ef1a7..23b9a4c0e7 100644
--- a/test/plausible_web/controllers/stats_controller_test.exs
+++ b/test/plausible_web/controllers/stats_controller_test.exs
@@ -191,7 +191,8 @@ defmodule PlausibleWeb.StatsControllerTest do
subdivision1_code: "EE-37",
city_geoname_id: 588_409,
pathname: "/",
- timestamp: Timex.shift(~N[2021-10-20 12:00:00], minutes: -1),
+ timestamp:
+ Timex.shift(~N[2021-10-20 12:00:00], minutes: -1) |> NaiveDateTime.truncate(:second),
referrer_source: "Google",
user_id: 123
),
@@ -200,7 +201,8 @@ defmodule PlausibleWeb.StatsControllerTest do
subdivision1_code: "EE-37",
city_geoname_id: 588_409,
pathname: "/some-other-page",
- timestamp: Timex.shift(~N[2021-10-20 12:00:00], minutes: -2),
+ timestamp:
+ Timex.shift(~N[2021-10-20 12:00:00], minutes: -2) |> NaiveDateTime.truncate(:second),
referrer_source: "Google",
user_id: 123
),
@@ -211,23 +213,27 @@ defmodule PlausibleWeb.StatsControllerTest do
utm_source: "google",
utm_content: "content",
utm_term: "term",
- timestamp: Timex.shift(~N[2021-10-20 12:00:00], days: -1),
+ timestamp:
+ Timex.shift(~N[2021-10-20 12:00:00], days: -1) |> NaiveDateTime.truncate(:second),
browser: "ABrowserName"
),
build(:pageview,
- timestamp: Timex.shift(~N[2021-10-20 12:00:00], months: -1),
+ timestamp:
+ Timex.shift(~N[2021-10-20 12:00:00], months: -1) |> NaiveDateTime.truncate(:second),
country_code: "EE",
browser: "ABrowserName"
),
build(:pageview,
- timestamp: Timex.shift(~N[2021-10-20 12:00:00], months: -5),
+ timestamp:
+ Timex.shift(~N[2021-10-20 12:00:00], months: -5) |> NaiveDateTime.truncate(:second),
utm_campaign: "ads",
country_code: "EE",
referrer_source: "Google",
browser: "ABrowserName"
),
build(:event,
- timestamp: Timex.shift(~N[2021-10-20 12:00:00], days: -1),
+ timestamp:
+ Timex.shift(~N[2021-10-20 12:00:00], days: -1) |> NaiveDateTime.truncate(:second),
name: "Signup",
"meta.key": ["variant"],
"meta.value": ["A"]