Compare commits
3 Commits
ad28e5629e
...
879a46ccac
Author | SHA1 | Date | |
---|---|---|---|
879a46ccac | |||
8912968d75 | |||
e3579011e8 |
2
.gitignore
vendored
@@ -1,7 +1,7 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# Hosting
|
||||
/host/convex/docker/data
|
||||
/docker/data
|
||||
|
||||
# dependencies
|
||||
node_modules
|
||||
|
42
README.md
@@ -31,29 +31,27 @@ I would recommend using [bun](https://bun.sh/) to install dependencies.
|
||||
bun i
|
||||
```
|
||||
|
||||
You will also need docker installed on whatever host you plan to run the Supabase instance from, whether locally, or on a home server or a VPS or whatever. Or you can just use the Supabase SaaS if you want to have a much easier time, probably. I wouldn't know!
|
||||
You will also need docker installed on whatever host you plan to run the Convex instance from, whether locally, or on a home server or a VPS or whatever. Or you can just use the Convex SaaS if you want to have a much easier time, probably. I wouldn't know!
|
||||
|
||||
### Add your environment variables
|
||||
|
||||
Copy the example environment variable files and paste them in the same directory named `.env`.
|
||||
|
||||
Environment variables for Next Application
|
||||
```bash
|
||||
cp ./app/next/env.example ./app/next/.env
|
||||
cp ./apps/next/env.example ./apps/next/.env
|
||||
```
|
||||
|
||||
Environment variables for Self Hosting Convex & Website with Docker
|
||||
```bash
|
||||
cp ./host/convex/docker/env.example ./host/convex/docker/.env
|
||||
cp ./docker/env.example ./docker/.env
|
||||
```
|
||||
|
||||
```bash
|
||||
cp ./host/next/docker/env.example ./host/next/docker/.env
|
||||
```
|
||||
|
||||
### Start self hosted convex
|
||||
### Start self hosted convex & Next Web Application
|
||||
|
||||
The basic gist is to run the commands below after you have filled out the environment variables you plan to use, but you should ultimately follow the [guide they provide](https://github.com/get-convex/convex-backend/tree/main/self-hosted)
|
||||
```bash
|
||||
cd ./host/convex/docker
|
||||
cd ./docker
|
||||
sudo docker compose up -d
|
||||
sudo docker compose exec convex-backend ./generate_admin_key.sh
|
||||
```
|
||||
@@ -66,32 +64,6 @@ Run
|
||||
bun dev
|
||||
```
|
||||
|
||||
to start your development environment with turbopack
|
||||
|
||||
You can also run
|
||||
|
||||
```bash
|
||||
bun dev:slow
|
||||
```
|
||||
|
||||
to start your development environment with webpack (This is for the next app.)
|
||||
|
||||
### Start your Production Environment.
|
||||
|
||||
There are Dockerfiles & docker compose files that can be found in the `./scripts/docker` folder for the Next.js website. There is also a script called `reload_container` located in the `./scripts/` folder which was created to quickly update the container, but this will give you a better idea of what you need to do. First, build the image with
|
||||
|
||||
```bash
|
||||
sudo docker compose -f ./host/next/docker/compose.yml build
|
||||
```
|
||||
|
||||
then you can run the container with
|
||||
|
||||
```bash
|
||||
sudo docker compose -f ./host/next/docker/compose up -d
|
||||
```
|
||||
|
||||
Now, you may end up with some build errors. The `reload_containers` script swaps out the next config before it runs the docker build to skip any build errors, so you may want to do this as well, though you are welcome to fix the build errors as well, of course!
|
||||
|
||||
### Fin
|
||||
|
||||
I am sure I am missing a lot of stuff so feel free to open an issue if you have any questions or if you feel that I should add something here!
|
||||
|
@@ -1,55 +0,0 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
# --- Bun on Alpine for build ---
|
||||
FROM oven/bun:alpine AS base
|
||||
|
||||
# --- deps: install node_modules with Bun ---
|
||||
FROM base AS deps
|
||||
RUN apk add --no-cache libc6-compat
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package + whichever Bun lock file you have (optional)
|
||||
COPY package.json bun.lockb* bun.lock* ./
|
||||
COPY tsconfig.base.json ./
|
||||
COPY apps/next/package.json ./apps/next/
|
||||
|
||||
# If bun.lockb exists, enforce frozen; otherwise install and generate it
|
||||
RUN if [ -f bun.lockb ]; then \
|
||||
bun install --frozen-lockfile; \
|
||||
else \
|
||||
bun install; \
|
||||
fi
|
||||
|
||||
# --- builder: build Next.js with Bun ---
|
||||
FROM base AS builder
|
||||
WORKDIR /app
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY --from=deps /app/tsconfig.base.json ./tsconfig.base.json
|
||||
COPY apps/next ./apps/next
|
||||
COPY packages ./packages
|
||||
WORKDIR /app/apps/next
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
RUN bun run build
|
||||
|
||||
# --- runner: Node on Alpine to run server.js ---
|
||||
FROM node:20-alpine AS runner
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
|
||||
# non-root user
|
||||
RUN addgroup -S nodejs -g 1001 && adduser -S nextjs -u 1001
|
||||
COPY --from=builder /app/apps/next/public ./public
|
||||
RUN mkdir .next && chown -R nextjs:nodejs .next
|
||||
RUN mkdir -p .next/cache && chown -R nextjs:nodejs .next
|
||||
|
||||
# Next standalone output
|
||||
COPY --from=builder /app/apps/next/.next/standalone ./
|
||||
COPY --from=builder /app/apps/next/.next/static ./.next/static
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
|
||||
USER nextjs
|
||||
EXPOSE 3000
|
||||
ENV PORT=3000
|
||||
ENV HOSTNAME=0.0.0.0
|
||||
CMD ["node", "server.js"]
|
@@ -1,69 +0,0 @@
|
||||
networks:
|
||||
nginx-bridge: # You need to change this line to your defined network is as well
|
||||
external: true
|
||||
|
||||
services:
|
||||
techtracker-next:
|
||||
build:
|
||||
context: ../
|
||||
dockerfile: ./docker/Dockerfile
|
||||
image: ${CONTAINER_NAME}:alpine
|
||||
container_name: ${CONTAINER_NAME}
|
||||
env_file: [.env]
|
||||
hostname: ${CONTAINER_NAME}
|
||||
domainname: ${DOMAIN_NAME}
|
||||
networks: ['${NETWORK:-nginx-bridge}']
|
||||
#ports: ['${PORT}:3000']
|
||||
depends_on: ['convex-backend']
|
||||
tty: true
|
||||
stdin_open: true
|
||||
restart: unless-stopped
|
||||
convex-backend:
|
||||
image: ghcr.io/get-convex/convex-backend:${BACKEND_TAG:-00bd92723422f3bff968230c94ccdeb8c1719832}
|
||||
container_name: ${BACKEND_CONTAINER_NAME:-convex-backend}
|
||||
hostname: ${BACKEND_CONTAINER_NAME:-convex-backend}
|
||||
domainname: ${BACKEND_DOMAIN_NAME:-convex.gbrown.org}
|
||||
networks: ['${NETWORK:-nginx-bridge}']
|
||||
#user: '1000:1000'
|
||||
#ports: ['${BACKEND_PORT:-3210}:3210','${SITE_PROXY_PORT:-3211}:3211']
|
||||
volumes: [./data:/convex/data]
|
||||
labels: ['com.centurylinklabs.watchtower.enable=true']
|
||||
env_file: ['.env']
|
||||
environment:
|
||||
- INSTANCE_NAME
|
||||
- INSTANCE_SECRET
|
||||
- CONVEX_CLOUD_ORIGIN=${CONVEX_CLOUD_ORIGIN:-http://${BACKEND_CONTAINER_NAME:-convex-backend}:${BACKEND_PORT:-3210}}
|
||||
- CONVEX_SITE_ORIGIN=${CONVEX_SITE_ORIGIN:-http://${BACKEND_CONTAINER_NAME:-convex-backend}:${SITE_PROXY_PORT:-3211}}
|
||||
- DISABLE_BEACON=${DISABLE_BEACON:-}
|
||||
- REDACT_LOGS_TO_CLIENT=${REDACT_LOGS_TO_CLIENT:-}
|
||||
- DO_NOT_REQUIRE_SSL=${DO_NOT_REQUIRE_SSL:-}
|
||||
#- DATABASE_URL=${DATABASE_URL:-}
|
||||
stdin_open: true
|
||||
tty: true
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: curl -f http://localhost:3210/version
|
||||
interval: 5s
|
||||
start_period: 10s
|
||||
stop_grace_period: 10s
|
||||
stop_signal: SIGINT
|
||||
convex-dashboard:
|
||||
image: ghcr.io/get-convex/convex-dashboard:${DASHBOARD_TAG:-33cef775a8a6228cbacee4a09ac2c4073d62ed13}
|
||||
container_name: ${DASHBOARD_CONTAINER_NAME:-convex-dashboard}
|
||||
hostname: ${DASHBOARD_CONTAINER_NAME:-convex-dashboard}
|
||||
domainname: ${DASHBOARD_DOMAIN_NAME:-dashboard.${BACKEND_DOMAIN_NAME:-convex.gbrown.org}}
|
||||
networks: ['${NETWORK:-nginx-bridge}']
|
||||
#user: 1000:1000
|
||||
#ports: ['${DASHBOARD_PORT:-6791}:6791']
|
||||
labels: ['com.centurylinklabs.watchtower.enable=true']
|
||||
env_file: [.env]
|
||||
environment:
|
||||
- NEXT_PUBLIC_DEPLOYMENT_URL=${NEXT_PUBLIC_DEPLOYMENT_URL:-http://${BACKEND_CONTAINER_NAME:-convex-backend}:${PORT:-3210}}
|
||||
depends_on:
|
||||
convex-backend:
|
||||
condition: service_healthy
|
||||
stdin_open: true
|
||||
tty: true
|
||||
restart: unless-stopped
|
||||
stop_grace_period: 10s
|
||||
stop_signal: SIGINT
|
@@ -1 +0,0 @@
|
||||
Convex.gib
|
@@ -1 +0,0 @@
|
||||
d35a9c02aeef0070fac3069d51ac4926744b251d0e6d97dc239d78bce67959b6
|
Before Width: | Height: | Size: 1.1 MiB |
Before Width: | Height: | Size: 782 KiB |
Before Width: | Height: | Size: 1.1 MiB |
Before Width: | Height: | Size: 148 KiB |
Before Width: | Height: | Size: 782 KiB |
Before Width: | Height: | Size: 992 KiB |
Before Width: | Height: | Size: 1.2 MiB |
Before Width: | Height: | Size: 1.9 MiB |
Before Width: | Height: | Size: 6.4 KiB |
Before Width: | Height: | Size: 1.4 MiB |
Before Width: | Height: | Size: 3.6 MiB |
Before Width: | Height: | Size: 3.4 MiB |