From cb8697eb1191a2213813c2f44bbd114e20f55fb0 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Mon, 15 Jul 2019 08:24:43 -0700 Subject: [PATCH] Remove Kubernetes build, not supported. --- README.md | 2 +- server/Dockerfile.dev | 28 ----------- server/Dockerfile.prod | 28 ----------- server/stack.dev.yaml | 111 ----------------------------------------- server/stack.prod.yaml | 110 ---------------------------------------- skaffold.yaml | 37 -------------- ui/Dockerfile.dev | 12 ----- ui/Dockerfile.prod | 22 -------- ui/stack.dev.yaml | 35 ------------- ui/stack.prod.yaml | 54 -------------------- 10 files changed, 1 insertion(+), 438 deletions(-) delete mode 100644 server/Dockerfile.dev delete mode 100644 server/Dockerfile.prod delete mode 100644 server/stack.dev.yaml delete mode 100644 server/stack.prod.yaml delete mode 100644 skaffold.yaml delete mode 100644 ui/Dockerfile.dev delete mode 100644 ui/Dockerfile.prod delete mode 100644 ui/stack.dev.yaml delete mode 100644 ui/stack.prod.yaml diff --git a/README.md b/README.md index 9309ce5df..07f2426d2 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ and goto http://localhost:8536 ### Nginx Config ``` location / { - rewrite (\/(user|u|inbox|post|community|c|login|search|sponsors|communities|modlog)+) /static/index.html break; + rewrite (\/(user|u|inbox|post|community|c|login|search|sponsors|communities|modlog|home)+) /static/index.html break; proxy_pass http://0.0.0.0:8536; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; diff --git a/server/Dockerfile.dev b/server/Dockerfile.dev deleted file mode 100644 index 203dd7424..000000000 --- a/server/Dockerfile.dev +++ /dev/null @@ -1,28 +0,0 @@ -# Setup env -FROM rust:1.33 AS build -RUN USER=root cargo new --bin /opt/lemmy/server--dev -WORKDIR /opt/lemmy/server--dev -# Enable deps caching -RUN mkdir -p src/bin -RUN echo 'fn main() { println!("Dummy") }' >src/bin/main.rs -# Install deps -COPY Cargo.toml . -COPY Cargo.lock . -RUN cargo build --release -RUN rm src/bin/main.rs -# Add app -COPY src/ src/ -COPY migrations/ migrations/ -RUN rm target/release/deps/lemmy* -RUN cargo build --release - -# Setup env (no Alpine because Rust requires glibc) -FROM ubuntu:18.04 -RUN apt update -RUN apt install postgresql-client -y -# Create empty directory where the frontend would normally be -RUN mkdir -p /opt/lemmy/ui--dev/dist -# Add app -COPY --from=build /opt/lemmy/server--dev/target/release/lemmy . -# Run app -CMD ["./lemmy"] diff --git a/server/Dockerfile.prod b/server/Dockerfile.prod deleted file mode 100644 index b375e4781..000000000 --- a/server/Dockerfile.prod +++ /dev/null @@ -1,28 +0,0 @@ -# Setup env -FROM rust:1.33 AS build -RUN USER=root cargo new --bin /opt/lemmy/server--prod -WORKDIR /opt/lemmy/server--prod -# Enable deps caching -RUN mkdir -p src/bin -RUN echo 'fn main() { println!("Dummy") }' >src/bin/main.rs -# Install deps -COPY Cargo.toml . -COPY Cargo.lock . -RUN cargo build --release -RUN rm src/bin/main.rs -# Add app -COPY src/ src/ -COPY migrations/ migrations/ -RUN rm target/release/deps/lemmy* -RUN cargo build --release - -# Setup env (no Alpine because Rust requires glibc) -FROM ubuntu:18.04 -RUN apt update -RUN apt install postgresql-client -y -# Create empty directory where the frontend would normally be -RUN mkdir -p /opt/lemmy/ui--prod/dist -# Add app -COPY --from=build /opt/lemmy/server--prod/target/release/lemmy . -# Run app -CMD ["./lemmy"] diff --git a/server/stack.dev.yaml b/server/stack.dev.yaml deleted file mode 100644 index 7c6905b3b..000000000 --- a/server/stack.dev.yaml +++ /dev/null @@ -1,111 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: postgres -data: - POSTGRES_PASSWORD: rrr - POSTGRES_USER: rrr - POSTGRES_DB: rrr - PGDATA: /var/lib/postgresql/data/pgdata - DATABASE_URL: postgres://rrr:rrr@postgres:5432/rrr ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: postgres -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 5Gi ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: postgres -spec: - selector: - matchLabels: - app: postgres - template: - metadata: - labels: - app: postgres - spec: - containers: - - name: postgres - image: postgres:11.2-alpine - resources: - limits: - memory: 256Mi - cpu: 512m - ports: - - containerPort: 5432 - envFrom: - - configMapRef: - name: postgres - volumeMounts: - - name: postgres - mountPath: /var/lib/postgresql/data - volumes: - - name: postgres - persistentVolumeClaim: - claimName: postgres ---- -apiVersion: v1 -kind: Service -metadata: - name: postgres -spec: - selector: - app: postgres - ports: - - port: 5432 ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: lemmy-server--dev -data: - LEMMY_FRONT_END_DIR: /opt/lemmy/ui--dev/dist # not actually used here, polyfill for monolith ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: lemmy-server--dev -spec: - selector: - matchLabels: - app: lemmy-server--dev - template: - metadata: - labels: - app: lemmy-server--dev - spec: - containers: - - name: lemmy-server--dev - image: registry.gitlab.com/pojntfx/lemmy/server.dev - envFrom: - - configMapRef: - name: postgres - - configMapRef: - name: lemmy-server--dev - resources: - limits: - memory: 512Mi - cpu: 512m - ports: - - containerPort: 8536 ---- -apiVersion: v1 -kind: Service -metadata: - name: lemmy-server--dev -spec: - type: NodePort - selector: - app: lemmy-server--dev - ports: - - port: 8536 - nodePort: 30001 diff --git a/server/stack.prod.yaml b/server/stack.prod.yaml deleted file mode 100644 index d221de163..000000000 --- a/server/stack.prod.yaml +++ /dev/null @@ -1,110 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: postgres -data: - POSTGRES_PASSWORD: rrr - POSTGRES_USER: rrr - POSTGRES_DB: rrr - PGDATA: /var/lib/postgresql/data/pgdata - DATABASE_URL: postgres://rrr:rrr@postgres:5432/rrr ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: postgres -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 5Gi ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: postgres -spec: - selector: - matchLabels: - app: postgres - template: - metadata: - labels: - app: postgres - spec: - containers: - - name: postgres - image: postgres:11.2-alpine - resources: - limits: - memory: 256Mi - cpu: 512m - ports: - - containerPort: 5432 - envFrom: - - configMapRef: - name: postgres - volumeMounts: - - name: postgres - mountPath: /var/lib/postgresql/data - volumes: - - name: postgres - persistentVolumeClaim: - claimName: postgres ---- -apiVersion: v1 -kind: Service -metadata: - name: postgres -spec: - selector: - app: postgres - ports: - - port: 5432 ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: lemmy-server--prod -data: - LEMMY_FRONT_END_DIR: /opt/lemmy/ui--prod/dist # not actually used here, polyfill for monolith ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: lemmy-server--prod -spec: - selector: - matchLabels: - app: lemmy-server--prod - template: - metadata: - labels: - app: lemmy-server--prod - spec: - containers: - - name: lemmy-server--prod - image: registry.gitlab.com/pojntfx/lemmy/server.prod - envFrom: - - configMapRef: - name: postgres - - configMapRef: - name: lemmy-server--prod - resources: - limits: - memory: 512Mi - cpu: 512m - ports: - - containerPort: 8536 ---- -apiVersion: v1 -kind: Service -metadata: - name: lemmy-server--prod -spec: - selector: - app: lemmy-server--prod - ports: - - port: 8536 - targetPort: 8536 diff --git a/skaffold.yaml b/skaffold.yaml deleted file mode 100644 index 9aeaa5859..000000000 --- a/skaffold.yaml +++ /dev/null @@ -1,37 +0,0 @@ -apiVersion: skaffold/v1beta9 -kind: Config -profiles: - - name: lemmy--dev - build: - artifacts: - - image: registry.gitlab.com/pojntfx/lemmy/server.dev - context: server - docker: - dockerfile: Dockerfile.dev - - image: registry.gitlab.com/pojntfx/lemmy/ui.dev - context: ui - docker: - dockerfile: Dockerfile.dev - sync: - "***/*.ts": . - "***/*.tsx": . - "***/*.css": . - deploy: - kubectl: - manifests: - - "**/*.dev.yaml" - - name: lemmy--prod - build: - artifacts: - - image: registry.gitlab.com/pojntfx/lemmy/server.prod - context: server - docker: - dockerfile: Dockerfile.prod - - image: registry.gitlab.com/pojntfx/lemmy/ui.prod - context: ui - docker: - dockerfile: Dockerfile.prod - deploy: - kubectl: - manifests: - - "**/*.prod.yaml" diff --git a/ui/Dockerfile.dev b/ui/Dockerfile.dev deleted file mode 100644 index 37f9e34c7..000000000 --- a/ui/Dockerfile.dev +++ /dev/null @@ -1,12 +0,0 @@ -# Setup env -FROM node:10-alpine -RUN mkdir -p /opt/lemmy/ui--dev -WORKDIR /opt/lemmy/ui--dev -# Install deps -COPY package.json . -COPY yarn.lock . -RUN npm install -# Add app -COPY . . -# Run app -CMD ["npm", "start"] diff --git a/ui/Dockerfile.prod b/ui/Dockerfile.prod deleted file mode 100644 index 9c478e67a..000000000 --- a/ui/Dockerfile.prod +++ /dev/null @@ -1,22 +0,0 @@ -# Setup env -FROM node:10-alpine AS build -RUN mkdir -p /opt/lemmy/ui--prod -WORKDIR /opt/lemmy/ui--prod -# Install deps -COPY package.json . -COPY yarn.lock . -RUN npm install -# Add app -COPY . . -# Build app -RUN npm run build - -# Setup env -FROM node:10-alpine -RUN mkdir -p /opt/lemmy/ui--prod -WORKDIR /opt/lemmy/ui--prod -RUN npm install serve -# Add app -COPY --from=build /opt/lemmy/ui--prod/dist . -# Run app -CMD ["/opt/lemmy/ui--prod/node_modules/.bin/serve", "."] diff --git a/ui/stack.dev.yaml b/ui/stack.dev.yaml deleted file mode 100644 index bb7c62e85..000000000 --- a/ui/stack.dev.yaml +++ /dev/null @@ -1,35 +0,0 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: lemmy-ui--dev -spec: - selector: - matchLabels: - app: lemmy-ui--dev - template: - metadata: - labels: - app: lemmy-ui--dev - spec: - containers: - - name: lemmy-ui--dev - image: registry.gitlab.com/pojntfx/lemmy/ui.dev - resources: - limits: - memory: 1024Mi - cpu: 512m - ports: - - containerPort: 4444 ---- -apiVersion: v1 -kind: Service -metadata: - name: lemmy-ui--dev -spec: - type: NodePort - selector: - app: lemmy-ui--dev - ports: - - port: 4444 - nodePort: 30002 diff --git a/ui/stack.prod.yaml b/ui/stack.prod.yaml deleted file mode 100644 index ca4e1a7d4..000000000 --- a/ui/stack.prod.yaml +++ /dev/null @@ -1,54 +0,0 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: lemmy-ui--prod -spec: - selector: - matchLabels: - app: lemmy-ui--prod - template: - metadata: - labels: - app: lemmy-ui--prod - spec: - containers: - - name: lemmy-ui--prod - image: registry.gitlab.com/pojntfx/lemmy/ui.prod - resources: - limits: - memory: 1024Mi - cpu: 512m - ports: - - containerPort: 4444 ---- -apiVersion: v1 -kind: Service -metadata: - name: lemmy-ui--prod -spec: - selector: - app: lemmy-ui--prod - ports: - - port: 5000 - targetPort: 5000 ---- -apiVersion: extensions/v1beta1 -kind: Ingress -metadata: - name: lemmy-server--prod - annotations: - traefik.ingress.kubernetes.io/request-modifier: "ReplacePathRegex: ^/static/(.*) /$1" -spec: - rules: - - host: dev.lemmy.local - http: - paths: - - path: / - backend: - serviceName: lemmy-ui--prod - servicePort: 5000 - - path: /api/v1/ws - backend: - serviceName: lemmy-server--prod - servicePort: 8536