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

Kubernetes Deployment #72

Closed
sFritsch09 opened this issue May 12, 2024 · 5 comments
Closed

Kubernetes Deployment #72

sFritsch09 opened this issue May 12, 2024 · 5 comments

Comments

@sFritsch09
Copy link

I’m in the process of setting up Vrite on Kubernetes using a Helm Chart, but I’m facing issues with the Api and Assets—they’re not functioning, and I’m unable to retrieve any logs for debugging purposes. Additionally, when I access the vrite api Pod and execute node index.js, there’s no response or output. Has anyone successfully deployed Vrite on Kubernetes and can offer some guidance?

@areknawo
Copy link
Collaborator

I don't have much experience with K8S so I won't be able to help. That said, I plan on improving the backend/self-hosting logs. As-is, it's been enough for the Cloud and simple Docker-based self-hosting, but it's indeed a bit limited.

If you have any suggestions on that front, I'm happy to hear them.

@sFritsch09
Copy link
Author

sFritsch09 commented May 13, 2024

That's alright just for the protocol:

  • I changed livenessProbe and readinessProbe of api to /swagger.json
  • For assets I removed liveness- and readinessProbe

Once it is working for me I will share the configuration for your documentation on how to deploy to K8s :)

Now besides Kubernetes, I set a subdomain for App to app.mydomain.com and API to api.mydomain.com and I try to register in the frontend but get 500 in the console:

POST https://app.mydomain.com/api/v1/auth.register?batch=1 500 (Internal Server Error)

In Mongodb I could see the entry of the user in users collection with db.users.find()

Is this the right endpoint for the frontend, because in the Swagger Docu I didn't see such endpoint?

@areknawo
Copy link
Collaborator

The REST API (documented here and in the Swagger spec) is used primarly as a public API. The app uses primarly a separate, internal API, with endpoints like the one you've listed.

Not exactly sure what could be causing the issue but, if you're using multiple subdomains, be sure to set the COOKIE_DOMAIN env var to, following your examples, mydomain.com.

@sFritsch09
Copy link
Author

sFritsch09 commented May 14, 2024

Thanks it is working now :)
COOKIE_DOMAIN was not the main issue but I needed to put every service to their own DNS. I found some bugs, but after comparing them to the Cloud version, they appear to be identical.

I will add a step by step Guide here and then we can close this 🚀

@sFritsch09
Copy link
Author

sFritsch09 commented May 31, 2024

How To Deploy Vrite On K8s:

It is beneficial to set the right envs and TLS for all Vrite Services.

Requirements

Helm Creation

The optimal approach is to generate a Helm Chart using Helm create vrite. This command will establish a Helm framework within your present directory under the release name vrite. The initial chart will serve as the frontend. To complete the setup, you must create three additional services within the vrite chart as SubCharts, namely vrite-api, vrite-collab, and vrite-assets.

Environments

You need the following envs as configMap or Secret:
HOST: "0.0.0.0"
PORT: "4444"
NODE_ENV: production
COOKIE_DOMAIN: BASEURL
SECRET: GENERATED_SECRET
MONGO_URL: mongodb://user:pass@mongodb.namespace.svc.cluster.local:27017/vrite
REDIS_URL: redis://:pass@redis-master.namespace.svc.cluster.local:6379
SENDER_EMAIL: MAIL@gmail.com
SENDER_NAME: Sebastian Fritsch
SMTP_HOST: smtp.gmail.com
SMTP_PORT: "587"
SMTP_USERNAME: MAIL@gmail.com
SMTP_PASSWORD: APP_PASS
SMTP_SECURE: "true"
PUBLIC_COLLAB_URL: http://VRITE_HELM_RELEASE_NAME.namespace.svc.cluster.local:5555
PUBLIC_APP_URL: http://VRITE_HELM_RELEASE_NAME.namespace.svc.cluster.local:3333
PUBLIC_API_URL: http://VRITE_HELM_RELEASE_NAME.namespace.svc.cluster.local:4444
PUBLIC_ASSETS_URL: http://VRITE_HELM_RELEASE_NAME.namespace.svc.cluster.local:8888
S3_BUCKET: vrite-images
S3_ENDPOINT: http://minio.namespace.svc.cluster.local:9000
S3_REGION: us-east-1
S3_ACCESS_KEY: USER
S3_SECRET_KEY: PASS
S3_FORCE_PATH_STYLE: true"

Liveness- and ReadinessProbe

For Vrite-API you can set Liveness- and ReadinessProbe to /swagger.json:

livenessProbe:
            httpGet:
              path: /swagger.json
              port: http
              scheme: HTTP

for Vrite-Assets you need to remove Liveness- and ReadinessProbe, the other ones can be set to path: /

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants