-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1043 from basedosdados/development
Development
- Loading branch information
Showing
15 changed files
with
343 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,106 @@ | ||
{{- if .Values.website.ingress.enabled }} | ||
{{- $name := .Values.website.name }} | ||
|
||
# Default Ingress | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: {{ .Values.website.name }}-ingress | ||
name: {{ $name }}-ingress | ||
labels: | ||
app.kubernetes.io/component: basedosdados-website | ||
app.kubernetes.io/name: {{ .Values.website.name }} | ||
app.kubernetes.io/name: {{ $name }} | ||
annotations: | ||
{{- toYaml .Values.website.ingress.annotations | nindent 4 }} | ||
{{- with .Values.website.ingress.annotations }} | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
rules: | ||
- host: {{ .Values.website.ingress.host | quote }} | ||
http: | ||
paths: | ||
- path: / | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: "{{ .Values.website.name }}-service" | ||
port: | ||
number: 80 | ||
- path: / | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: "{{ $name }}-service" | ||
port: | ||
number: 80 | ||
{{- with .Values.website.ingress.tls }} | ||
tls: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
|
||
# International domain Ingresses | ||
{{- range $domain := .Values.website.ingress.internationalDomains }} | ||
--- | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: {{ $name }}-{{ $domain.language }}-direct-ingress | ||
labels: | ||
app.kubernetes.io/component: basedosdados-website | ||
app.kubernetes.io/name: {{ $name }} | ||
annotations: | ||
{{- toYaml $domain.annotations | nindent 4 }} | ||
spec: | ||
{{- with $domain.tls }} | ||
tls: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
rules: | ||
- host: {{ $domain.host | quote }} | ||
http: | ||
paths: | ||
- path: /_next | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: "{{ $name }}-service" | ||
port: | ||
number: 80 | ||
- path: /favicon_default.ico | ||
pathType: Exact | ||
backend: | ||
service: | ||
name: "{{ $name }}-service" | ||
port: | ||
number: 80 | ||
- path: /{{ $domain.language }}/* | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: "{{ $name }}-service" | ||
port: | ||
number: 80 | ||
|
||
--- | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: {{ $name }}-{{ $domain.language }}-rewrite-ingress | ||
labels: | ||
app.kubernetes.io/component: basedosdados-website | ||
app.kubernetes.io/name: {{ $name }} | ||
annotations: | ||
nginx.ingress.kubernetes.io/rewrite-target: /{{ $domain.language }}/$1 | ||
nginx.ingress.kubernetes.io/use-regex: "true" | ||
{{- toYaml $domain.annotations | nindent 4 }} | ||
spec: | ||
{{- with $domain.tls }} | ||
tls: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
rules: | ||
- host: {{ $domain.host | quote }} | ||
http: | ||
paths: | ||
- path: /(.*) | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: "{{ $name }}-service" | ||
port: | ||
number: 80 | ||
|
||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,47 @@ | ||
version: '3' | ||
|
||
services: | ||
next: | ||
container_name: nextjs | ||
next-basedosdados: | ||
container_name: nextjs-basedosdados | ||
build: | ||
context: next | ||
dockerfile: Dockerfile | ||
args: | ||
- NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL} | ||
- NEXT_PUBLIC_DOMAIN=basedosdados.org | ||
env_file: | ||
- .env | ||
environment: | ||
- NEXT_PUBLIC_DOMAIN=basedosdados.org | ||
ports: | ||
- ${NEXT_PORT}:3000 | ||
|
||
next-databasis: | ||
container_name: nextjs-databasis | ||
build: | ||
context: next | ||
dockerfile: Dockerfile | ||
args: | ||
- NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL} | ||
- NEXT_PUBLIC_DOMAIN=data-basis.org | ||
env_file: | ||
- .env | ||
environment: | ||
- NEXT_PUBLIC_DOMAIN=data-basis.org | ||
ports: | ||
- "3001:3000" | ||
|
||
next-basedelosdatos: | ||
container_name: nextjs-basedelosdatos | ||
build: | ||
context: next | ||
dockerfile: Dockerfile | ||
args: | ||
- NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL} | ||
- NEXT_PUBLIC_DOMAIN=basedelosdatos.org | ||
env_file: | ||
- .env | ||
environment: | ||
- NEXT_PUBLIC_DOMAIN=basedelosdatos.org | ||
ports: | ||
- "3002:3000" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { useRouter } from 'next/router'; | ||
|
||
export default function DomainComponent({ domains = [], children }) { | ||
const router = useRouter(); | ||
const hostname = typeof window !== 'undefined' ? window.location.hostname : ''; | ||
|
||
// Check if current hostname matches any of the allowed domains | ||
const shouldRender = domains.includes(hostname); | ||
|
||
return shouldRender ? children : null; | ||
} |
Oops, something went wrong.