Skip to content

Why can't I run the deployment with the built-in self-host mode? #142

Open

Description

@zhaoxiaozhao07

Hello, may I ask how you deployed your self-hosted service? I can never get it to run when I deploy it. Could you share your deployment process? It would be even better if you are willing to provide the docker-compose.yml. Thank you very much.

I have figured out a usable docker-compose.yml, but there is a serious problem: if this service is deployed on the public network, everyone can connect to and use it, with no permission settings or key verification. Restricting it to a whitelist is very troublesome because the mobile phone's IP changes at any time.

Here are my Dockerfile and docker-compose.yml.

Dockerfile:

FROM node:20 AS builder
RUN apt-get update && apt-get install -y python3 ffmpeg make g++ build-essential && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY package.json yarn.lock ./
COPY ./prisma ./prisma
RUN yarn install --frozen-lockfile --ignore-engines
COPY ./tsconfig.json ./tsconfig.json
COPY ./vitest.config.ts ./vitest.config.ts
COPY ./sources ./sources
RUN yarn build
FROM node:20 AS runner
WORKDIR /app
RUN apt-get update && apt-get install -y python3 ffmpeg && rm -rf /var/lib/apt/lists/*
ENV NODE_ENV=production
COPY --from=builder /app/tsconfig.json ./tsconfig.json
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/sources ./sources
COPY --from=builder /app/prisma ./prisma
EXPOSE 3000
CMD ["yarn", "start"]

docker-compose.yml:

services:
happy-server:
image: happy-server:latest
ports:
- "3009:3005"
restart: unless-stopped
environment:
- NODE_ENV=production
- DATABASE_URL=postgresql://postgres:postgres@postgres:5432/happy-server
- REDIS_URL=redis://redis:6379
- SEED=xxxxxxxxxxx
- PORT=3005
- HANDY_MASTER_SECRET=your-super-secret-key-for-local-development
- S3_HOST=minio
- S3_PORT=9000
- S3_USE_SSL=false
- S3_ACCESS_KEY=minioadmin
- S3_SECRET_KEY=minioadmin
- S3_BUCKET=happy
- S3_PUBLIC_URL=http://localhost:9000/happy
depends_on:
- postgres
- redis
- minio
command: >
sh -c "
npx prisma migrate deploy &&
yarn start
"

postgres:
image: postgres:15
restart: unless-stopped
environment:
- POSTGRES_DB=happy-server
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
volumes:
- postgres_data:/var/lib/postgresql/data

redis:
image: redis:7-alpine
restart: unless-stopped
volumes:
- redis_data:/data

minio:
image: minio/minio:latest
restart: unless-stopped
ports:
- "9000:9000"
- "9001:9001"
volumes:
- minio_data:/data
environment:
- MINIO_ROOT_USER=minioadmin
- MINIO_ROOT_PASSWORD=minioadmin
command: server /data --console-address ":9001"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
start_period: 40s

volumes:
postgres_data:
redis_data:
minio_data:

Activity

  1. imrane commented on Oct 14, 2025

    @imrane

    Did you get this working?

  2. zhaoxiaozhao07 commented on Oct 15, 2025

    @zhaoxiaozhao07
    Author

    Did you get this working?

    Yes, it's working now. The project documentation is outdated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • Status
      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions