feat: Add Kubernetes website module with configuration, resources, and NGINX setup
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
module "websites" {
|
||||
source = "../modules/websites"
|
||||
persistent_folder = local.persistent_folder
|
||||
primary_domain = local.primary_domain
|
||||
websites = local.websites
|
||||
}
|
||||
|
||||
moved {
|
||||
from = kubernetes_namespace.website
|
||||
to = module.websites.kubernetes_namespace.website
|
||||
}
|
||||
|
||||
moved {
|
||||
from = kubernetes_service_account.website_service_account
|
||||
to = module.websites.kubernetes_service_account.website_service_account
|
||||
}
|
||||
|
||||
moved {
|
||||
from = kubernetes_service.website
|
||||
to = module.websites.kubernetes_service.website
|
||||
}
|
||||
|
||||
moved {
|
||||
from = kubernetes_config_map.nginx_config
|
||||
to = module.websites.kubernetes_config_map.nginx_config
|
||||
}
|
||||
|
||||
moved {
|
||||
from = kubernetes_ingress_v1.website_ingress
|
||||
to = module.websites.kubernetes_ingress_v1.website_ingress
|
||||
}
|
||||
|
||||
moved {
|
||||
from = kubernetes_deployment.website
|
||||
to = module.websites.kubernetes_deployment.website
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
locals {
|
||||
persistent_folder = var.persistent_folder
|
||||
primary_domain = var.primary_domain
|
||||
websites = var.websites
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
terraform {
|
||||
required_version = "~>1.8"
|
||||
required_providers {
|
||||
kubernetes = {
|
||||
source = "hashicorp/kubernetes"
|
||||
version = "~>2.18"
|
||||
}
|
||||
scaleway = {
|
||||
source = "scaleway/scaleway"
|
||||
version = "~>2.13"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
server {
|
||||
listen 8080;
|
||||
server_name localhost;
|
||||
|
||||
gzip on;
|
||||
gzip_comp_level 9;
|
||||
gzip_types
|
||||
text/html
|
||||
text/plain
|
||||
text/css
|
||||
text/js
|
||||
text/xml
|
||||
text/javascript
|
||||
application/javascript
|
||||
application/json
|
||||
application/xml
|
||||
application/rss+xml
|
||||
image/svg+xml;
|
||||
|
||||
root /tmp/site;
|
||||
|
||||
location / {
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
location ~* ^/([^/]+) {
|
||||
index index.html index.htm;
|
||||
error_page 404 = @error;
|
||||
}
|
||||
|
||||
error_page 404 /404.html;
|
||||
location @error {
|
||||
try_files /$1/404.html /404.html =404;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
worker_processes auto;
|
||||
|
||||
error_log /var/log/nginx/error.log notice;
|
||||
pid /tmp/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
proxy_temp_path /tmp/proxy_temp;
|
||||
client_body_temp_path /tmp/client_temp;
|
||||
fastcgi_temp_path /tmp/fastcgi_temp;
|
||||
uwsgi_temp_path /tmp/uwsgi_temp;
|
||||
scgi_temp_path /tmp/scgi_temp;
|
||||
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
variable "persistent_folder" {
|
||||
description = "The path to the persistent folder"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "primary_domain" {
|
||||
description = "The primary domain for the websites"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "websites" {
|
||||
description = "A list of websites to be deployed"
|
||||
type = map(object({
|
||||
domain_name = string
|
||||
fqdn = list(string)
|
||||
}))
|
||||
}
|
||||
Reference in New Issue
Block a user