Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/PDNMX/s1_backend/llms.txt

Use this file to discover all available pages before exploring further.

Docker is the recommended way to run S1 Backend in production. The repository ships a dockerfile based on node:12-alpine and a Docker Compose file that wires the service into an external Docker network named DEMOSPDN. Together they provide a reproducible, self-contained deployment with a single docker-compose up command.

Prerequisites

Before deploying, make sure you have the following in place:
  • Docker ≥ 20.x installed and running
  • Docker Compose ≥ 1.29 installed
  • A completed endpoints.json file in the project root (see Configuration for the full schema)
endpoints.json must exist in the project root before you build the image. The Dockerfile copies the entire working directory into the container with ADD . /pdn_s1_backend, so a missing file means the container will start without any provider configuration.

Building the Image

The dockerfile at the project root defines a single-stage build on top of the official Node.js 12 Alpine image. It installs dependencies with Yarn, cleans the cache, and exposes the port declared by the PORT environment variable.
FROM node:12-alpine
MAINTAINER Sergio Rodríguez <[email protected]>
ADD . /pdn_s1_backend
WORKDIR /pdn_s1_backend
RUN yarn add global yarn \
&& yarn install \
&& yarn cache clean
EXPOSE ${PORT}
CMD ["yarn", "start"]
To build the image manually, run the following command from the project root:
docker build -t pdn-s1-backend:latest .
The dockerfile is based on node:12-alpine to keep the image footprint small. PORT is a runtime environment variable — it is read by bin/www when the Node.js process starts (process.env.PORT || '3000'). Because the Dockerfile declares no ARG PORT, the EXPOSE ${PORT} line does not resolve to a specific port number at build time; port exposure is effectively handled by the Docker Compose ports mapping at runtime. When using Docker Compose, PORT is read from your shell environment or a .env file automatically.
The docker-compose.yml file references dockerfile: Dockerfile (capital D), but the actual file in the repository is named dockerfile (all lowercase). On case-sensitive filesystems (Linux), this mismatch will cause docker-compose build to fail. Rename the file to Dockerfile on your host, or update the dockerfile: key in docker-compose.yml to match the lowercase name.

Running with Docker Compose

The included docker-compose.yml builds and runs the api service, maps the container port to the same host port, and joins the service to a pre-existing external Docker network called DEMOSPDN.
version: '3'
services:
  api:
    build:
      context: ./
      dockerfile: Dockerfile
    restart: always
    ports:
      - ${PORT}:${PORT}

networks:
  default:
    external:
      name: DEMOSPDN

External network — DEMOSPDN

The compose file declares DEMOSPDN as an external network, meaning Docker Compose will not create it automatically. You must create it once on the host before bringing the stack up:
docker network create DEMOSPDN
If the network already exists (for example, because other PDN services are already running), you can skip this step.

Starting the stack

Set the PORT variable in your shell (or in a .env file at the project root — see Environment Variables) and run:
PORT=3101 docker-compose up -d
The -d flag runs the stack in detached mode. Docker Compose will build the image if it has not been built yet and then start the api container with restart: always, so the service will come back automatically after a host reboot.

Verifying the Deployment

Once the container is running, confirm the API is responding:
curl -s http://localhost:3101/
Expected response:
{"title":"API del Sistema 1","version":"1.0"}
If you receive a connection error, check the container logs:
docker-compose logs -f api

Stopping the Service

To bring the stack down gracefully:
docker-compose down
This stops and removes the containers. The DEMOSPDN network is external, so Docker Compose will not remove it — other services sharing the network will not be affected.

Full Deployment Sequence

1

Create the external Docker network

Run this once on the host. Skip if DEMOSPDN already exists.
docker network create DEMOSPDN
2

Prepare configuration files

Copy the environment template and fill in your values:
cp .env.example .env
Ensure endpoints.json is present in the project root with all provider credentials populated. See Configuration for the required schema.
3

Build and start the service

PORT=3101 docker-compose up -d
Docker Compose will build the image and start the api container in the background.
4

Verify the API is healthy

curl -s http://localhost:3101/
You should see:
{"title":"API del Sistema 1","version":"1.0"}
5

Tail the logs (optional)

docker-compose logs -f api
Press Ctrl+C to stop following.

Build docs developers (and LLMs) love