2.0 KiB
2.0 KiB
Deployment Instructions for k3s (VPS)
This document provides instructions on how to deploy the Paprika API to a VPS running k3s.
1. Prepare the Container Image
AdonisJS needs to be built and containerized. If you don't have a Dockerfile, you can use the one provided below.
Create a Dockerfile
FROM node:22-alpine AS base
# All dependencies stage
FROM base AS deps
WORKDIR /app
ADD package.json package-lock.json ./
RUN npm ci
# Production dependencies stage
FROM base AS production-deps
WORKDIR /app
ADD package.json package-lock.json ./
RUN npm ci --omit=dev
# Build stage
FROM base AS build
WORKDIR /app
COPY --from=deps /app/node_modules /app/node_modules
ADD . .
RUN node ace build
# Production stage
FROM base AS production
ENV NODE_ENV=production
WORKDIR /app
COPY --from=production-deps /app/node_modules /app/node_modules
COPY --from=build /app/build /app
EXPOSE 3333
CMD ["node", "bin/server.js"]
Build and Push the image
Replace <your-registry> and <image-name> with your actual registry (e.g., Docker Hub, GitHub Packages).
docker build -t <your-registry>/<image-name>:latest .
docker push <your-registry>/<image-name>:latest
2. Configure the Kubernetes Manifest
- Open
k3s-deployment.yaml. - Update the
APP_KEYin theSecretsection (you can use the one from your.env). - Update the
imagefield in thepaprika-apiDeployment with your pushed image. - Update the
hostin theIngresssection to your VPS domain name.
3. Deploy to k3s
Connect to your VPS and run:
kubectl apply -f k3s-deployment.yaml
4. Run Database Migrations
After the pods are running, you need to run migrations inside the API container:
kubectl exec -it deployment/paprika-api -- node ace migration:run --force
5. Verification
- Check pods:
kubectl get pods - Check logs:
kubectl logs -f deployment/paprika-api - Access the API via your domain or VPS IP (if Ingress is configured).