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: Lenra routes #385

Merged
merged 9 commits into from
Jun 8, 2023
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
2 changes: 1 addition & 1 deletion apps/lenra/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ defmodule Lenra.MixProject do
{:libcluster, "~> 3.3.1"},
{:application_runner,
git: "https://github.com/lenra-io/application-runner.git",
ref: "v1.0.0-beta.121",
ref: "v1.0.0-beta.124",
submodules: true},
{:lenra_common, git: "https://github.com/lenra-io/lenra-common.git", tag: "v2.6.0"}
]
Expand Down
3 changes: 2 additions & 1 deletion apps/lenra_web/lib/lenra_web/channels/app_socket.ex
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
defmodule LenraWeb.AppSocket do
use ApplicationRunner.AppSocket,
adapter: LenraWeb.AppAdapter,
route_channel: LenraWeb.RouteChannel
route_channel: LenraWeb.RouteChannel,
routes_channel: LenraWeb.RoutesChannel
end
6 changes: 6 additions & 0 deletions apps/lenra_web/lib/lenra_web/channels/routes_channel.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
defmodule LenraWeb.RoutesChannel do
@moduledoc """
`LenraWeb.AppChannel` handle the app channel to run app and listeners and push to the user the resulted UI or Patch
"""
use ApplicationRunner.RoutesChannel
end
140 changes: 70 additions & 70 deletions config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,86 +3,86 @@

import Config

config :lenra_web, LenraWeb.Endpoint,
http: [port: System.fetch_env!("PORT")],
secret_key_base: System.fetch_env!("SECRET_KEY_BASE"),
url: [host: System.fetch_env!("API_ENDPOINT"), port: System.fetch_env!("PORT")]
if config_env() == :prod do
config :lenra_web, LenraWeb.Endpoint,
http: [port: System.fetch_env!("PORT")],
secret_key_base: System.fetch_env!("SECRET_KEY_BASE"),
url: [host: System.fetch_env!("API_ENDPOINT"), port: System.fetch_env!("PORT")]

config :lenra, Lenra.Repo,
username: System.fetch_env!("POSTGRES_USER"),
password: System.fetch_env!("POSTGRES_PASSWORD"),
database: System.fetch_env!("POSTGRES_DB"),
hostname: System.fetch_env!("POSTGRES_HOST")
config :lenra, Lenra.Repo,
username: System.fetch_env!("POSTGRES_USER"),
password: System.fetch_env!("POSTGRES_PASSWORD"),
database: System.fetch_env!("POSTGRES_DB"),
hostname: System.fetch_env!("POSTGRES_HOST")

config :lenra,
faas_url: System.fetch_env!("FAAS_URL"),
faas_auth: System.fetch_env!("FAAS_AUTH"),
faas_registry: System.fetch_env!("FAAS_REGISTRY"),
runner_secret: System.fetch_env!("RUNNER_SECRET"),
runner_callback_url: "https://#{System.fetch_env!("APP_HOST")}",
lenra_env: System.fetch_env!("ENVIRONMENT"),
gitlab_api_url: System.fetch_env!("GITLAB_API_URL"),
gitlab_api_token: System.fetch_env!("GITLAB_API_TOKEN"),
gitlab_project_id: System.fetch_env!("GITLAB_PROJECT_ID"),
gitlab_ci_ref: "master",
template_url: System.fetch_env!("TEMPLATE_URL"),
lenra_email: System.fetch_env!("LENRA_EMAIL"),
lenra_app_url: System.fetch_env!("LENRA_APP_URL")
config :lenra,
faas_url: System.fetch_env!("FAAS_URL"),
faas_auth: System.fetch_env!("FAAS_AUTH"),
faas_registry: System.fetch_env!("FAAS_REGISTRY"),
runner_secret: System.fetch_env!("RUNNER_SECRET"),
runner_callback_url: "https://#{System.fetch_env!("APP_HOST")}",
lenra_env: System.fetch_env!("ENVIRONMENT"),
gitlab_api_url: System.fetch_env!("GITLAB_API_URL"),
gitlab_api_token: System.fetch_env!("GITLAB_API_TOKEN"),
gitlab_project_id: System.fetch_env!("GITLAB_PROJECT_ID"),
gitlab_ci_ref: "master",
template_url: System.fetch_env!("TEMPLATE_URL"),
lenra_email: System.fetch_env!("LENRA_EMAIL"),
lenra_app_url: System.fetch_env!("LENRA_APP_URL")

config :application_runner,
url: System.fetch_env!("API_ENDPOINT"),
faas_url: System.fetch_env!("FAAS_URL"),
faas_auth: System.fetch_env!("FAAS_AUTH"),
faas_registry: System.fetch_env!("FAAS_REGISTRY"),
gitlab_api_url: System.fetch_env!("GITLAB_API_URL"),
listeners_timeout: String.to_integer(System.fetch_env!("LISTENERS_TIMEOUT")),
view_timeout: String.to_integer(System.fetch_env!("VIEW_TIMEOUT")),
manifest_timeout: String.to_integer(System.fetch_env!("MANIFEST_TIMEOUT")),
env: System.fetch_env!("ENVIRONMENT")
config :application_runner,
url: System.fetch_env!("API_ENDPOINT"),
faas_url: System.fetch_env!("FAAS_URL"),
faas_auth: System.fetch_env!("FAAS_AUTH"),
faas_registry: System.fetch_env!("FAAS_REGISTRY"),
gitlab_api_url: System.fetch_env!("GITLAB_API_URL"),
listeners_timeout: String.to_integer(System.fetch_env!("LISTENERS_TIMEOUT")),
view_timeout: String.to_integer(System.fetch_env!("VIEW_TIMEOUT")),
manifest_timeout: String.to_integer(System.fetch_env!("MANIFEST_TIMEOUT")),
env: System.fetch_env!("ENVIRONMENT")

config :application_runner, ApplicationRunner.Repo,
username: System.fetch_env!("POSTGRES_USER"),
password: System.fetch_env!("POSTGRES_PASSWORD"),
database: System.fetch_env!("POSTGRES_DB"),
hostname: System.fetch_env!("POSTGRES_HOST"),
show_sensitive_data_on_connection_error: true,
pool_size: 10
config :application_runner, ApplicationRunner.Repo,
username: System.fetch_env!("POSTGRES_USER"),
password: System.fetch_env!("POSTGRES_PASSWORD"),
database: System.fetch_env!("POSTGRES_DB"),
hostname: System.fetch_env!("POSTGRES_HOST"),
show_sensitive_data_on_connection_error: true,
pool_size: 10

config :application_runner, :mongo,
hostname: System.fetch_env!("MONGO_HOSTNAME"),
port: System.get_env("MONGO_PORT", "27017"),
username: System.get_env("MONGO_USERNAME"),
password: System.get_env("MONGO_PASSWORD"),
ssl: System.get_env("MONGO_SSL", "false"),
auth_source: System.get_env("MONGO_AUTH_SOURCE")
config :application_runner, :mongo,
hostname: System.fetch_env!("MONGO_HOSTNAME"),
port: System.get_env("MONGO_PORT", "27017"),
username: System.get_env("MONGO_USERNAME"),
password: System.get_env("MONGO_PASSWORD"),
ssl: System.get_env("MONGO_SSL", "false"),
auth_source: System.get_env("MONGO_AUTH_SOURCE")

# Do not print debug messages in production
config :logger, level: String.to_atom(System.get_env("LOG_LEVEL", "info"))
# Do not print debug messages in production
config :logger, level: String.to_atom(System.get_env("LOG_LEVEL", "info"))

config :libcluster,
topologies: [
lenra: [
# The selected clustering strategy. Required.
strategy: Elixir.Cluster.Strategy.Kubernetes,
# Configuration for the provided strategy. Optional.
config: [
mode: :ip,
kubernetes_selector: System.fetch_env!("KUBERNETES_SELECTOR"),
kubernetes_namespace: System.fetch_env!("KUBERNETES_NAMESPACE"),
application_name: "lenra",
polling_interval: 10_000
config :libcluster,
topologies: [
lenra: [
# The selected clustering strategy. Required.
strategy: Elixir.Cluster.Strategy.Kubernetes.DNS,
# Configuration for the provided strategy. Optional.
config: [
service: System.fetch_env!("SERVICE_NAME"),
application_name: "lenra",
polling_interval: 10_000
]
]
]
]

config :lenra, Lenra.Mailer, api_key: System.fetch_env!("SENDGRID_API_KEY")
config :lenra, Lenra.Mailer, api_key: System.fetch_env!("SENDGRID_API_KEY")

config :lenra_web, LenraWeb.Guardian, secret_key: System.fetch_env!("GUARDIAN_SECRET_KEY")
config :lenra_web, LenraWeb.Guardian, secret_key: System.fetch_env!("GUARDIAN_SECRET_KEY")

config :lenra_web, LenraWeb.AppGuardian, secret_key: System.fetch_env!("GUARDIAN_SECRET_KEY")
config :lenra_web, LenraWeb.AppGuardian, secret_key: System.fetch_env!("GUARDIAN_SECRET_KEY")

# Set the DSN for sentry and the current environment.
# Only production and sentry are used. test env are ignored.
config :sentry,
dsn: System.fetch_env!("SENTRY_DSN"),
environment_name: System.fetch_env!("ENVIRONMENT")
# Set the DSN for sentry and the current environment.
# Only production and sentry are used. test env are ignored.
config :sentry,
dsn: System.fetch_env!("SENTRY_DSN"),
environment_name: System.fetch_env!("ENVIRONMENT")
end
5 changes: 3 additions & 2 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
%{
"application_runner": {:git, "https://github.com/lenra-io/application-runner.git", "81806b2671708a825f97762f3740c35292872a11", [ref: "v1.0.0-beta.121", submodules: true]},
"argon2_elixir": {:hex, :argon2_elixir, "3.1.0", "4135e0a1b4ff800d42c85aa663e068efa3cb356297189b5b65caa992db8ec8cf", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "c08feae0ee0292165d1b945003363c7cd8523d002e0483c627dfca930291dd73"},
"application_runner": {:git, "https://github.com/lenra-io/application-runner.git", "e948d53d5f0042d428a47decebf97e6175da47ba", [ref: "v1.0.0-beta.124", submodules: true]},
"argon2_elixir": {:hex, :argon2_elixir, "3.0.0", "fd4405f593e77b525a5c667282172dd32772d7c4fa58cdecdaae79d2713b6c5f", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "8b753b270af557d51ba13fcdebc0f0ab27a2a6792df72fd5a6cf9cfaffcedc57"},
"artificery": {:hex, :artificery, "0.4.3", "0bc4260f988dcb9dda4b23f9fc3c6c8b99a6220a331534fdf5bf2fd0d4333b02", [:mix], [], "hexpm", "12e95333a30e20884e937abdbefa3e7f5e05609c2ba8cf37b33f000b9ffc0504"},
"bamboo": {:hex, :bamboo, "2.2.0", "f10a406d2b7f5123eb1f02edfa043c259db04b47ab956041f279eaac776ef5ce", [:mix], [{:hackney, ">= 1.15.2", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:mime, "~> 1.4", [hex: :mime, repo: "hexpm", optional: false]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "8c3b14ba7d2f40cb4be04128ed1e2aff06d91d9413d38bafb4afccffa3ade4fc"},
"bamboo_smtp": {:hex, :bamboo_smtp, "4.2.2", "e9f57a2300df9cb496c48751bd7668a86a2b89aa2e79ccaa34e0c46a5f64c3ae", [:mix], [{:bamboo, "~> 2.2.0", [hex: :bamboo, repo: "hexpm", optional: false]}, {:gen_smtp, "~> 1.2.0", [hex: :gen_smtp, repo: "hexpm", optional: false]}], "hexpm", "28cac2ec8adaae02aed663bf68163992891a3b44cfd7ada0bebe3e09bed7207f"},
"bcrypt_elixir": {:hex, :bcrypt_elixir, "3.0.1", "9be815469e6bfefec40fa74658ecbbe6897acfb57614df1416eeccd4903f602c", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "486bb95efb645d1efc6794c1ddd776a186a9a713abf06f45708a6ce324fb96cf"},
Expand Down