getredash / setup

Setup scripts for Redash Cloud Images
BSD 2-Clause "Simplified" License
303 stars 383 forks source link

Docker Compose for MacOS / Linux / Windows #52

Closed matanbaruch closed 2 months ago

matanbaruch commented 10 months ago

Hey, For anyone having problems with running preview version of Redash (redash/redash:preview)

Use this docker-compose.yml (Alerts is also working)

version: "3"
services:
  server:
    image: redash/redash:preview
    depends_on:
      init-server:
        condition: service_completed_successfully
    restart: always
    environment:
      PYTHONUNBUFFERED: "0"
      REDASH_LOG_LEVEL: "INFO"
      REDASH_REDIS_URL: "redis://redis:6379/0"
      REDASH_COOKIE_SECRET: "xuiCIAEfejj05ZUzQ0odb5pwBttXUkE4"
      REDASH_SECRET_KEY: "9emtXqroCnNhFiETBiFXoQvA4PH0nQuP"
      REDASH_DATABASE_URL: "postgresql://postgres:YKK1KkvPb4ula2HRXlnd7z7n6rVbWKSq@postgres/postgres"
      REDASH_RATELIMIT_ENABLED: "false"
      REDASH_MAIL_DEFAULT_SENDER: "redash@example.com"
      REDASH_MAIL_SERVER: "email"
      REDASH_MAIL_PORT: 1025
      REDASH_ENFORCE_CSRF: "true"
      REDASH_GUNICORN_TIMEOUT: 60
    ports:
      - "5000:5000"
    platform: linux/amd64
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:5000/ping"]
      interval: 1s
      timeout: 2s
      retries: 30

  init-server:
    image: redash/redash:preview
    depends_on:
      - postgres
      - redis
    command:
      - create_db
    environment:
      PYTHONUNBUFFERED: "0"
      REDASH_LOG_LEVEL: "INFO"
      REDASH_REDIS_URL: "redis://redis:6379/0"
      REDASH_COOKIE_SECRET: "xuiCIAEfejj05ZUzQ0odb5pwBttXUkE4"
      REDASH_SECRET_KEY: "9emtXqroCnNhFiETBiFXoQvA4PH0nQuP"
      REDASH_DATABASE_URL: "postgresql://postgres:YKK1KkvPb4ula2HRXlnd7z7n6rVbWKSq@postgres/postgres"
      REDASH_RATELIMIT_ENABLED: "false"
      REDASH_MAIL_DEFAULT_SENDER: "redash@example.com"
      REDASH_MAIL_SERVER: "email"
      REDASH_MAIL_PORT: 1025
      REDASH_ENFORCE_CSRF: "true"
      REDASH_GUNICORN_TIMEOUT: 60
    ports:
      - "5000:5000"
    platform: linux/amd64

  scheduler:
    image: redash/redash:preview
    depends_on:
      - redis
    restart: always
    command: scheduler
    environment:
      QUEUES: "celery"
      WORKERS_COUNT: 1
      PYTHONUNBUFFERED: "0"
      REDASH_LOG_LEVEL: "INFO"
      REDASH_REDIS_URL: "redis://redis:6379/0"
      REDASH_COOKIE_SECRET: "xuiCIAEfejj05ZUzQ0odb5pwBttXUkE4"
      REDASH_SECRET_KEY: "9emtXqroCnNhFiETBiFXoQvA4PH0nQuP"
      REDASH_DATABASE_URL: "postgresql://postgres:YKK1KkvPb4ula2HRXlnd7z7n6rVbWKSq@postgres/postgres"
      REDASH_RATELIMIT_ENABLED: "false"
      REDASH_MAIL_DEFAULT_SENDER: "redash@example.com"
      REDASH_MAIL_SERVER: "email"
      REDASH_MAIL_PORT: 1025
      REDASH_ENFORCE_CSRF: "true"
      REDASH_GUNICORN_TIMEOUT: 60
    platform: linux/amd64

  worker:
    image: redash/redash:preview
    depends_on:
      - redis
    restart: always
    command: worker
    environment:
      QUEUES: "scheduled_queries,schemas,periodic,emails,default"
      WORKERS_COUNT: 6
      PYTHONUNBUFFERED: "0"
      REDASH_LOG_LEVEL: "INFO"
      REDASH_REDIS_URL: "redis://redis:6379/0"
      REDASH_COOKIE_SECRET: "xuiCIAEfejj05ZUzQ0odb5pwBttXUkE4"
      REDASH_SECRET_KEY: "9emtXqroCnNhFiETBiFXoQvA4PH0nQuP"
      REDASH_DATABASE_URL: "postgresql://postgres:YKK1KkvPb4ula2HRXlnd7z7n6rVbWKSq@postgres/postgres"
      REDASH_RATELIMIT_ENABLED: "false"
      REDASH_MAIL_DEFAULT_SENDER: "redash@example.com"
      REDASH_MAIL_SERVER: "email"
      REDASH_MAIL_PORT: 1025
      REDASH_ENFORCE_CSRF: "true"
      REDASH_GUNICORN_TIMEOUT: 60
    platform: linux/amd64

  adhoc-worker:
    image: redash/redash:preview
    depends_on:
      - redis
    restart: always
    command: worker
    environment:
      QUEUES: "queries"
      WORKERS_COUNT: 2
      PYTHONUNBUFFERED: "0"
      REDASH_LOG_LEVEL: "INFO"
      REDASH_REDIS_URL: "redis://redis:6379/0"
      REDASH_COOKIE_SECRET: "xuiCIAEfejj05ZUzQ0odb5pwBttXUkE4"
      REDASH_SECRET_KEY: "9emtXqroCnNhFiETBiFXoQvA4PH0nQuP"
      REDASH_DATABASE_URL: "postgresql://postgres:YKK1KkvPb4ula2HRXlnd7z7n6rVbWKSq@postgres/postgres"
      REDASH_RATELIMIT_ENABLED: "false"
      REDASH_MAIL_DEFAULT_SENDER: "redash@example.com"
      REDASH_MAIL_SERVER: "email"
      REDASH_MAIL_PORT: 1025
      REDASH_ENFORCE_CSRF: "true"
      REDASH_GUNICORN_TIMEOUT: 60
    platform: linux/amd64

  redis:
    image: redis:7.0-alpine
    restart: always

  postgres:
    image: postgres:15-alpine
    restart: always
    environment:
      POSTGRES_PASSWORD: "YKK1KkvPb4ula2HRXlnd7z7n6rVbWKSq"

  nginx:
    image: redash/nginx:latest
    ports:
      - "80:80"
    depends_on:
      - server
    links:
      - server:redash
    restart: always

  email:
    image: maildev/maildev
    ports:
    - "1080:1080"
    - "1025:1025"
    restart: always
justinclift commented 8 months ago

Looking over that compose file, it has an awful lot of duplication of environment variables.

In theory (!), you should be able to throw the duplicates into a separate file and have them all refer to it.

That's what the env file is meant for here:

https://github.com/getredash/setup/blob/b9ee472e57b0bb78e81f0bb187e5d46e4cb02a47/data/compose.yaml#L6


That aside, the title for this issue mentions MacOS / Linux / Windows in it, but the compose file has platform: linux/amd64. What's the concept there? :smile:

matanbaruch commented 2 months ago

You are right :) I will open another issue with correct compose.