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

Multi platform with remotes #23

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
99 changes: 0 additions & 99 deletions .drone.yml

This file was deleted.

11 changes: 11 additions & 0 deletions .woodpecker/.feature.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
pipeline:
build-and-push:
image: redpencil/plugin-docker-buildx
settings:
platforms: linux/amd64,linux/arm64
repo: "${CI_REPO_OWNER##mu-}/${CI_REPO_NAME%%-service}"
tags: "feature-${CI_COMMIT_BRANCH##feature/}"
secrets: [ docker_username, docker_password, ssh_key, remote_builders ]
when:
event: push
branch: feature/*
11 changes: 11 additions & 0 deletions .woodpecker/.latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
pipeline:
build-and-push:
image: redpencil/plugin-docker-buildx
settings:
platforms: linux/amd64,linux/arm64
repo: "${CI_REPO_OWNER##mu-}/${CI_REPO_NAME%%-service}"
tags: latest
secrets: [ docker_username, docker_password, ssh_key, remote_builders ]
when:
event: push
branch: master
12 changes: 12 additions & 0 deletions .woodpecker/.tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
pipeline:
release:
image: redpencil/plugin-docker-buildx
settings:
platforms: linux/amd64,linux/arm64
repo: "${CI_REPO_OWNER##mu-}/${CI_REPO_NAME%%-service}"
tags: "${CI_COMMIT_TAG##v}"
secrets: [ docker_username, docker_password, ssh_key, remote_builders ]
when:
event: tag
ref: refs/tags/v*

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM madnificent/elixir-server:1.11.0
FROM madnificent/elixir-server:1.12.0

ENV MU_SPARQL_ENDPOINT 'http://database:8890/sparql'
ENV LOG_ELIXIR_STARTUP_COMMAND 'true'
Expand Down
115 changes: 56 additions & 59 deletions config/config.exs
Original file line number Diff line number Diff line change
@@ -1,44 +1,42 @@
# This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
use Mix.Config
import Config

defmodule CH do
def system_boolean(name, default \\ false) do
case String.downcase(System.get_env(name) || "") do
"true" -> true
"yes" -> true
"1" -> true
"on" -> true
"" -> default
_ -> false
end
system_boolean = fn (name, default) ->
case String.downcase(System.get_env(name) || "") do
"true" -> true
"yes" -> true
"1" -> true
"on" -> true
"" -> default
_ -> false
end
end

def database_compatibility(name) do
(System.get_env(name) || "")
|> String.downcase()
|> case do
"virtuoso" -> Compat.Implementations.Virtuoso
_ -> Compat.Implementations.Raw
end
end
database_compatibility = fn (name) ->
(System.get_env(name) || "")
|> String.downcase()
|> case do
"virtuoso" -> Compat.Implementations.Virtuoso
_ -> Compat.Implementations.Raw
end
end

def system_number(name, default) do
try do
(System.get_env(name) || "")
|> String.to_integer()
rescue
ArgumentError -> default
end
system_number = fn (name, default) ->
try do
(System.get_env(name) || "")
|> String.to_integer()
rescue
ArgumentError -> default
end
end

def system_float(name, default \\ false) do
try do
(System.get_env(name) || "")
|> String.to_float()
rescue
ArgumentError -> default
end
system_float = fn (name, default) ->
try do
(System.get_env(name) || "")
|> String.to_float()
rescue
ArgumentError -> default
end
end

Expand All @@ -53,30 +51,29 @@ end
# config :sparqlex, key: :value
config :"mu-authorization",
author: :"mu-semtech",
log_server_configuration: CH.system_boolean("LOG_SERVER_CONFIGURATION"),
log_outgoing_sparql_queries: CH.system_boolean("LOG_OUTGOING_SPARQL_QUERIES"),
log_incoming_sparql_queries: CH.system_boolean("LOG_INCOMING_SPARQL_QUERIES"),
inspect_outgoing_sparql_queries: CH.system_boolean("INSPECT_OUTGOING_SPARQL_QUERIES"),
inspect_incoming_sparql_queries: CH.system_boolean("INSPECT_INCOMING_SPARQL_QUERIES"),
log_delta_messages: CH.system_boolean("LOG_DELTA_MESSAGES"),
log_template_matcher_performance: CH.system_boolean("LOG_TEMPLATE_MATCHER_PERFORMANCE"),
log_delta_client_communication: CH.system_boolean("LOG_DELTA_CLIENT_COMMUNICATION"),
log_access_rights: CH.system_boolean("LOG_ACCESS_RIGHTS"),
inspect_access_rights_processing: CH.system_boolean("INSPECT_ACCESS_RIGHTS_PROCESSING"),
database_compatibility: CH.database_compatibility("DATABASE_COMPATIBILITY"),
log_outgoing_sparql_query_responses: CH.system_boolean("LOG_OUTGOING_SPARQL_QUERY_RESPONSES"),
inspect_outgoing_sparql_query_responses:
CH.system_boolean("INSPECT_OUTGOING_SPARQL_QUERY_RESPONSES"),
log_outgoing_sparql_query_roundtrip: CH.system_boolean("LOG_OUTGOING_SPARQL_QUERY_ROUNDTRIP"),
log_server_configuration: system_boolean.("LOG_SERVER_CONFIGURATION", false),
log_outgoing_sparql_queries: system_boolean.("LOG_OUTGOING_SPARQL_QUERIES", false),
log_incoming_sparql_queries: system_boolean.("LOG_INCOMING_SPARQL_QUERIES", false),
inspect_outgoing_sparql_queries: system_boolean.("INSPECT_OUTGOING_SPARQL_QUERIES", false),
inspect_incoming_sparql_queries: system_boolean.("INSPECT_INCOMING_SPARQL_QUERIES", false),
log_delta_messages: system_boolean.("LOG_DELTA_MESSAGES", false),
log_template_matcher_performance: system_boolean.("LOG_TEMPLATE_MATCHER_PERFORMANCE", false),
log_delta_client_communication: system_boolean.("LOG_DELTA_CLIENT_COMMUNICATION", false),
log_access_rights: system_boolean.("LOG_ACCESS_RIGHTS", false),
inspect_access_rights_processing: system_boolean.("INSPECT_ACCESS_RIGHTS_PROCESSING", false),
database_compatibility: database_compatibility.("DATABASE_COMPATIBILITY"),
log_outgoing_sparql_query_responses: system_boolean.("LOG_OUTGOING_SPARQL_QUERY_RESPONSES", false),
inspect_outgoing_sparql_query_responses: system_boolean.("INSPECT_OUTGOING_SPARQL_QUERY_RESPONSES", false),
log_outgoing_sparql_query_roundtrip: system_boolean.("LOG_OUTGOING_SPARQL_QUERY_ROUNDTRIP", false),
default_sparql_endpoint: System.get_env("MU_SPARQL_ENDPOINT") || "http://localhost:8890/sparql",
query_max_processing_time: CH.system_number("QUERY_MAX_PROCESSING_TIME", 120_000),
query_max_execution_time: CH.system_number("QUERY_MAX_EXECUTION_TIME", 60_000),
database_recovery_mode_enabled: CH.system_boolean("DATABASE_OVERLOAD_RECOVERY"),
log_database_recovery_mode_tick: CH.system_boolean("LOG_DATABASE_OVERLOAD_TICK"),
log_workload_info_requests: CH.system_boolean("LOG_WORKLOAD_INFO_REQUESTS"),
testing_auth_query_error_rate: CH.system_float("TESTING_AUTH_QUERY_ERROR_RATE"),
error_on_unwritten_data: CH.system_boolean("ERROR_ON_UNWRITTEN_DATA"),
errors: CH.system_boolean("LOG_ERRORS", true)
query_max_processing_time: system_number.("QUERY_MAX_PROCESSING_TIME", 120_000),
query_max_execution_time: system_number.("QUERY_MAX_EXECUTION_TIME", 60_000),
database_recovery_mode_enabled: system_boolean.("DATABASE_OVERLOAD_RECOVERY", false),
log_database_recovery_mode_tick: system_boolean.("LOG_DATABASE_OVERLOAD_TICK", false),
log_workload_info_requests: system_boolean.("LOG_WORKLOAD_INFO_REQUESTS", false),
testing_auth_query_error_rate: system_float.("TESTING_AUTH_QUERY_ERROR_RATE", false),
error_on_unwritten_data: system_boolean.("ERROR_ON_UNWRITTEN_DATA", false),
errors: system_boolean.("LOG_ERRORS", true)

# and access this configuration in your application as:
#
Expand All @@ -95,7 +92,7 @@ config :logger,
compile_time_purge_level: :debug,
level: :warn

if Mix.env() == :test do
if config_env() == :test do
config :junit_formatter,
report_dir: "/tmp/repo-example-test-results/exunit"
end
Expand All @@ -106,6 +103,6 @@ end
# Configuration from the imported file will override the ones defined
# here (which is why it is important to import them last).
#
# import_config "#{Mix.env}.exs"
# import_config "#{config_env()}.exs"

import_config "#{Mix.env()}.exs"
import_config "#{config_env()}.exs"
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 :"mu-authorization",
sparql_port: 9980
Expand Down
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 :"mu-authorization",
sparql_port: 8890
Expand Down
2 changes: 1 addition & 1 deletion config/test.exs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
use Mix.Config
import Config