Compare commits
15 Commits
fix/remove
...
fix/docker
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd076d5efe | ||
|
|
0757855451 | ||
|
|
d65244f94d | ||
|
|
290b72660c | ||
|
|
2dad48d223 | ||
|
|
5125a735e5 | ||
|
|
aba9f972a8 | ||
|
|
b90defa872 | ||
|
|
8d5bd61474 | ||
|
|
eeedc77a0f | ||
|
|
4f152e1224 | ||
|
|
4d48bf140d | ||
|
|
1c75a948f9 | ||
|
|
3a48c797b7 | ||
|
|
b838e8040a |
33
.env.example
33
.env.example
@@ -1,28 +1,39 @@
|
|||||||
POSTGRES_URL=
|
# https://github.com/kanbn/kan?tab=readme-ov-file#environment-variables-)
|
||||||
|
|
||||||
EMAIL_FROM=
|
# Required environment variables
|
||||||
|
NEXT_PUBLIC_BASE_URL= # e.g. https://kan.bn
|
||||||
|
BETTER_AUTH_SECRET= # Random 32+ char string (can gen with: openssl rand -base64 24 | tr -dc 'a-zA-Z0-9' | head -c 32)
|
||||||
|
POSTGRES_URL= # e.g. postgresql://kan:your_password@your_host:5432/kan
|
||||||
|
|
||||||
|
# Only required if deploying from compose
|
||||||
|
POSTGRES_PASSWORD=
|
||||||
|
|
||||||
|
# SMTP (optional)
|
||||||
SMTP_HOST=
|
SMTP_HOST=
|
||||||
SMTP_PORT=
|
SMTP_PORT=465 # Port 587 will not work
|
||||||
SMTP_USER=
|
SMTP_USER=
|
||||||
SMTP_PASSWORD=
|
SMTP_PASSWORD=
|
||||||
|
EMAIL_FROM= # e.g. "Kan <hello@mail.kan.bn>"
|
||||||
|
|
||||||
NEXT_PUBLIC_BASE_URL=
|
# S3 storage (optional)
|
||||||
NEXT_PUBLIC_STORAGE_URL=
|
|
||||||
NEXT_PUBLIC_AVATAR_BUCKET_NAME=
|
|
||||||
NEXT_PUBLIC_ALLOW_CREDENTIALS=
|
|
||||||
NEXT_PUBLIC_DISABLE_SIGN_UP=
|
|
||||||
|
|
||||||
S3_REGION=
|
S3_REGION=
|
||||||
S3_ENDPOINT=
|
S3_ENDPOINT=
|
||||||
S3_ACCESS_KEY_ID=
|
S3_ACCESS_KEY_ID=
|
||||||
S3_SECRET_ACCESS_KEY=
|
S3_SECRET_ACCESS_KEY=
|
||||||
|
NEXT_PUBLIC_STORAGE_URL=
|
||||||
|
NEXT_PUBLIC_AVATAR_BUCKET_NAME=
|
||||||
|
NEXT_PUBLIC_STORAGE_DOMAIN=
|
||||||
|
|
||||||
BETTER_AUTH_SECRET=
|
# Auth config (optional)
|
||||||
BETTER_AUTH_TRUSTED_ORIGINS=
|
NEXT_PUBLIC_ALLOW_CREDENTIALS=
|
||||||
|
NEXT_PUBLIC_DISABLE_SIGN_UP=
|
||||||
|
|
||||||
|
# Integration providers (optional)
|
||||||
TRELLO_APP_API_KEY=
|
TRELLO_APP_API_KEY=
|
||||||
TRELLO_APP_SECRET=
|
TRELLO_APP_SECRET=
|
||||||
|
|
||||||
|
# OAuth providers (optional)
|
||||||
|
BETTER_AUTH_TRUSTED_ORIGINS=
|
||||||
GOOGLE_CLIENT_ID=
|
GOOGLE_CLIENT_ID=
|
||||||
GOOGLE_CLIENT_SECRET=
|
GOOGLE_CLIENT_SECRET=
|
||||||
DISCORD_CLIENT_ID=
|
DISCORD_CLIENT_ID=
|
||||||
|
|||||||
71
README.md
71
README.md
@@ -47,34 +47,67 @@ See our [roadmap](https://kan.bn/kan/roadmap) for upcoming features.
|
|||||||
|
|
||||||
## Self Hosting 🐳
|
## Self Hosting 🐳
|
||||||
|
|
||||||
### PostgreSQL Database Setup
|
The easiest way to self-host Kan is with Docker Compose. This will set up everything for you including your postgres database.
|
||||||
|
|
||||||
Kan requires a PostgreSQL database. You can run one using the official PostgreSQL Docker image:
|
1. Create a new file called `docker-compose.yml` and paste the following configuration:
|
||||||
|
|
||||||
```bash
|
```yaml
|
||||||
# Run PostgreSQL in a container using the official postgres image
|
services:
|
||||||
docker run -d \
|
web:
|
||||||
--name kan-db \
|
image: ghcr.io/kanbn/kan:latest
|
||||||
-e POSTGRES_DB=kan \
|
container_name: kan-web
|
||||||
-e POSTGRES_USER=kan_user \
|
ports:
|
||||||
-e POSTGRES_PASSWORD=your_secure_password \
|
- "3000:3000"
|
||||||
-p 5432:5432 \
|
networks:
|
||||||
-v kan_postgres_data:/var/lib/postgresql/data \
|
- kan-network
|
||||||
postgres:15
|
environment:
|
||||||
|
NEXT_PUBLIC_BASE_URL: http://localhost:3000
|
||||||
|
BETTER_AUTH_SECRET: your_auth_secret
|
||||||
|
POSTGRES_URL: postgresql://kan:your_postgres_password@postgres:5432/kan_db
|
||||||
|
NEXT_PUBLIC_ALLOW_CREDENTIALS: true
|
||||||
|
depends_on:
|
||||||
|
- postgres
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
# Your POSTGRES_URL should be:
|
postgres:
|
||||||
# postgres://kan_user:your_secure_password@your_host:5432/kan
|
image: postgres:15
|
||||||
|
container_name: kan-db
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: kan_db
|
||||||
|
POSTGRES_USER: kan
|
||||||
|
POSTGRES_PASSWORD: your_postgres_password
|
||||||
|
ports:
|
||||||
|
- 5432:5432
|
||||||
|
volumes:
|
||||||
|
- kan_postgres_data:/var/lib/postgresql/data
|
||||||
|
restart: unless-stopped
|
||||||
|
networks:
|
||||||
|
- kan-network
|
||||||
|
|
||||||
|
networks:
|
||||||
|
kan-network:
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
postgres_data:
|
||||||
```
|
```
|
||||||
|
|
||||||
### Kan Application Deployment
|
2. Start the containers in detached mode:
|
||||||
|
|
||||||
Deploy Kan with Docker using our pre-built image:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker pull ghcr.io/kanbn/kan:latest && docker run -it -p 3000:3000 --env-file .env ghcr.io/kanbn/kan:latest
|
docker compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
Make sure to create a `.env` file with the required environment variables (see the Environment Variables section below).
|
3. Access Kan at http://localhost:3000
|
||||||
|
|
||||||
|
The application will be running in the background. You can manage the containers using these commands:
|
||||||
|
|
||||||
|
- To stop the containers: `docker compose down`
|
||||||
|
- To view logs: `docker compose logs -f`
|
||||||
|
- To restart the containers: `docker compose restart`
|
||||||
|
|
||||||
|
For the complete Docker Compose configuration, see [docker-compose.yml](./docker-compose.yml) in the repository.
|
||||||
|
|
||||||
|
> **Note**: The Docker Compose configuration shown above is a minimal example. For a complete setup with all features (email, OAuth, file uploads, etc.), you'll need to create a `.env` file with the required environment variables. See the Environment Variables section below for the full list of available options.
|
||||||
|
|
||||||
## Local Development 🧑💻
|
## Local Development 🧑💻
|
||||||
|
|
||||||
|
|||||||
@@ -53,8 +53,14 @@ RUN --mount=type=cache,id=pnpm,target=~/.pnpm-store pnpm install --frozen-lockfi
|
|||||||
# Copy source code of isolated subworkspace
|
# Copy source code of isolated subworkspace
|
||||||
COPY --from=pruner /app/out/full/ .
|
COPY --from=pruner /app/out/full/ .
|
||||||
|
|
||||||
|
|
||||||
RUN pnpm build --filter=${PROJECT}
|
RUN pnpm build --filter=${PROJECT}
|
||||||
|
|
||||||
|
# Copy static files to standalone directory
|
||||||
|
RUN mkdir -p apps/web/.next/standalone/.next && \
|
||||||
|
mv apps/web/public apps/web/.next/standalone/ && \
|
||||||
|
mv apps/web/.next/static apps/web/.next/standalone/.next/
|
||||||
|
|
||||||
# 4. Final image - runner stage to run the application
|
# 4. Final image - runner stage to run the application
|
||||||
FROM base AS runner
|
FROM base AS runner
|
||||||
ARG APP_DIRNAME
|
ARG APP_DIRNAME
|
||||||
@@ -75,6 +81,5 @@ ARG PORT=3000
|
|||||||
ENV PORT=${PORT}
|
ENV PORT=${PORT}
|
||||||
EXPOSE ${PORT}
|
EXPOSE ${PORT}
|
||||||
|
|
||||||
# Run migration on start for now (until we have a better way to handle this)
|
CMD ["/bin/sh", "./entrypoint.sh"]
|
||||||
CMD ["sh", "-c", "cd /app && pnpm db:migrate && cd /app/apps/web && pnpm start"]
|
|
||||||
|
|
||||||
|
|||||||
16
apps/web/entrypoint.sh
Normal file
16
apps/web/entrypoint.sh
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Run migrations from the Turborepo root context
|
||||||
|
echo "Running database migrations..."
|
||||||
|
# Navigate to the Turborepo root to run the db:migrate command
|
||||||
|
pnpm --prefix /app db:migrate
|
||||||
|
|
||||||
|
# Check if migration was successful
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "\nDatabase migration failed! Exiting."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "\nStarting Next.js application..."
|
||||||
|
# Start the Next.js application from the web app's directory
|
||||||
|
exec node .next/standalone/apps/web/server.js
|
||||||
@@ -10,6 +10,7 @@ configureRuntimeEnv();
|
|||||||
|
|
||||||
/** @type {import("next").NextConfig} */
|
/** @type {import("next").NextConfig} */
|
||||||
const config = {
|
const config = {
|
||||||
|
output: "standalone",
|
||||||
reactStrictMode: true,
|
reactStrictMode: true,
|
||||||
|
|
||||||
/** Enables hot reloading for local packages without a build step */
|
/** Enables hot reloading for local packages without a build step */
|
||||||
|
|||||||
@@ -17,8 +17,11 @@ export const env = createEnv({
|
|||||||
BETTER_AUTH_SECRET: z.string(),
|
BETTER_AUTH_SECRET: z.string(),
|
||||||
BETTER_AUTH_TRUSTED_ORIGINS: z
|
BETTER_AUTH_TRUSTED_ORIGINS: z
|
||||||
.string()
|
.string()
|
||||||
.refine((s) =>
|
.transform((s) => (s === "" ? undefined : s))
|
||||||
s.split(",").every((l) => z.string().url().safeParse(l).success),
|
.refine(
|
||||||
|
(s) =>
|
||||||
|
!s ||
|
||||||
|
s.split(",").every((l) => z.string().url().safeParse(l).success),
|
||||||
)
|
)
|
||||||
.optional(),
|
.optional(),
|
||||||
POSTGRES_URL: z.string().url(),
|
POSTGRES_URL: z.string().url(),
|
||||||
@@ -82,11 +85,17 @@ export const env = createEnv({
|
|||||||
NEXT_PUBLIC_STORAGE_DOMAIN: z.string().optional(),
|
NEXT_PUBLIC_STORAGE_DOMAIN: z.string().optional(),
|
||||||
NEXT_PUBLIC_ALLOW_CREDENTIALS: z
|
NEXT_PUBLIC_ALLOW_CREDENTIALS: z
|
||||||
.string()
|
.string()
|
||||||
.refine((s) => s.toLowerCase() === "true" || s.toLowerCase() === "false")
|
.transform((s) => (s === "" ? undefined : s))
|
||||||
|
.refine(
|
||||||
|
(s) => !s || s.toLowerCase() === "true" || s.toLowerCase() === "false",
|
||||||
|
)
|
||||||
.optional(),
|
.optional(),
|
||||||
NEXT_PUBLIC_DISABLE_SIGN_UP: z
|
NEXT_PUBLIC_DISABLE_SIGN_UP: z
|
||||||
.string()
|
.string()
|
||||||
.refine((s) => s.toLowerCase() === "true" || s.toLowerCase() === "false")
|
.transform((s) => (s === "" ? undefined : s))
|
||||||
|
.refine(
|
||||||
|
(s) => !s || s.toLowerCase() === "true" || s.toLowerCase() === "false",
|
||||||
|
)
|
||||||
.optional(),
|
.optional(),
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,31 +1,49 @@
|
|||||||
version: "3.7"
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
web:
|
web:
|
||||||
image: ghcr.io/kanbn/kan:latest
|
image: ghcr.io/kanbn/kan:latest
|
||||||
|
container_name: kan-web
|
||||||
ports:
|
ports:
|
||||||
- "3001:3000"
|
- "${WEB_PORT:-3000}:3000"
|
||||||
networks:
|
networks:
|
||||||
|
- kan-network
|
||||||
- dokploy-network
|
- dokploy-network
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: ./apps/web/Dockerfile
|
dockerfile: ./apps/web/Dockerfile
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
command: ["pnpm", "start"]
|
|
||||||
environment:
|
environment:
|
||||||
- EMAIL_FROM=${EMAIL_FROM}
|
# Required environment variables
|
||||||
|
- NEXT_PUBLIC_BASE_URL=${NEXT_PUBLIC_BASE_URL}
|
||||||
|
- BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET}
|
||||||
|
- POSTGRES_URL=${POSTGRES_URL}
|
||||||
|
|
||||||
|
# SMTP (optional)
|
||||||
- SMTP_HOST=${SMTP_HOST}
|
- SMTP_HOST=${SMTP_HOST}
|
||||||
- SMTP_PORT=${SMTP_PORT}
|
- SMTP_PORT=${SMTP_PORT}
|
||||||
- SMTP_USER=${SMTP_USER}
|
- SMTP_USER=${SMTP_USER}
|
||||||
- SMTP_PASSWORD=${SMTP_PASSWORD}
|
- SMTP_PASSWORD=${SMTP_PASSWORD}
|
||||||
- BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET}
|
- EMAIL_FROM=${EMAIL_FROM}
|
||||||
- BETTER_AUTH_TRUSTED_ORIGINS=${BETTER_AUTH_TRUSTED_ORIGINS}
|
|
||||||
- STRIPE_SECRET_KEY=${STRIPE_SECRET_KEY}
|
# S3 storage (optional)
|
||||||
- STRIPE_WEBHOOK_SECRET=${STRIPE_WEBHOOK_SECRET}
|
- S3_ACCESS_KEY_ID=${S3_ACCESS_KEY_ID}
|
||||||
- POSTGRES_URL=${POSTGRES_URL}
|
- S3_SECRET_ACCESS_KEY=${S3_SECRET_ACCESS_KEY}
|
||||||
|
- S3_REGION=${S3_REGION}
|
||||||
|
- S3_ENDPOINT=${S3_ENDPOINT}
|
||||||
|
- NEXT_PUBLIC_STORAGE_URL=${NEXT_PUBLIC_STORAGE_URL}
|
||||||
|
- NEXT_PUBLIC_AVATAR_BUCKET_NAME=${NEXT_PUBLIC_AVATAR_BUCKET_NAME}
|
||||||
|
- NEXT_PUBLIC_STORAGE_DOMAIN=${NEXT_PUBLIC_STORAGE_DOMAIN}
|
||||||
|
|
||||||
|
# Auth config (optional)
|
||||||
|
- NEXT_PUBLIC_ALLOW_CREDENTIALS=${NEXT_PUBLIC_ALLOW_CREDENTIALS}
|
||||||
|
- NEXT_PUBLIC_DISABLE_SIGN_UP=${NEXT_PUBLIC_DISABLE_SIGN_UP}
|
||||||
|
|
||||||
|
# Integration providers (optional)
|
||||||
- TRELLO_APP_API_KEY=${TRELLO_APP_API_KEY}
|
- TRELLO_APP_API_KEY=${TRELLO_APP_API_KEY}
|
||||||
- TRELLO_APP_SECRET=${TRELLO_APP_SECRET}
|
- TRELLO_APP_SECRET=${TRELLO_APP_SECRET}
|
||||||
|
|
||||||
|
# OAuth providers (optional)
|
||||||
|
- BETTER_AUTH_TRUSTED_ORIGINS=${BETTER_AUTH_TRUSTED_ORIGINS}
|
||||||
- GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID}
|
- GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID}
|
||||||
- GOOGLE_CLIENT_SECRET=${GOOGLE_CLIENT_SECRET}
|
- GOOGLE_CLIENT_SECRET=${GOOGLE_CLIENT_SECRET}
|
||||||
- DISCORD_CLIENT_ID=${DISCORD_CLIENT_ID}
|
- DISCORD_CLIENT_ID=${DISCORD_CLIENT_ID}
|
||||||
@@ -63,18 +81,35 @@ services:
|
|||||||
- APPLE_CLIENT_ID=${APPLE_CLIENT_ID}
|
- APPLE_CLIENT_ID=${APPLE_CLIENT_ID}
|
||||||
- APPLE_CLIENT_SECRET=${APPLE_CLIENT_SECRET}
|
- APPLE_CLIENT_SECRET=${APPLE_CLIENT_SECRET}
|
||||||
- APPLE_APP_BUNDLE_IDENTIFIER=${APPLE_APP_BUNDLE_IDENTIFIER}
|
- APPLE_APP_BUNDLE_IDENTIFIER=${APPLE_APP_BUNDLE_IDENTIFIER}
|
||||||
- S3_ACCESS_KEY_ID=${S3_ACCESS_KEY_ID}
|
|
||||||
- S3_SECRET_ACCESS_KEY=${S3_SECRET_ACCESS_KEY}
|
# Cloud (not required)
|
||||||
- S3_REGION=${S3_REGION}
|
|
||||||
- S3_ENDPOINT=${S3_ENDPOINT}
|
|
||||||
- NEXT_PUBLIC_KAN_ENV=${NEXT_PUBLIC_KAN_ENV}
|
- NEXT_PUBLIC_KAN_ENV=${NEXT_PUBLIC_KAN_ENV}
|
||||||
- NEXT_PUBLIC_BASE_URL=${NEXT_PUBLIC_BASE_URL}
|
|
||||||
- NEXT_PUBLIC_STORAGE_URL=${NEXT_PUBLIC_STORAGE_URL}
|
|
||||||
- NEXT_PUBLIC_AVATAR_BUCKET_NAME=${NEXT_PUBLIC_AVATAR_BUCKET_NAME}
|
|
||||||
- NEXT_PUBLIC_STORAGE_DOMAIN=${NEXT_PUBLIC_STORAGE_DOMAIN}
|
|
||||||
- NEXT_PUBLIC_UMAMI_ID=${NEXT_PUBLIC_UMAMI_ID}
|
- NEXT_PUBLIC_UMAMI_ID=${NEXT_PUBLIC_UMAMI_ID}
|
||||||
- NEXT_PUBLIC_ALLOW_CREDENTIALS=${NEXT_PUBLIC_ALLOW_CREDENTIALS}
|
- STRIPE_SECRET_KEY=${STRIPE_SECRET_KEY}
|
||||||
- NEXT_PUBLIC_DISABLE_SIGN_UP=${NEXT_PUBLIC_DISABLE_SIGN_UP}
|
- STRIPE_WEBHOOK_SECRET=${STRIPE_WEBHOOK_SECRET}
|
||||||
|
depends_on:
|
||||||
|
- postgres
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
postgres:
|
||||||
|
image: postgres:15
|
||||||
|
container_name: kan-db
|
||||||
|
environment:
|
||||||
|
- POSTGRES_DB=kan_db
|
||||||
|
- POSTGRES_USER=kan
|
||||||
|
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||||
|
ports:
|
||||||
|
- 5432:5432
|
||||||
|
volumes:
|
||||||
|
- kan_postgres_data:/var/lib/postgresql/data
|
||||||
|
restart: unless-stopped
|
||||||
|
networks:
|
||||||
|
- kan-network
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
|
kan-network:
|
||||||
dokploy-network:
|
dokploy-network:
|
||||||
external: true
|
external: true
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
kan_postgres_data:
|
||||||
|
|||||||
Reference in New Issue
Block a user