Adds ohmyform app.

This commit is contained in:
2026-06-19 21:33:20 +00:00
parent a3dafa925b
commit b1295223b1
10 changed files with 369 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
# OhMyForm
OhMyForm is an open-source form builder for creating surveys, questionnaires, and data collection forms.
## Dependencies
- **PostgreSQL** - Database for storing forms and submissions
- **Redis** - Used for caching
## Configuration
Key settings in `config.yaml`:
- **domain** - Where OhMyForm will be accessible
- **adminEmail** - Admin account email (defaults to your operator email)
## First-Time Setup
1. Add and deploy the app:
```bash
wild app add ohmyform
wild app deploy ohmyform
```
2. Log in with:
- **Email**: value of `adminEmail` in your config
- **Password**: value of `adminPassword` in your `secrets.yaml`
3. Create your first form from the dashboard and share it via link or embed it in a page.
## Notes
- The `secretKey` is auto-generated in `secrets.yaml`
- Form submissions can be exported as CSV from the admin panel
- Public forms can be filled out without an account

View File

@@ -0,0 +1,59 @@
apiVersion: batch/v1
kind: Job
metadata:
name: ohmyform-db-init
namespace: {{ .namespace }}
spec:
template:
spec:
securityContext:
runAsNonRoot: true
runAsUser: 999
runAsGroup: 999
seccompProfile:
type: RuntimeDefault
containers:
- name: db-init
image: postgres:17
command: ["/bin/bash", "-c"]
args:
- |
PGPASSWORD=${POSTGRES_ADMIN_PASSWORD} psql -h ${DB_HOST} -U postgres <<EOF
DO \$\$
BEGIN
IF NOT EXISTS (SELECT FROM pg_catalog.pg_roles WHERE rolname = '${DB_USER}') THEN
CREATE USER ${DB_USER} WITH ENCRYPTED PASSWORD '${DB_PASSWORD}';
ELSE
ALTER USER ${DB_USER} WITH ENCRYPTED PASSWORD '${DB_PASSWORD}';
END IF;
END
\$\$;
SELECT 'CREATE DATABASE ${DB_NAME}' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = '${DB_NAME}')\gexec
ALTER DATABASE ${DB_NAME} OWNER TO ${DB_USER};
GRANT ALL PRIVILEGES ON DATABASE ${DB_NAME} TO ${DB_USER};
EOF
env:
- name: POSTGRES_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: ohmyform-secrets
key: postgres.password
- name: DB_HOST
value: "{{ .db.host }}"
- name: DB_NAME
value: "{{ .db.name }}"
- name: DB_USER
value: "{{ .db.user }}"
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: ohmyform-secrets
key: dbPassword
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
restartPolicy: OnFailure

View File

@@ -0,0 +1,95 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: ohmyform-api
namespace: {{ .namespace }}
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
component: api
template:
metadata:
labels:
component: api
spec:
securityContext:
runAsNonRoot: true
runAsUser: 9999
runAsGroup: 9999
seccompProfile:
type: RuntimeDefault
containers:
- name: api
image: ohmyform/api:1.0.3
ports:
- name: http
containerPort: 3000
protocol: TCP
env:
- name: PORT
value: "3000"
- name: DATABASE_DRIVER
value: postgres
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: ohmyform-secrets
key: dbUrl
- name: SECRET_KEY
valueFrom:
secretKeyRef:
name: ohmyform-secrets
key: secretKey
- name: REDIS_URL
value: "redis://:$(REDIS_PASSWORD)@{{ .redis.host }}:6379"
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: ohmyform-secrets
key: redis.password
- name: CREATE_ADMIN
value: "TRUE"
- name: ADMIN_EMAIL
value: "{{ .adminEmail }}"
- name: ADMIN_USERNAME
value: admin
- name: ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: ohmyform-secrets
key: adminPassword
resources:
limits:
cpu: "500m"
memory: 512Mi
ephemeral-storage: 1Gi
requests:
cpu: 50m
memory: 128Mi
ephemeral-storage: 50Mi
livenessProbe:
httpGet:
path: /_health
port: 3000
initialDelaySeconds: 60
timeoutSeconds: 5
periodSeconds: 15
failureThreshold: 6
readinessProbe:
httpGet:
path: /_health
port: 3000
initialDelaySeconds: 30
timeoutSeconds: 3
periodSeconds: 10
failureThreshold: 3
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: false
restartPolicy: Always

View File

@@ -0,0 +1,69 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: ohmyform-ui
namespace: {{ .namespace }}
spec:
replicas: 1
strategy:
type: RollingUpdate
selector:
matchLabels:
component: ui
template:
metadata:
labels:
component: ui
spec:
securityContext:
runAsNonRoot: true
runAsUser: 9999
runAsGroup: 9999
seccompProfile:
type: RuntimeDefault
containers:
- name: ui
image: ohmyform/ui:1.0.3
ports:
- name: http
containerPort: 4000
protocol: TCP
env:
- name: PORT
value: "4000"
- name: ENDPOINT
value: "https://{{ .domain }}/graphql"
- name: SERVER_ENDPOINT
value: "http://ohmyform-api:3000/graphql"
resources:
limits:
cpu: "500m"
memory: 256Mi
ephemeral-storage: 512Mi
requests:
cpu: 50m
memory: 64Mi
ephemeral-storage: 50Mi
livenessProbe:
httpGet:
path: /
port: 4000
initialDelaySeconds: 30
timeoutSeconds: 5
periodSeconds: 15
failureThreshold: 6
readinessProbe:
httpGet:
path: /
port: 4000
initialDelaySeconds: 15
timeoutSeconds: 3
periodSeconds: 10
failureThreshold: 3
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: false
restartPolicy: Always

View File

@@ -0,0 +1,33 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ohmyform
namespace: {{ .namespace }}
annotations:
external-dns.alpha.kubernetes.io/target: {{ .externalDnsDomain }}
external-dns.alpha.kubernetes.io/cloudflare-proxied: "false"
external-dns.alpha.kubernetes.io/ttl: "60"
spec:
ingressClassName: traefik
rules:
- host: {{ .domain }}
http:
paths:
- path: /graphql
pathType: Prefix
backend:
service:
name: ohmyform-api
port:
number: 3000
- path: /
pathType: Prefix
backend:
service:
name: ohmyform-ui
port:
number: 4000
tls:
- hosts:
- {{ .domain }}
secretName: {{ .tlsSecretName }}

View File

@@ -0,0 +1,16 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: {{ .namespace }}
labels:
- includeSelectors: true
pairs:
app: ohmyform
managedBy: kustomize
partOf: wild-cloud
resources:
- namespace.yaml
- deployment-api.yaml
- deployment-ui.yaml
- service.yaml
- ingress.yaml
- db-init-job.yaml

View File

@@ -0,0 +1,26 @@
version: 1.0.3-2
requires:
- name: postgres
- name: redis
defaultConfig:
namespace: ohmyform
externalDnsDomain: "{{ .cloud.domain }}"
domain: ohmyform.{{ .cloud.domain }}
tlsSecretName: wildcard-wild-cloud-tls
adminEmail: "{{ .operator.email }}"
db:
host: "{{ .apps.postgres.host }}"
port: "{{ .apps.postgres.port }}"
name: ohmyform
user: ohmyform
redis:
host: "{{ .apps.redis.host }}"
defaultSecrets:
- key: dbPassword
- key: dbUrl
default: "postgresql://{{ .app.db.user }}:{{ .secrets.dbPassword }}@{{ .app.db.host }}:{{ .app.db.port }}/{{ .app.db.name }}?sslmode=disable"
- key: secretKey
- key: adminPassword
requiredSecrets:
- postgres.password
- redis.password

View File

@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: {{ .namespace }}

View File

@@ -0,0 +1,27 @@
apiVersion: v1
kind: Service
metadata:
name: ohmyform-api
namespace: {{ .namespace }}
spec:
selector:
component: api
ports:
- name: http
port: 3000
targetPort: 3000
protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
name: ohmyform-ui
namespace: {{ .namespace }}
spec:
selector:
component: ui
ports:
- name: http
port: 4000
targetPort: 4000
protocol: TCP