jjethwa / rundeck

GNU General Public License v3.0
123 stars 137 forks source link

Connection to postgresql #125

Closed evolv34 closed 6 years ago

evolv34 commented 6 years ago

Hi,

I am using rundeck container. I would like to use postgresql to store rundeck project information. Does the current version supports postgresql ? Where should I place the postgres jdbc driver ?


    image: jordan/rundeck:latest
    ports: 
      - "4440:4440"
    links:
      - database:database
    environment:
      SKIP_DATABASE_SETUP: "false"
      NO_LOCAL_MYSQL: "true"
      DATABASE_URL: jdbc:postgres://database/rundeckdb?autoReconnect=true
      DATABASE_ADMIN_USER: admin
      DATABASE_ADMIN_PASSWORD: admin
      RUNDECK_STORAGE_PROVIDER: db
      #RUNDECK_PROJECT_STORAGE_TYPE: db

  database:
    image: postgres:10.3
    ports: 
      - '5432:5432'
    environment:
      POSTGRES_USER: 'admin'
      POSTGRES_PASSWORD: 'admin'
      POSTGRES_DB: 'rundeckdb'```

This is my docker compose file. Can you please help ?
jjethwa commented 6 years ago

Hi @evolv34

The postgres driver is included in the default Rundeck install. I have not tested the container with a postgres backend though and the /opt/run script does not handle postgres yet 😢 You would need to follow the directions for creating the database and user: http://rundeck.org/docs/administration/setting-up-an-rdb-datasource.html#postgresql-setup-guide and also set dataSource.driverClassName in the rundeck-config.properties file

It should not take too much work to add postgres handling in /opt/run but I'll be away for the next two weeks or so.

evolv34 commented 6 years ago

Thanks jjethwa, I will try it out.

jjethwa commented 6 years ago

NP! I'll work on the updates when I get back or feel free to submit a PR if you have time 😄

evolv34 commented 6 years ago

Sure

evolv34 commented 6 years ago

Hi @jjethwa,

I have created a pull request for this issue. Currently it supports external postgres. https://github.com/jjethwa/rundeck/pull/126

jjethwa commented 6 years ago

Hi @evolv34

I'm away from my laptop until the end of the month, but will test and merge as soon as I'm back :smile:

evolv34 commented 6 years ago
version: '2.1'

services: 
  rundeck:
      image: <rundeck image name>
      hostname: rundeck
      healthcheck:
        test: ["CMD", "curl", "-f", "http://localhost:4440/menu/home"]
        interval: 50s
        timeout: 30s
        retries: 3
      depends_on:
        postgres:
          condition: service_healthy
      links:
        - postgres:postgres
      ports:
        - "4441:4440"
      environment:
        EXTERNAL_SERVER_URL: http://localhost:4440
        SKIP_DATABASE_SETUP: "false"
        NO_LOCAL_MYSQL: "true"
        DATABASE_DRIVER: org.postgresql.Driver
        DATABASE_URL: jdbc:postgresql://postgres/rundeckdb
        DATABASE_ADMIN_USER: admin
        RUNDECK_PASSWORD: admin
        RUNDECK_STORAGE_PROVIDER: db

  postgres:
    image: postgres
    hostname: postgres
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 30s
      timeout: 30s
      retries: 3
    ports:
      - '5433:5432'
    # volumes:
    #   - ./test-data/:/var/lib/postgresql/data
    environment:
      POSTGRES_USER: 'admin'
      POSTGRES_PASSWORD: 'admin'
      POSTGRES_DB: 'postgres'

I used this yml file for testing. Hope its helpful

jjethwa commented 6 years ago

Thanks @evolv34

I'm back! Please give me a few days to test. Really appreciate all of your work on this 👍

jjethwa commented 6 years ago

Merged https://github.com/jjethwa/rundeck/pull/126 for testing against the latest tag 😄

jjethwa commented 6 years ago

Hi @evolv34

Just checking if we can close this 😄