Add Mailhog to deployments

This commit is contained in:
Nils Hamerlinck 2022-09-17 18:31:01 +07:00
parent bdda288f58
commit f112a08de5
10 changed files with 84 additions and 5 deletions

View file

@ -45,6 +45,7 @@ class Build(BaseModel):
name: str
commit_info: github.CommitInfo
deploy_link: str
deploy_link_mailhog: str
repo_target_branch_link: str
repo_pr_link: str | None
repo_commit_link: str

View file

@ -56,6 +56,37 @@ spec:
requests:
cpu: 50m
memory: 100Mi
- name: mailhog
image: mailhog
env:
- name: MH_API_BIND_ADDR
value: 0.0.0.0:8025
- name: MH_UI_BIND_ADDR
value: 0.0.0.0:8025
- name: MH_SMTP_BIND_ADDR
value: 0.0.0.0:1025
ports:
- name: smtp
containerPort: 1025
- name: web
containerPort: 8025
readinessProbe:
tcpSocket:
port: 8025
initialDelaySeconds: 2
periodSeconds: 2
livenessProbe:
tcpSocket:
port: 8025
initialDelaySeconds: 30
periodSeconds: 30
resources:
limits:
cpu: 100m
memory: 200Mi
requests:
cpu: 50m
memory: 100Mi
volumes:
- name: runboat-scripts
configMap:

View file

@ -0,0 +1,15 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: mailhog
spec:
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: odoo
port:
number: 8025

View file

@ -3,7 +3,8 @@ resources:
- pvc.yaml
- deployment.yaml
- service.yaml
- ingress.yaml
- ingress_odoo.yaml
- ingress_mailhog.yaml
{%- elif mode == "initialize" %}
- pvc.yaml
- initialize.yaml
@ -28,6 +29,9 @@ images:
- name: odoo
newName: "{{ image_name }}"
newTag: "{{ image_tag }}"
- name: mailhog
newName: "mailhog/mailhog"
newTag: "latest"
secretGenerator:
- name: odoosecretenv
@ -71,3 +75,10 @@ patches:
- op: replace
path: /spec/rules/0/host
value: {{ build_slug }}.{{ build_domain }}
- target:
kind: Ingress
name: mailhog
patch: |-
- op: replace
path: /spec/rules/0/host
value: {{ build_slug }}.mail.{{ build_domain }}

View file

@ -31,4 +31,6 @@ unbuffer $(which odoo || which openerp-server) \
--no-database-list \
--database ${PGDATABASE} \
--db-filter=^${PGDATABASE} \
--db_user=${PGUSER}
--db_user=${PGUSER} \
--smtp=localhost \
--smtp-port=1025

View file

@ -13,5 +13,9 @@ spec:
targetPort: 8072
protocol: TCP
name: longpolling
- port: 8025
targetPort: 8025
protocol: TCP
name: mailhog-web
selector:
app: odoo

View file

@ -135,6 +135,10 @@ class Build(BaseModel):
def deploy_link(self) -> str:
return f"http://{self.slug}.{settings.build_domain}"
@property
def deploy_link_mailhog(self) -> str:
return f"http://{self.slug}.mail.{settings.build_domain}"
@property
def repo_target_branch_link(self) -> str:
return (

View file

@ -19,7 +19,7 @@ class RunboatBuildElement extends LitElement {
static styles = css`
.build-card {
width: 16em;
width: 16.2em;
padding: 0.5em;
border-radius: 0.5em;
background-color: lightgray;
@ -72,7 +72,7 @@ class RunboatBuildElement extends LitElement {
html`⦙ 🗒 <a href="/api/v1/builds/${this.build.name}/log">log</a>`:""
}
${this.build.status == "started"?
html`⦙ 🚪 <a href="${this.build.deploy_link}">live</a>`:""
html`⦙ 🚪 <a href="${this.build.deploy_link}" title="Odoo">live</a> <a href="${this.build.deploy_link_mailhog}" title="Mailhog">✉</a>`:""
}
</p>
<p>

View file

@ -7,7 +7,8 @@ resources:
- pvc.yaml
- deployment.yaml
- service.yaml
- ingress.yaml
- ingress_odoo.yaml
- ingress_mailhog.yaml
namespace: runboat-builds
@ -26,6 +27,9 @@ images:
- name: odoo
newName: "ghcr.io/oca/oca-ci"
newTag: "py3.8-odoo15.0"
- name: mailhog
newName: "mailhog/mailhog"
newTag: "latest"
secretGenerator:
- name: odoosecretenv
@ -64,6 +68,13 @@ patches:
- op: replace
path: /spec/rules/0/host
value: build-slug.runboat.odoo-community.org
- target:
kind: Ingress
name: mailhog
patch: |-
- op: replace
path: /spec/rules/0/host
value: build-slug.mail.runboat.odoo-community.org
"""