first attempt at adding the nginx service
parent
134da2dea4
commit
7864d5b6a2
|
@ -0,0 +1,7 @@
|
||||||
|
command: nginx -c ${SERVICE_ROOT}/nginx.conf
|
||||||
|
provides: www
|
||||||
|
|
||||||
|
#%directory ${SERVICE_ROOT}/
|
||||||
|
# name: working directory
|
||||||
|
|
||||||
|
%configuration nginx.conf ${SERVICE_ROOT}/nginx.conf
|
|
@ -0,0 +1,5 @@
|
||||||
|
command: echo "coucou"
|
||||||
|
consumes: www
|
||||||
|
|
||||||
|
%directory ${SERVICE_ROOT}/
|
||||||
|
name: data directory
|
|
@ -50,6 +50,7 @@ class GenConfig::Context
|
||||||
def generate(template, target : String, options : Hash(String, Variables))
|
def generate(template, target : String, options : Hash(String, Variables))
|
||||||
ServiceDefinition.load SERVICES_DIRECTORY
|
ServiceDefinition.load SERVICES_DIRECTORY
|
||||||
Service.load RC_DIRECTORY
|
Service.load RC_DIRECTORY
|
||||||
|
Environment.load ENVIRONMENTS_DIRECTORY
|
||||||
|
|
||||||
target_file = File.open target, "w"
|
target_file = File.open target, "w"
|
||||||
|
|
||||||
|
@ -99,6 +100,18 @@ class GenConfig::Context
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
options["providers"] = providers
|
options["providers"] = providers
|
||||||
|
|
||||||
|
consumers = Hash(String, Variables).new
|
||||||
|
service.provides.each do |provider_data|
|
||||||
|
token = provider_data.token
|
||||||
|
|
||||||
|
consumers[token] = Service.all.select do |s2|
|
||||||
|
s2.providers.each do |t2, id|
|
||||||
|
token == t2 && id == service.id
|
||||||
|
end
|
||||||
|
end.map &.full_id
|
||||||
|
end
|
||||||
|
options["consumers"] = consumers
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
|
||||||
|
# worker_processes 1;
|
||||||
|
daemon off;
|
||||||
|
|
||||||
|
worker_rlimit_nofile 1024;
|
||||||
|
events {
|
||||||
|
worker_connections 800;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
error_log /var/log/{{ id | replace("/", "_") }}_error.log warn;
|
||||||
|
access_log /var/log/{{ id | replace("/", "_") }}_access.log;
|
||||||
|
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
index index.html index.htm index.xhtml;
|
||||||
|
|
||||||
|
fastcgi_param HTTP_PROXY "";
|
||||||
|
|
||||||
|
keepalive_timeout 65;
|
||||||
|
|
||||||
|
server_tokens off;
|
||||||
|
|
||||||
|
{% for user in consumers["www"] %}
|
||||||
|
server {
|
||||||
|
listen {{ port(user.id) }} ;
|
||||||
|
listen [::]:{{ port(user.id) }} ;
|
||||||
|
server_name {{ user.domain }} ;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
root {{ user.root }} ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue