Skip to content

Commit ead4a7d

Browse files
authored
Release selfhosted (#341)
* Optimize Dockerfile * Update selfhosting documentation * Remove unnecessary files * Remove internal config stuff * Update config * WIP * Use BASE_URL instead of HOST and SCHEME * Add port to endpoint url config * Make config/config.exs on par with config/releases.exs * Add changelog entry * Document configuration change
1 parent 431c02a commit ead4a7d

21 files changed

+61
-484
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,8 @@ All notable changes to this project will be documented in this file.
88

99
### Changed
1010
- Replace configuration parameters `CLICKHOUSE_DATABASE_{HOST,NAME,USER,PASSWORD}` with a single `CLICKHOUSE_DATABASE_URL` [plausible/analytics#317](https://github.com/plausible/analytics/pull/317)
11+
- Disable subscriptions by default
12+
- Remove `CLICKHOUSE_DATABASE_POOLSIZE`, `DATABASE_POOLSIZE` and `DATABASE_TLS_ENABLED` parameters. Use query parameters in `CLICKHOUSE_DATABASE_URL` and `DATABASE_URL` instead.
13+
- Remove `HOST` and `SCHEME` parameters in favor of a single `BASE_URL` parameter.
14+
- Make `Bamboo.SMTPAdapter` the default as opposed to `Bamboo.PostmarkAdapter`
15+
- Disable subscription flow by default

Dockerfile

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,27 @@ RUN set -x \
3737
&& gosu --version \
3838
&& gosu nobody true
3939

40-
COPY config ./config
41-
COPY assets ./assets
42-
COPY tracker ./tracker
43-
COPY priv ./priv
44-
COPY lib ./lib
4540
COPY mix.exs ./
4641
COPY mix.lock ./
4742
RUN mix local.hex --force && \
4843
mix local.rebar --force && \
4944
mix deps.get --only prod && \
5045
mix deps.compile
5146

47+
COPY assets/package.json assets/package-lock.json ./assets/
48+
COPY tracker/package.json tracker/package-lock.json ./tracker/
49+
5250
RUN npm audit fix --prefix ./assets && \
5351
npm install --prefix ./assets && \
54-
npm run deploy --prefix ./assets && \
55-
npm install --prefix ./tracker && \
52+
npm install --prefix ./trackerc
53+
54+
COPY assets ./assets
55+
COPY tracker ./tracker
56+
COPY config ./config
57+
COPY priv ./priv
58+
COPY lib ./lib
59+
60+
RUN npm run deploy --prefix ./assets && \
5661
npm run deploy --prefix ./tracker && \
5762
mix phx.digest priv/static
5863

HOSTING.md

Lines changed: 0 additions & 212 deletions
This file was deleted.

config/config.exs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
use Mix.Config
22

3+
base_url = System.get_env("BASE_URL", "http://localhost:8000")
4+
|> URI.parse
5+
36
config :plausible,
47
admin_user: System.get_env("ADMIN_USER_NAME", "admin"),
58
admin_email: System.get_env("ADMIN_USER_EMAIL", "[email protected]"),
@@ -22,8 +25,9 @@ config :plausible, :selfhost,
2225
# Configures the endpoint
2326
config :plausible, PlausibleWeb.Endpoint,
2427
url: [
25-
host: System.get_env("HOST", "localhost"),
26-
scheme: System.get_env("SCHEME", "http")
28+
host: base_url.host,
29+
scheme: base_url.scheme,
30+
port: base_url.port
2731
],
2832
http: [
2933
port: String.to_integer(System.get_env("PORT", "8000"))
@@ -77,24 +81,21 @@ config :plausible, :paddle,
7781

7882
config :plausible, Plausible.ClickhouseRepo,
7983
loggers: [Ecto.LogEntry],
80-
pool_size: String.to_integer(System.get_env("CLICKHOUSE_DATABASE_POOLSIZE", "5")),
8184
url: System.get_env(
8285
"CLICKHOUSE_DATABASE_URL",
8386
"http://127.0.0.1:8123/plausible_test"
8487
)
8588

8689
config :plausible,
8790
Plausible.Repo,
88-
pool_size: String.to_integer(System.get_env("DATABASE_POOLSIZE", "10")),
8991
timeout: 300_000,
9092
connect_timeout: 300_000,
9193
handshake_timeout: 300_000,
9294
url:
9395
System.get_env(
9496
"DATABASE_URL",
9597
"postgres://postgres:[email protected]:5432/plausible_dev?currentSchema=default"
96-
),
97-
ssl: String.to_existing_atom(System.get_env("DATABASE_TLS_ENABLED", "false"))
98+
)
9899

99100
cron_enabled = String.to_existing_atom(System.get_env("CRON_ENABLED", "false"))
100101

@@ -159,7 +160,7 @@ case mailer_adapter do
159160
password: System.fetch_env!("SMTP_USER_PWD"),
160161
tls: :if_available,
161162
allowed_tls_versions: [:tlsv1, :"tlsv1.1", :"tlsv1.2"],
162-
ssl: System.get_env("SMTP_HOST_SSL_ENABLED") || true,
163+
ssl: System.get_env("SMTP_HOST_SSL_ENABLED") || false,
163164
retries: System.get_env("SMTP_RETRIES") || 2,
164165
no_mx_lookups: System.get_env("SMTP_MX_LOOKUPS_ENABLED") || true,
165166
auth: :if_available

0 commit comments

Comments
 (0)