From f3a544937b08dbe8e9802ab0fbd244929bd46713 Mon Sep 17 00:00:00 2001 From: Thomas Richter Date: Sun, 1 Feb 2026 13:24:13 +0100 Subject: [PATCH] docs(06-02): add Docker deployment section to README - Quick Start with docker-compose commands - Configuration with key environment variables - Reverse proxy setup instructions - Data persistence and volume info - Backup and restore procedures - Health check verification --- README.md | 109 ++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 85 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 210fcbc..70f7c6f 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,14 @@ -# sv +# TaskPlaner -Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli). - -## Creating a project - -If you're seeing this, you've probably already done this step. Congrats! - -```sh -# create a new project -npx sv create my-app -``` - -To recreate this project with the same configuration: - -```sh -# recreate this project -npx sv create --template minimal --types ts --no-install . -``` +A simple task and thought capture app. Quickly add tasks, thoughts, and notes from any device. ## Developing -Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: +Install dependencies and start a development server: ```sh +npm install npm run dev - -# or start the server and open the app in a new browser tab -npm run dev -- --open ``` ## Building @@ -37,6 +19,85 @@ To create a production version of your app: npm run build ``` -You can preview the production build with `npm run preview`. +## Docker Deployment -> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment. +### Quick Start + +```bash +# Build and start the container +docker-compose up -d + +# View logs +docker-compose logs -f + +# Stop the container +docker-compose down +``` + +The application will be available at http://localhost:3000 + +### Configuration + +Copy `.env.example` to `.env` and customize: + +```bash +cp .env.example .env +``` + +Key settings: +- `ORIGIN` - Required for production. Set to your public URL (e.g., `https://tasks.example.com`) +- `BODY_SIZE_LIMIT` - Max upload size. Default: `512kb`, recommended: `10M` +- `PORT` - Server port inside container. Default: `3000` + +### Behind a Reverse Proxy + +When running behind nginx, traefik, or similar, uncomment these in `.env`: + +```bash +PROTOCOL_HEADER=x-forwarded-proto +HOST_HEADER=x-forwarded-host +ADDRESS_HEADER=x-forwarded-for +XFF_DEPTH=1 +``` + +### Data Persistence + +Data is stored in a Docker named volume (`taskplaner_data`). This includes: +- SQLite database (`/app/data/taskplaner.db`) +- Uploaded images (`/app/data/uploads/`) + +The volume persists across container restarts and updates. + +### Backup & Restore + +Create a backup: +```bash +./backup.sh +``` + +Backups are saved to `./backups/` with timestamps. + +Restore from backup: +```bash +# Stop the container first +docker-compose down + +# Restore (replace TIMESTAMP with actual backup filename) +docker run --rm \ + -v taskplaner_taskplaner_data:/data \ + -v $(pwd)/backups:/backup \ + alpine tar xzf /backup/taskplaner_backup_TIMESTAMP.tar.gz -C /data + +# Start the container +docker-compose up -d +``` + +### Health Check + +The container includes a health check at `/health`. View status: + +```bash +docker-compose ps +``` + +A healthy container shows `(healthy)` in the status column.