devcontainer and various tweaks

This commit is contained in:
2026-02-10 21:12:26 -03:00
parent 9d1d1ae96b
commit 9f052d9232
8 changed files with 829 additions and 12 deletions

View File

@@ -77,18 +77,22 @@ This server currently provides MTA-STS protection for:
```
.
├── Dockerfile # Docker image definition
├── docker-compose.yml # Portainer stack configuration
├── package.json # Build and push scripts
├── .devcontainer/
│ └── devcontainer.json # Dev Container config (pnpm + Docker)
├── .dockerignore # Docker build context exclusions
├── .gitignore # Git exclusions
├── Dockerfile # Docker image definition
├── docker-compose.yml # Portainer stack configuration
├── package.json # Build and push scripts (pnpm)
├── nginx/
│ └── default.conf # nginx server configuration
│ └── default.conf # nginx server configuration
├── html/
│ ├── index.html # Landing page
│ ├── index.html # Landing page
│ └── .well-known/
│ └── mta-sts.txt # MTA-STS policy file
│ └── mta-sts.txt # MTA-STS policy file
└── .woodpecker/
├── build.yaml # CI: Build and push image
└── deploy.yaml # CI: Trigger Portainer webhook
├── build.yaml # CI: Build and push image
└── deploy.yaml # CI: Trigger Portainer webhook
```
## Setup & Deployment
@@ -96,10 +100,24 @@ This server currently provides MTA-STS protection for:
### Prerequisites
- Docker installed and logged into `git.mifi.dev`
- pnpm (for manual builds)
- pnpm (for manual builds) — see [Package manager](#package-manager)
- Access to the Gitea package registry
- Portainer webhook configured (for deployments)
### Package Manager
This project uses **pnpm** as the package manager. The version is pinned in `package.json` via the `packageManager` field. If you use [Corepack](https://nodejs.org/api/corepack.html) (bundled with Node.js 22+), run `corepack enable` once and the correct pnpm version will be used automatically.
### Dev Container (Optional)
A [Dev Container](https://containers.dev/) configuration is included for consistent local development. It provides:
- Node.js 24 with pnpm 10.28
- Docker CLI with access to the host Docker daemon (so you can run `pnpm build` and test images)
- VS Code extensions: Docker, Prettier
**To use:** Open the repo in VS Code or Cursor, install the "Dev Containers" extension if needed, and run **Dev Containers: Reopen in Container** from the command palette. The first build may take a few minutes.
### Local Development
1. **Clone the repository**:
@@ -108,17 +126,24 @@ This server currently provides MTA-STS protection for:
cd mta-sts
```
2. **Build the Docker image**:
2. **Preview the site locally** (optional):
```bash
pnpm install
pnpm dev
```
Open http://localhost:3000 for the landing page and http://localhost:3000/.well-known/mta-sts.txt for the policy file.
3. **Build the Docker image**:
```bash
pnpm build
```
3. **Test locally**:
4. **Test locally** (with the built image):
```bash
docker run -p 8080:80 git.mifi.dev/mifi-holdings/mta-sts:latest
```
Visit `http://localhost:8080` to see the landing page and `http://localhost:8080/.well-known/mta-sts.txt` for the policy file.
Visit http://localhost:8080 to see the landing page and http://localhost:8080/.well-known/mta-sts.txt for the policy file.
### Manual Deployment
@@ -183,6 +208,7 @@ To add MTA-STS support for a new domain:
| Script | Description |
|--------|-------------|
| `pnpm dev` | Start local dev server for `html/` at http://localhost:3000 |
| `pnpm build` | Build Docker image locally |
| `pnpm push` | Push Docker image to registry |
| `pnpm build:push` | Build and push in one command |
@@ -214,6 +240,22 @@ The container includes health checks that:
## Troubleshooting
### `pnpm install` shows DEP0169 / `url.parse()` deprecation warning
On **Node.js 24+**, you may see:
```text
DeprecationWarning: `url.parse()` behavior is not standardized...
```
This comes from pnpm (and its dependencies), not from this repo. The project has no runtime dependencies, so the warning is harmless and can be ignored. To hide it for a single run:
```bash
NODE_OPTIONS='--no-deprecation' pnpm install
```
To suppress it for your shell session: `export NODE_OPTIONS='--no-deprecation'`. See [pnpm#9492](https://github.com/pnpm/pnpm/issues/9492) for upstream progress.
### Container won't start
- Check Portainer logs for the `mta-sts` container
- Verify the image was pushed successfully to the registry