Skip to content

Commit

Permalink
Revert config development (#514)
Browse files Browse the repository at this point in the history
* Revert "Add development docker-compose service (#489)"

This reverts commit 88fff09.

* Revert "Update dockerfile and add missing nodejs to tools (#486)"

This reverts commit 6618b2e.
  • Loading branch information
arbulu89 authored May 10, 2022
1 parent 51f6997 commit 49932e2
Show file tree
Hide file tree
Showing 15 changed files with 254 additions and 353 deletions.
5 changes: 3 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/.github
/.pgdata/
/_build/
/assets/node_modules/
/deps/
/doc/
/priv/static/assets
/test/
/tmp/
/.pgdata/
8 changes: 4 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ jobs:
postgres:
image: postgres
env:
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_PASSWORD: postgres
POSTGRES_DB: trento_test
ports:
- 5432:5432
- 5433:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
Expand Down Expand Up @@ -180,10 +180,10 @@ jobs:
postgres:
image: postgres
env:
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_PASSWORD: postgres
POSTGRES_DB: trento_dev
ports:
- 5432:5432
- 5433:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
Expand Down
3 changes: 1 addition & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
elixir 1.13.1-otp-24
erlang 24.3.3
nodejs 16.14.1
erlang 24.3.3
6 changes: 1 addition & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

We're really glad you're reading this, because we need volunteer developers to help this project come to fruition.

## Getting started

Please refer to the [development notes](docs/development/hacking_trento.md) for more information.

## Submitting changes

Please send a [GitHub Pull Request to Trento](https://github.com/trento-project/web/pull/new/main) with a clear list of what you've done (read more about [pull requests](http://help.github.com/pull-requests/)).
Expand All @@ -16,4 +12,4 @@ Always write a clear log message for your commits. One-line messages are fine fo
git commit -m "A brief summary of the commit
A paragraph describing what changed and its impact."
```
```
48 changes: 24 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
FROM registry.opensuse.org/opensuse/leap:15.4 AS system
FROM opensuse/leap AS elixir-build
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
RUN zypper -n addrepo https://download.opensuse.org/repositories/devel:/languages:/erlang/15.4/devel:languages:erlang.repo &&\
zypper -n --gpg-auto-import-keys ref -s &&\
zypper -n in inotify-tools elixir nodejs16 npm16
WORKDIR /source
RUN mix local.rebar --force &&\
mix local.hex --force

FROM system AS deps
RUN zypper -n addrepo https://download.opensuse.org/repositories/devel:/languages:/erlang/SLE_15_SP3/devel:languages:erlang.repo
RUN zypper -n --gpg-auto-import-keys ref -s
RUN zypper -n in elixir
COPY . /build
WORKDIR /build
ENV MIX_ENV=prod
COPY ./mix.* /source/
COPY assets/package*.json /source/assets/
RUN mix install
RUN mix local.rebar --force \
&& mix local.hex --force \
&& mix deps.get

FROM deps AS full
LABEL org.opencontainers.image.version="rolling-full"
LABEL org.opencontainers.image.source="https://github.com/trento-project/web"
COPY . /source
RUN mix assets.deploy &&\
mix release --path /app
WORKDIR /app
EXPOSE 4000/tcp
ENTRYPOINT ["/app/bin/trento"]
FROM registry.suse.com/bci/nodejs:16 AS assets-build
COPY --from=elixir-build /build /build
WORKDIR /build/assets
RUN npm install
RUN npm run tailwind:build
RUN npm run build

FROM elixir-build AS release
COPY --from=assets-build /build /build
WORKDIR /build
ENV MIX_ENV=prod
RUN mix phx.digest
RUN mix release

FROM registry.suse.com/bci/bci-base:15.4 AS minimal
LABEL org.opencontainers.image.version="rolling"
FROM registry.suse.com/bci/bci-base:15.3 AS trento
LABEL org.opencontainers.image.source="https://github.com/trento-project/web"
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
# tar is required by kubectl cp
RUN zypper -n in tar
WORKDIR /app
COPY --from=full /app .
COPY --from=release /build/_build/prod/rel/trento .
EXPOSE 4000/tcp
ENTRYPOINT ["/app/bin/trento"]
35 changes: 17 additions & 18 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,15 @@
# General application configuration
import Config

config :trento,
ecto_repos: [Trento.Repo]

# Configures the endpoint
config :trento, TrentoWeb.Endpoint,
http: [
# Enable IPv6 and bind on all interfaces.
# Set it to {0, 0, 0, 0, 0, 0, 0, 1} for local network only access.
# See the documentation on https://hexdocs.pm/plug_cowboy/Plug.Cowboy.html
# for details about using IPv6 vs IPv4 and loopback vs public addresses.
ip: {0, 0, 0, 0, 0, 0, 0, 0},
port: 4000
],
url: [host: "localhost"],
render_errors: [view: TrentoWeb.ErrorView, accepts: ~w(html json), layout: false],
pubsub_server: Trento.PubSub
pubsub_server: Trento.PubSub,
live_view: [signing_salt: "4tNZ+tm7"]

# Configures the mailer
#
Expand All @@ -32,7 +29,10 @@ config :trento, Trento.Mailer, adapter: Swoosh.Adapters.Local
# Swoosh API client is needed for adapters other than SMTP.
config :swoosh, :api_client, false

config :trento, :alerting, enabled: true
# configure the recipient for alert notifications
config :trento, :alerting,
enabled: true,
recipient: "[email protected]"

# Configure esbuild (the version is required)
config :esbuild,
Expand Down Expand Up @@ -60,16 +60,10 @@ config :trento, Trento.Commanded,
pubsub: :local,
registry: :local

config :trento,
ecto_repos: [Trento.Repo]

config :trento, Trento.Repo, pool_size: 10

config :trento, Trento.EventStore,
serializer: Trento.JsonbSerializer,
column_data_type: "jsonb",
types: EventStore.PostgresTypes,
pool_size: 10
types: EventStore.PostgresTypes

config :trento, event_stores: [Trento.EventStore]

Expand Down Expand Up @@ -112,7 +106,12 @@ config :trento, Trento.Scheduler,
config :trento, Trento.Integration.Telemetry, adapter: Trento.Integration.Telemetry.Suse
config :trento, Trento.Integration.Checks, adapter: Trento.Integration.Checks.Runner

config :trento, :grafana, dashboards: ["node_exporter"]
config :trento, :grafana,
user: "admin",
password: "admin",
public_url: "http://localhost:3000",
api_url: "http://localhost:3000/api",
dashboards: ["node_exporter"]

config :trento,
uuid_namespace: "fb92284e-aa5e-47f6-a883-bf9469e7a0dc",
Expand Down
30 changes: 15 additions & 15 deletions config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,22 @@ import Config

# Configure your database
config :trento, Trento.Repo,
url: "postgres://postgres@localhost:5432/trento_dev",
username: "postgres",
password: "postgres",
database: "trento_dev",
hostname: "localhost",
port: 5433,
show_sensitive_data_on_connection_error: true,
pool_size: 10,
log: false

config :trento, Trento.EventStore,
url: "postgres://postgres@localhost:5432/trento_eventstore_dev",
show_sensitive_data_on_connection_error: true,
log: false
username: "postgres",
password: "postgres",
database: "trento_eventstore_dev",
hostname: "localhost",
port: 5433,
pool_size: 10

# For development, we disable any cache and enable
# debugging and code reloading.
Expand All @@ -18,11 +26,13 @@ config :trento, Trento.EventStore,
# watchers to your application. For example, we use it
# with esbuild to bundle .js and .css sources.
config :trento, TrentoWeb.Endpoint,
# Binding to loopback ipv4 address prevents access from other machines.
# Change to `ip: {0, 0, 0, 0}` to allow access from other machines.
http: [ip: {0, 0, 0, 0}, port: 4000],
check_origin: false,
code_reloader: true,
debug_errors: true,
secret_key_base: "s2ZdE+3+ke1USHEJ5O45KT364KiXPYaB9cJPdH3p60t8yT0nkLexLBNw8TFSzC7k",
live_view: [signing_salt: "4tNZ+tm7"],
watchers: [
node: [
"build.js",
Expand Down Expand Up @@ -100,13 +110,3 @@ config :phoenix, :stacktrace_depth, 20
config :phoenix, :plug_init_mode, :runtime

config :trento, :api_key_authentication, enabled: false

config :trento, :grafana,
user: "admin",
password: "admin",
public_url: "http://localhost:3000",
api_url: "http://localhost:3000/api"

config :trento, Trento.Integration.Checks.Runner, runner_url: "http://localhost:8080"

config :trento, :alerting, recipient: "[email protected]"
11 changes: 1 addition & 10 deletions config/prod.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,7 @@ config :trento, TrentoWeb.Endpoint,
cache_static_manifest: "priv/static/cache_manifest.json",
server: true

config :trento, Trento.Mailer,
adapter: Swoosh.Adapters.SMTP,
auth: :always,
ssl: :if_available,
tls: :if_available

config :swoosh, local: false

# Do not print debug messages in production
config :logger, level: :info

# alerting is usually enabled by default, but it's the opposite in prod
config :trento, :alerting, enabled: false
# config :logger, level: :info
Loading

0 comments on commit 49932e2

Please sign in to comment.