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

i3 Replace sockets with ports #29

Merged
merged 22 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
10 changes: 6 additions & 4 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@ CLIENT_BROWSER_API_CABLE_URL=http://127.0.0.1:4000/cable
SSL_ENABLED=false

API_PORT=3020
API_SOCKET=/manifold_sockets/manifold-api
API_CABLE_SOCKET=/manifold_sockets/manifold-cable
API_CABLE_PORT=3021
CLIENT_SERVER_PORT=3010
API_HOST=api_rails
API_CABLE_HOST=api_cable
CLIENT_SERVER_HOST=client

CLIENT_SERVER_SOCKET=/manifold_sockets/manifold-client
CLIENT_SERVER_API_URL=http://api_rails:3020
NODE_ENV=production

ELASTICSEARCH_URL=http://elasticsearch:9200

CLIENT_SERVER_PROXIES=true
CLIENT_SERVER_PROXIES=false
RAILS_ENV=production
RAILS_SECRET_KEY=6234a9eada2709680e0db091d48fe7973f6eb23f413d9b5c2b9d17149c9e38e7309a897b6a5231297b89ac6d3c7494d40c7d6454f342c04f8743482f610016aa
RAILS_DB_USER=postgres
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ FROM nginx:1.25 as manifold-nginx
RUN apt-get -o Acquire::Check-Valid-Until=false update
RUN apt-get install -y openssl

COPY nginx/config/default.conf /etc/nginx/conf.d/default.conf
COPY nginx/config/default.conf.template /etc/nginx/templates/default.conf.template

COPY nginx/includes/manifold-client-local /etc/nginx/includes/manifold-client-local
COPY nginx/includes/manifold-server-local /etc/nginx/includes/manifold-server-local
Expand Down
8 changes: 4 additions & 4 deletions chart/princeton-manifold/templates/configmap-env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ metadata:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
data:
API_CABLE_HOST: princeton-manifold-production-api-cable
API_CABLE_PORT: "3021"
API_CABLE_SOCKET: /manifold_sockets/manifold-cable
API_HOST: princeton-manifold-production-api-rails
API_PORT: "3020"
API_SOCKET: /manifold_sockets/manifold-api
CLIENT_BROWSER_API_CABLE_URL: https://openpublishing.princeton.edu/cable
CLIENT_BROWSER_API_URL: https://openpublishing.princeton.edu
CLIENT_SERVER_API_URL: http://princeton-manifold-production-api:3020
CLIENT_SERVER_HOST: princeton-manifold-production-client
CLIENT_SERVER_PORT: "3010"
CLIENT_SERVER_PROXIES: "true"
CLIENT_SERVER_SOCKET: /manifold_sockets/manifold-client
CLIENT_SERVER_PROXIES: "false"
DOMAIN: openpublishing.princeton.edu
ELASTICSEARCH_URL: http://princeton-manifold-production-es:9200
NODE_ENV: production
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "princeton-manifold.fullname" . }}-api
name: {{ include "princeton-manifold.fullname" . }}-api-cable
labels:
{{- include "princeton-manifold.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "princeton-manifold.name" . }}-api
app.kubernetes.io/name: cable
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
Expand All @@ -17,7 +17,7 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
app.kubernetes.io/name: {{ include "princeton-manifold.name" . }}-api
app.kubernetes.io/name: cable
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
{{- with .Values.imagePullSecrets }}
Expand All @@ -28,13 +28,11 @@ spec:
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}-api-rails
- name: cable
command:
- bin/puma
- -C
- config/puma.rb
- bin/cable
ports:
- containerPort: 3020
- containerPort: 3021
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.api.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
Expand All @@ -48,7 +46,7 @@ spec:
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
- name: {{ .Chart.Name }}-api-sidekiq
- name: sidekiq
command:
- bin/sidekiq
securityContext:
Expand All @@ -64,25 +62,7 @@ spec:
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
- name: {{ .Chart.Name }}-api-cable
command:
- bin/cable
ports:
- containerPort: 3021
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.api.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
envFrom:
- configMapRef:
name: {{ include "princeton-manifold.fullname" . }}-env
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.volumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
- name: {{ .Chart.Name }}-api-clockwork
- name: clockwork
command:
- bin/zhong
- zhong.rb
Expand All @@ -99,44 +79,6 @@ spec:
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
- name: {{ .Chart.Name }}-client
command:
- yarn
- run
- start
ports:
- containerPort: 3010
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.client.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
envFrom:
- configMapRef:
name: {{ include "princeton-manifold.fullname" . }}-env
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.volumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
- name: {{ .Chart.Name }}-nginx
command:
- start-nginx
ports:
- containerPort: 80
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.nginx.image.registry }}/{{ .Values.nginx.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
envFrom:
- configMapRef:
name: {{ include "princeton-manifold.fullname" . }}-env
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.volumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.volumes }}
volumes:
{{- toYaml . | nindent 8 }}
Expand Down
54 changes: 54 additions & 0 deletions chart/princeton-manifold/templates/deployment-api-rails.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "princeton-manifold.fullname" . }}-api-rails
labels:
{{- include "princeton-manifold.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: rails
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
app.kubernetes.io/name: rails
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "princeton-manifold.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: rails
command:
- bin/puma
- -C
- config/puma.rb
ports:
- containerPort: 3020
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.api.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
envFrom:
- configMapRef:
name: {{ include "princeton-manifold.fullname" . }}-env
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.volumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.volumes }}
volumes:
{{- toYaml . | nindent 8 }}
{{- end }}
54 changes: 54 additions & 0 deletions chart/princeton-manifold/templates/deployment-client.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "princeton-manifold.fullname" . }}-client
labels:
{{- include "princeton-manifold.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: client
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
app.kubernetes.io/name: client
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "princeton-manifold.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: client
command:
- yarn
- run
- start
ports:
- containerPort: 3010
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.client.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
envFrom:
- configMapRef:
name: {{ include "princeton-manifold.fullname" . }}-env
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.volumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.volumes }}
volumes:
{{- toYaml . | nindent 8 }}
{{- end }}
50 changes: 50 additions & 0 deletions chart/princeton-manifold/templates/deployment-nginx.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "princeton-manifold.fullname" . }}-nginx
labels:
{{- include "princeton-manifold.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: nginx
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
app.kubernetes.io/name: nginx
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "princeton-manifold.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: nginx
ports:
- containerPort: 80
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.nginx.image.registry }}/{{ .Values.nginx.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
envFrom:
- configMapRef:
name: {{ include "princeton-manifold.fullname" . }}-env
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.volumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.volumes }}
volumes:
{{- toYaml . | nindent 8 }}
{{- end }}
15 changes: 15 additions & 0 deletions chart/princeton-manifold/templates/service-api-cable.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "princeton-manifold.fullname" . }}-api-cable
labels:
{{- include "princeton-manifold.labels" . | nindent 4 }}
spec:
type: {{ .Values.serviceApiCable.type }}
ports:
- port: {{ .Values.serviceApiCable.port }}
protocol: TCP
name: http
selector:
app.kubernetes.io/name: cable
app.kubernetes.io/instance: {{ .Release.Name }}
15 changes: 15 additions & 0 deletions chart/princeton-manifold/templates/service-api-rails.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "princeton-manifold.fullname" . }}-api-rails
labels:
{{- include "princeton-manifold.labels" . | nindent 4 }}
spec:
type: {{ .Values.serviceApiRails.type }}
ports:
- port: {{ .Values.serviceApiRails.port }}
protocol: TCP
name: http
selector:
app.kubernetes.io/name: rails
app.kubernetes.io/instance: {{ .Release.Name }}
16 changes: 0 additions & 16 deletions chart/princeton-manifold/templates/service-api.yaml

This file was deleted.

Loading
Loading