Merge pull request #491 from automatisch/issue-489

feat(docker-compose): add worker as service
This commit is contained in:
Ömer Faruk Aydın
2022-09-08 16:55:09 +03:00
committed by GitHub
6 changed files with 34 additions and 3 deletions

View File

@@ -2,7 +2,7 @@ version: "3.9"
services: services:
automatisch: automatisch:
build: build:
context: . context: ../images/wait-for-postgres
network: host network: host
ports: ports:
- "3000:3000" - "3000:3000"
@@ -18,6 +18,23 @@ services:
- POSTGRES_HOST=postgres - POSTGRES_HOST=postgres
- POSTGRES_DATABASE=automatisch - POSTGRES_DATABASE=automatisch
- POSTGRES_USERNAME=automatisch_user - POSTGRES_USERNAME=automatisch_user
volumes:
- automatisch_storage:/automatisch/storage
worker:
build:
context: ../images/plain
network: host
depends_on:
- automatisch
environment:
- APP_ENV=production
- REDIS_HOST=redis
- POSTGRES_HOST=postgres
- POSTGRES_DATABASE=automatisch
- POSTGRES_USERNAME=automatisch_user
command: automatisch start-worker --env-file /automatisch/storage/.env
volumes:
- automatisch_storage:/automatisch/storage
postgres: postgres:
image: "postgres:14.5" image: "postgres:14.5"
environment: environment:
@@ -26,3 +43,5 @@ services:
POSTGRES_USER: automatisch_user POSTGRES_USER: automatisch_user
redis: redis:
image: "redis:7.0.4" image: "redis:7.0.4"
volumes:
automatisch_storage:

View File

@@ -0,0 +1,11 @@
# syntax=docker/dockerfile:1
FROM node:16
WORKDIR /automatisch
# npm registry for dev purposes
RUN npm config set fetch-retry-maxtimeout 5000
RUN npm config set fetch-retry-mintimeout 3000
RUN npm set registry http://localhost:5000
# npm registry for dev purposes
RUN yarn global add @automatisch/cli

View File

@@ -3,7 +3,7 @@ FROM node:16
WORKDIR /automatisch WORKDIR /automatisch
RUN apt-get update && apt-get install -y postgresql-client RUN apt-get update && apt-get install -y postgresql-client
COPY ./docker/wait-for-postgres.sh /automatisch/wait-for-postgres.sh COPY ./wait-for-postgres.sh /automatisch/wait-for-postgres.sh
# npm registry for dev purposes # npm registry for dev purposes
RUN npm config set fetch-retry-maxtimeout 5000 RUN npm config set fetch-retry-maxtimeout 5000

View File

@@ -81,6 +81,8 @@
"src", "src",
"server.js", "server.js",
"server.d.ts", "server.d.ts",
"worker.js",
"worker.d.ts",
"logger.js", "logger.js",
"logger.d.ts", "logger.d.ts",
"database.js", "database.js",

View File

@@ -4,7 +4,6 @@ import Base from './base';
import Step from './step'; import Step from './step';
import Execution from './execution'; import Execution from './execution';
import Telemetry from '../helpers/telemetry'; import Telemetry from '../helpers/telemetry';
import { IExecution } from '@automatisch/types';
class Flow extends Base { class Flow extends Base {
id!: string; id!: string;