Failed to install Discourse in Ubuntu14.04: docker problems

docker

(cosy) #1

Tried to install Discourses through Docker with this article http://www.howtoinstalldiscourse.com/how-to-install-discourse-on-ubuntu/:
Have an error on Launch Discourse step (./launcher bootstrap app , ./launcher start app)

Please help!

OS: Ubuntu Studio 14.04
docker --version: Docker version 1.2.0, build fa7b24f

  cosy@cosy-HP-EliteBook-8540w:/var/docker$ ./launcher bootstrap app
    2014/09/24 15:50:59 Get http:///var/run/docker.sock/v1.14/info: dial unix /var/run/docker.sock: permission denied
    Cannot connect to the docker daemon - verify it is running and you have access
    cosy@cosy-HP-EliteBook-8540w:/var/docker$ sudo ./launcher bootstrap app
    WARNING: No swap limit support
    Calculated ENV: -e LANG=en_US.UTF-8 -e RAILS_ENV=production -e UNICORN_WORKERS=3 -e UNICORN_SIDEKIQS=1 -e RUBY_GC_MALLOC_LIMIT=40000000 -e RUBY_HEAP_MIN_SLOTS=800000 -e DISCOURSE_DB_SOCKET=/var/run/postgresql -e DISCOURSE_DB_HOST= -e DISCOURSE_DB_PORT= -e HOME=/root -e DISCOURSE_DEVELOPER_EMAILS=me@example.com -e DISCOURSE_HOSTNAME=discourse.example.com -e DISCOURSE_SMTP_ADDRESS=smtp.example.com
    cd /pups && git pull && /pups/bin/pups --stdin
    From https://github.com/SamSaffron/pups
       f7a125b..ac9bdf8  master     -> origin/master
    Updating f7a125b..ac9bdf8
    Fast-forward
     README.md          |  2 +-
     lib/pups/config.rb | 14 +++++++++++++-
     2 files changed, 14 insertions(+), 2 deletions(-)
    I, [2014-09-24T12:51:14.130187 #43]  INFO -- : Loading --stdin
    I, [2014-09-24T12:51:14.134607 #43]  INFO -- : > mkdir -p /shared/postgres_run
    I, [2014-09-24T12:51:14.139001 #43]  INFO -- : 
    I, [2014-09-24T12:51:14.139448 #43]  INFO -- : > chown postgres:postgres /shared/postgres_run
    I, [2014-09-24T12:51:14.143742 #43]  INFO -- : 
    I, [2014-09-24T12:51:14.144293 #43]  INFO -- : > chmod 775 /shared/postgres_run
    I, [2014-09-24T12:51:14.148718 #43]  INFO -- : 
    I, [2014-09-24T12:51:14.149481 #43]  INFO -- : > rm -fr /var/run/postgresql
    I, [2014-09-24T12:51:14.154116 #43]  INFO -- : 
    I, [2014-09-24T12:51:14.154822 #43]  INFO -- : > ln -s /shared/postgres_run /var/run/postgresql
    I, [2014-09-24T12:51:14.159223 #43]  INFO -- : 
    I, [2014-09-24T12:51:14.160482 #43]  INFO -- : > socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
    2014/09/24 12:51:14 **socat[51] E connect(4, AF=1 "/shared/postgres_run/.s.PGSQL.5432", 36): No such file or directory**
    I, [2014-09-24T12:51:14.176709 #43]  INFO -- : 
    I, [2014-09-24T12:51:14.177194 #43]  INFO -- : > rm -fr /shared/postgres_run/.s*
    I, [2014-09-24T12:51:14.182002 #43]  INFO -- : 
    I, [2014-09-24T12:51:14.182793 #43]  INFO -- : > rm -fr /shared/postgres_run/*.pid
    I, [2014-09-24T12:51:14.186791 #43]  INFO -- : 
    I, [2014-09-24T12:51:14.195268 #43]  INFO -- : File > /etc/service/postgres/run  chmod: +x
    I, [2014-09-24T12:51:14.203983 #43]  INFO -- : File > /root/upgrade_postgres  chmod: +x
    I, [2014-09-24T12:51:14.205687 #43]  INFO -- : > chown -R root /var/lib/postgresql/9.3/main
    I, [2014-09-24T12:51:14.674964 #43]  INFO -- : 
    I, [2014-09-24T12:51:14.675210 #43]  INFO -- : > [ ! -e /shared/postgres_data ] && install -d -m 0755 -o postgres -g postgres /shared/postgres_data && sudo -E -u postgres /usr/lib/postgresql/9.3/bin/initdb -D /shared/postgres_data || exit 0
    I, [2014-09-24T12:51:14.678337 #43]  INFO -- : 
    I, [2014-09-24T12:51:14.678486 #43]  INFO -- : > chown -R postgres:postgres /shared/postgres_data
    I, [2014-09-24T12:51:14.683034 #43]  INFO -- : 
    I, [2014-09-24T12:51:14.683239 #43]  INFO -- : > chown -R postgres:postgres /var/run/postgresql
    I, [2014-09-24T12:51:14.687146 #43]  INFO -- : 
    I, [2014-09-24T12:51:14.688147 #43]  **INFO -- : > /root/upgrade_postgres
    cat: /shared/postgres_data/PG_VERSION: No such file or directory
    /root/upgrade_postgres: line 2: [: 9.2: unary operator expected**
    I, [2014-09-24T12:51:14.698314 #43]  INFO -- : 
    I, [2014-09-24T12:51:14.698705 #43]  INFO -- : > rm /root/upgrade_postgres
    I, [2014-09-24T12:51:14.701577 #43]  INFO -- : 
    I, [2014-09-24T12:51:14.703295 #43]  INFO -- : Replacing data_directory = '/var/lib/postgresql/9.3/main' with data_directory = '/shared/postgres_data' in /etc/postgresql/9.3/main/postgresql.conf
    I, [2014-09-24T12:51:14.704076 #43]  INFO -- : Replacing (?-mix:#?listen_addresses *=.*) with listen_addresses = '*' in /etc/postgresql/9.3/main/postgresql.conf
    I, [2014-09-24T12:51:14.704511 #43]  INFO -- : Replacing (?-mix:#?listen_addresses *=.*) with listen_addresses = '*' in /etc/postgresql/9.3/main/postgresql.conf
    I, [2014-09-24T12:51:14.704993 #43]  INFO -- : Replacing (?-mix:#?synchronous_commit *=.*) with synchronous_commit = $db_synchronous_commit in /etc/postgresql/9.3/main/postgresql.conf
    I, [2014-09-24T12:51:14.705517 #43]  INFO -- : Replacing (?-mix:#?shared_buffers *=.*) with shared_buffers = $db_shared_buffers in /etc/postgresql/9.3/main/postgresql.conf
    I, [2014-09-24T12:51:14.706063 #43]  INFO -- : Replacing (?-mix:#?work_mem *=.*) with work_mem = $db_work_mem in /etc/postgresql/9.3/main/postgresql.conf
    I, [2014-09-24T12:51:14.706683 #43]  INFO -- : Replacing (?-mix:#?default_text_search_config *=.*) with default_text_search_config = '$db_default_text_search_config' in /etc/postgresql/9.3/main/postgresql.conf
    I, [2014-09-24T12:51:14.707527 #43]  INFO -- : > install -d -m 0755 -o postgres -g postgres /shared/postgres_backup
    I, [2014-09-24T12:51:14.712618 #43]  INFO -- : 
    I, [2014-09-24T12:51:14.712992 #43]  INFO -- : Replacing (?-mix:#?max_wal_senders *=.*) with max_wal_senders = 4 in /etc/postgresql/9.3/main/postgresql.conf
    I, [2014-09-24T12:51:14.713641 #43]  INFO -- : Replacing (?-mix:#?wal_level *=.*) with wal_level = hot_standby in /etc/postgresql/9.3/main/postgresql.conf
    I, [2014-09-24T12:51:14.714491 #43]  INFO -- : Replacing (?-mix:^#local +replication +postgres +peer$) with local replication postgres  peer in /etc/postgresql/9.3/main/pg_hba.conf
    I, [2014-09-24T12:51:14.715105 #43]  INFO -- : Replacing (?-mix:^host.*all.*all.*127.*$) with host all all 0.0.0.0/0 md5 in /etc/postgresql/9.3/main/pg_hba.conf
    I, [2014-09-24T12:51:14.715668 #43]  INFO -- : > su - postgres -c '/usr/lib/postgresql/9.3/bin/postmaster -D /etc/postgresql/9.3/main'
    I, [2014-09-24T12:51:14.717909 #43]  INFO -- : > sleep 5
    2014-09-24 12:51:14 UTC FATAL:  "/shared/postgres_data" is not a valid data directory
    2014-09-24 12:51:14 UTC DETAIL:  File "/shared/postgres_data/PG_VERSION" is missing.
    I, [2014-09-24T12:51:19.721574 #43]  INFO -- : 
    I, [2014-09-24T12:51:19.722366 #43]  INFO -- : > **su postgres -c 'createdb discourse' || true
    createdb: could not connect to database template1: could not connect to server: No such file or directory
    	Is the server running locally and accepting
    	connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?**
    I, [2014-09-24T12:51:19.808929 #43]  INFO -- : 
    I, [2014-09-24T12:51:19.809564 #43]  INFO -- : > **su postgres -c 'psql discourse -c "create user discourse;"' || true
    psql: could not connect to server: No such file or directory
    	Is the server running locally and accepting
    	connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?**
    I, [2014-09-24T12:51:19.894773 #43]  INFO -- : 
    I, [2014-09-24T12:51:19.895610 #43]  INFO -- : > **su postgres -c 'psql discourse -c "grant all privileges on database discourse to discourse;"' || true
    psql: could not connect to server: No such file or directory
    	Is the server running locally and accepting
    	connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?**
    I, [2014-09-24T12:51:19.963502 #43]  INFO -- : 
    I, [2014-09-24T12:51:19.974952 #43]  INFO -- : > su postgres -c 'psql discourse -c "alter schema public owner to discourse;"'
    psql: could not connect to server: No such file or directory
    	Is the server running locally and accepting
    	connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
    I, [2014-09-24T12:51:20.045469 #43]  INFO -- : 
    
    
    FAILED
    --------------------
    RuntimeError: su postgres -c 'psql discourse -c "alter schema public owner to discourse;"' failed with return #<Process::Status: pid 96 exit 2>
    Location of failure: /pups/lib/pups/exec_command.rb:85:in `spawn'
    exec failed with the params "su postgres -c 'psql discourse -c \"alter schema public owner to discourse;\"'"
    b0ce6def79bdcdb9bf418f54fb8f2c77ada62b7cc6d2ca99688ae83c7cf992a4
    FAILED TO BOOTSTRAP

(Jens Maier) #2

Please post the contents of your app.yml file (but don’t forget to remove / censor any private information, e.g. the username and password for your mail service).


(Jeff Atwood) #3

I would not follow that document… follow our official install guide.

discourse/INSTALL-digital-ocean.md at master · discourse/discourse · GitHub

Or the one on Digital Ocean


(Sam Saffron) #4

Its meant to be /var/discourse the base templates all expect that.


(cosy) #5

Guys, thanks for answers.

  1. I switched to official installation doc on digitalocean.com

  2. It’s really meant to be /var/discourse directory, and I cd it now

  3. I filled app.yml to this condition:

    After making changes to this file, you MUST rebuild for any changes

    to take effect in your live Discourse instance:

    /var/discourse/launcher rebuild app

    this is the all-in-one, standalone Discourse Docker container template

    You may add rate limiting by uncommenting the web.ratelimited template.

    Out of the box it allows 12 reqs a second per ip, and 100 per minute per ip

    This is configurable by amending the params in this file

    templates:

    • “templates/postgres.template.yml”
    • “templates/redis.template.yml”
    • “templates/web.template.yml”
    • “templates/sshd.template.yml”
      #- “templates/web.ratelimited.template.yml”

    which TCP/IP ports should this container expose?

    expose:

    • “80:80” # fwd host port 80 to container port 80 (http)
    • “2222:22” # fwd host port 2222 to container port 22 (ssh)
      params:
      db_default_text_search_config: “pg_catalog.english”

    Set db_shared_buffers to 1/3 of the memory you wish to allocate to postgres

    on 1GB install set to 128MB on a 4GB instance you may raise to 1GB

    #db_shared_buffers: “256MB”

    Which Git revision should this container use? (default: tests-passed)

    #version: tests-passed
    env:
    LANG: en_US.UTF-8

    TODO: How many concurrent web requests are supported?

    With 2GB we recommend 3-4 workers, with 1GB only 2

    #UNICORN_WORKERS: 3

    TODO: List of comma delimited emails that will be made admin and developer

    on initial signup example ‘user1@example.com,user2@example.com’

    DISCOURSE_DEVELOPER_EMAILS: ‘myname@gmail.com’

    TODO: The domain name this Discourse instance will respond to

    DISCOURSE_HOSTNAME: ‘localhost:3000’

    TODO: The mailserver this Discourse instance will use

    DISCOURSE_SMTP_ADDRESS: smtp.mandrillapp.com # (mandatory)
    DISCOURSE_SMTP_PORT: 587 # (optional)
    DISCOURSE_SMTP_USER_NAME: myname@gmail.com # (optional)
    DISCOURSE_SMTP_PASSWORD: password # (optional)

    The CDN address for this Discourse instance (configured to pull)

    #DISCOURSE_CDN_URL: //discourse-cdn.example.com

    These containers are stateless, all data is stored in /shared

    volumes:

    • volume:
      host: /var/discourse/shared/standalone
      guest: /shared
    • volume:
      host: /var/discourse/shared/standalone/log/var-log
      guest: /var/log

    The docker manager plugin allows you to one-click upgrade Discouse

    http://discourse.example.com/admin/docker

    hooks:
    after_code:
    - exec:
    cd: $home/plugins
    cmd:
    - mkdir -p plugins
    - git clone GitHub - discourse/docker_manager: plugin for use with discourse docker image

    Remember, this is YAML syntax - you can only have one block with a name

    run:

    • exec: echo “Beginning of custom commands”

    If you want to configure password login for root, uncomment and change:

    #- exec: apt-get -y install whois # for mkpasswd

    Use only one of the following lines:

    #- exec: /usr/sbin/usermod -p ‘PASSWORD_HASH’ root
    #- exec: /usr/sbin/usermod -p “$(mkpasswd -m sha-256 ‘RAW_PASSWORD’)” root

    If you want to authorized additional users, uncomment and change:

    #- exec: ssh-import-id username
    #- exec: ssh-import-id anotherusername

    • exec: echo “End of custom commands”
    • exec: awk -F# ‘{print $1;}’ ~/.ssh/authorized_keys | awk ‘BEGIN { print “Authorized SSH keys for this container:”; } NF>=2 {print $NF;}’
  4. launched bootrstrap comes with:

    cosy@cosy-HP-EliteBook-8540w:/var/discourse$ sudo ./launcher bootstrap appDevice “docker0” does not exist.
    2014/09/25 06:49:43 Get http:///var/run/docker.sock/v1.14/info: dial unix /var/run/docker.sock: no such file or directory
    Cannot connect to the docker daemon - verify it is running and you have access

  5. I runed a command to start docker but it freezed:

    cosy@cosy-HP-EliteBook-8540w:/var/discourse$ sudo docker -d
    [sudo] password for cosy:
    2014/09/25 15:30:20 docker daemon: 1.2.0 fa7b24f; execdriver: native; graphdriver:
    [4ae0f561] +job serveapi(unix:///var/run/docker.sock)
    [info] Listening for HTTP on unix (/var/run/docker.sock)
    [4ae0f561] +job init_networkdriver()
    [4ae0f561] -job init_networkdriver() = OK (0)
    2014/09/25 15:30:20 WARNING: Your kernel does not support cgroup swap limit.
    [info] Local (127.0.0.1) DNS resolver found in resolv.conf and containers can’t use it. Using default external servers : [8.8.8.8 8.8.4.4]
    [info] Loading containers:
    …[error] daemon.go:310 Failed to load container d818138bf00d6f2ac20afffff27bc98e4bf1f5fd0160ef7c29fba1c5334e6fb3: open /var/lib/docker/containers/d818138bf00d6f2ac20afffff27bc98e4bf1f5fd0160ef7c29fba1c5334e6fb3/config.json: no such file or directory
    …[info] : done.
    [4ae0f561] +job acceptconnections()
    [4ae0f561] -job acceptconnections() = OK (0)

  6. If I try to run “launcher bootstrap app” in another terminal window it failed with:

    cosy@cosy-HP-EliteBook-8540w:/var/discourse$ sudo ./launcher bootstrap app[sudo] password for cosy:
    WARNING: No swap limit support
    Calculated ENV: -e LANG=en_US.UTF-8 -e RAILS_ENV=production -e UNICORN_WORKERS=3 -e UNICORN_SIDEKIQS=1 -e RUBY_GC_MALLOC_LIMIT=40000000 -e RUBY_HEAP_MIN_SLOTS=800000 -e DISCOURSE_DB_SOCKET=/var/run/postgresql -e DISCOURSE_DB_HOST= -e DISCOURSE_DB_PORT= -e HOME=/root -e DISCOURSE_DEVELOPER_EMAILS=myname@gmail.com -e DISCOURSE_HOSTNAME=localhost:3000 -e DISCOURSE_SMTP_ADDRESS=smtp.mandrillapp.com -e DISCOURSE_SMTP_PORT=587 -e DISCOURSE_SMTP_USER_NAME=myname@gmail.com -e DISCOURSE_SMTP_PASSWORD=zilRhJw0tC5bcadBlB3q-Q
    cd /pups && git pull && /pups/bin/pups --stdin
    From GitHub - discourse/pups: Simple yaml based bootstrapper for Linux machines
    f7a125b…ac9bdf8 master -> origin/master
    Updating f7a125b…ac9bdf8
    Fast-forward
    README.md | 2 ±
    lib/pups/config.rb | 14 ++++++++++++±
    2 files changed, 14 insertions(+), 2 deletions(-)
    I, [2014-09-25T12:32:13.691595 #43] INFO – : Loading --stdin
    I, [2014-09-25T12:32:13.696282 #43] INFO – : > mkdir -p /shared/postgres_run
    I, [2014-09-25T12:32:13.700172 #43] INFO – :
    I, [2014-09-25T12:32:13.700923 #43] INFO – : > chown postgres:postgres /shared/postgres_run
    I, [2014-09-25T12:32:13.706333 #43] INFO – :
    I, [2014-09-25T12:32:13.707180 #43] INFO – : > chmod 775 /shared/postgres_run
    I, [2014-09-25T12:32:13.711431 #43] INFO – :
    I, [2014-09-25T12:32:13.712440 #43] INFO – : > rm -fr /var/run/postgresql
    I, [2014-09-25T12:32:13.715794 #43] INFO – :
    I, [2014-09-25T12:32:13.716403 #43] INFO – : > ln -s /shared/postgres_run /var/run/postgresql
    I, [2014-09-25T12:32:13.720984 #43] INFO – :
    I, [2014-09-25T12:32:13.722117 #43] INFO – : > socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
    2014/09/25 12:32:13 socat[51] E connect(4, AF=1 “/shared/postgres_run/.s.PGSQL.5432”, 36): No such file or directory
    I, [2014-09-25T12:32:13.737865 #43] INFO – :
    I, [2014-09-25T12:32:13.738693 #43] INFO – : > rm -fr /shared/postgres_run/.s*
    I, [2014-09-25T12:32:13.744217 #43] INFO – :
    I, [2014-09-25T12:32:13.745168 #43] INFO – : > rm -fr /shared/postgres_run/.pid
    I, [2014-09-25T12:32:13.749782 #43] INFO – :
    I, [2014-09-25T12:32:13.760206 #43] INFO – : File > /etc/service/postgres/run chmod: +x
    I, [2014-09-25T12:32:13.768664 #43] INFO – : File > /root/upgrade_postgres chmod: +x
    I, [2014-09-25T12:32:13.770164 #43] INFO – : > chown -R root /var/lib/postgresql/9.3/main
    I, [2014-09-25T12:32:14.228557 #43] INFO – :
    I, [2014-09-25T12:32:14.228805 #43] INFO – : > [ ! -e /shared/postgres_data ] && install -d -m 0755 -o postgres -g postgres /shared/postgres_data && sudo -E -u postgres /usr/lib/postgresql/9.3/bin/initdb -D /shared/postgres_data || exit 0
    I, [2014-09-25T12:32:14.232588 #43] INFO – :
    I, [2014-09-25T12:32:14.232768 #43] INFO – : > chown -R postgres:postgres /shared/postgres_data
    I, [2014-09-25T12:32:14.237115 #43] INFO – :
    I, [2014-09-25T12:32:14.237290 #43] INFO – : > chown -R postgres:postgres /var/run/postgresql
    I, [2014-09-25T12:32:14.241649 #43] INFO – :
    I, [2014-09-25T12:32:14.242769 #43] INFO – : > /root/upgrade_postgres
    cat: /shared/postgres_data/PG_VERSION: No such file or directory
    /root/upgrade_postgres: line 2: [: 9.2: unary operator expected
    I, [2014-09-25T12:32:14.253042 #43] INFO – :
    I, [2014-09-25T12:32:14.253653 #43] INFO – : > rm /root/upgrade_postgres
    I, [2014-09-25T12:32:14.256378 #43] INFO – :
    I, [2014-09-25T12:32:14.257398 #43] INFO – : Replacing data_directory = ‘/var/lib/postgresql/9.3/main’ with data_directory = ‘/shared/postgres_data’ in /etc/postgresql/9.3/main/postgresql.conf
    I, [2014-09-25T12:32:14.258434 #43] INFO – : Replacing (?-mix:#?listen_addresses =.) with listen_addresses = '
    ’ in /etc/postgresql/9.3/main/postgresql.conf
    I, [2014-09-25T12:32:14.259097 #43] INFO – : Replacing (?-mix:#?listen_addresses =.) with listen_addresses = ‘*’ in /etc/postgresql/9.3/main/postgresql.conf
    I, [2014-09-25T12:32:14.259781 #43] INFO – : Replacing (?-mix:#?synchronous_commit =.) with synchronous_commit = $db_synchronous_commit in /etc/postgresql/9.3/main/postgresql.conf
    I, [2014-09-25T12:32:14.260531 #43] INFO – : Replacing (?-mix:#?shared_buffers =.) with shared_buffers = $db_shared_buffers in /etc/postgresql/9.3/main/postgresql.conf
    I, [2014-09-25T12:32:14.261198 #43] INFO – : Replacing (?-mix:#?work_mem =.) with work_mem = $db_work_mem in /etc/postgresql/9.3/main/postgresql.conf
    I, [2014-09-25T12:32:14.261894 #43] INFO – : Replacing (?-mix:#?default_text_search_config =.) with default_text_search_config = ‘$db_default_text_search_config’ in /etc/postgresql/9.3/main/postgresql.conf
    I, [2014-09-25T12:32:14.262871 #43] INFO – : > install -d -m 0755 -o postgres -g postgres /shared/postgres_backup
    I, [2014-09-25T12:32:14.268934 #43] INFO – :
    I, [2014-09-25T12:32:14.269267 #43] INFO – : Replacing (?-mix:#?max_wal_senders =.) with max_wal_senders = 4 in /etc/postgresql/9.3/main/postgresql.conf
    I, [2014-09-25T12:32:14.270069 #43] INFO – : Replacing (?-mix:#?wal_level =.) with wal_level = hot_standby in /etc/postgresql/9.3/main/postgresql.conf
    I, [2014-09-25T12:32:14.270963 #43] INFO – : Replacing (?-mix:^#local +replication +postgres +peer$) with local replication postgres peer in /etc/postgresql/9.3/main/pg_hba.conf
    I, [2014-09-25T12:32:14.271753 #43] INFO – : Replacing (?-mix:^host.*all.*all.127.$) with host all all 0.0.0.0/0 md5 in /etc/postgresql/9.3/main/pg_hba.conf
    I, [2014-09-25T12:32:14.272724 #43] INFO – : > su - postgres -c '/usr/lib/postgresql/9.3/bin/postmaster -D /etc/postgresql/9.3/main’
    I, [2014-09-25T12:32:14.276160 #43] INFO – : > sleep 5
    2014-09-25 12:32:14 UTC FATAL: “/shared/postgres_data” is not a valid data directory
    2014-09-25 12:32:14 UTC DETAIL: File “/shared/postgres_data/PG_VERSION” is missing.
    I, [2014-09-25T12:32:19.279286 #43] INFO – :
    I, [2014-09-25T12:32:19.280912 #43] INFO – : > su postgres -c ‘createdb discourse’ || true
    createdb: could not connect to database template1: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket “/var/run/postgresql/.s.PGSQL.5432”?
    I, [2014-09-25T12:32:19.371193 #43] INFO – :
    I, [2014-09-25T12:32:19.385136 #43] INFO – : > su postgres -c ‘psql discourse -c “create user discourse;”’ || true
    psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket “/var/run/postgresql/.s.PGSQL.5432”?
    I, [2014-09-25T12:32:19.452596 #43] INFO – :
    I, [2014-09-25T12:32:19.453804 #43] INFO – : > su postgres -c ‘psql discourse -c “grant all privileges on database discourse to discourse;”’ || true
    psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket “/var/run/postgresql/.s.PGSQL.5432”?
    I, [2014-09-25T12:32:19.523463 #43] INFO – :
    I, [2014-09-25T12:32:19.524692 #43] INFO – : > su postgres -c 'psql discourse -c “alter schema public owner to discourse;”'
    psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket “/var/run/postgresql/.s.PGSQL.5432”?
    I, [2014-09-25T12:32:19.594274 #43] INFO – :

    FAILED

    RuntimeError: su postgres -c ‘psql discourse -c “alter schema public owner to discourse;”’ failed with return #<Process::Status: pid 96 exit 2>
    Location of failure: /pups/lib/pups/exec_command.rb:85:in `spawn’
    exec failed with the params "su postgres -c ‘psql discourse -c “alter schema public owner to discourse;”’"
    8326856b3cc93a992f5f4cd040aa8ff55cb8723be2d45caf57322032941cfb46
    FAILED TO BOOTSTRAP

What I can do else?


(Sam Saffron) #6

What does docker info return?


(cosy) #7
2014/09/26 08:15:13 Get http:///var/run/docker.sock/v1.14/info: dial unix /var/run/docker.sock: no such file or directory

(Jeff Atwood) #8

Docker is not installing on your system, for some reason.

You are installing it via this, yes, as a privileged account?

wget -qO- https://get.docker.io/ | sh

Does that report any errors?


(axil) #9

Had the same problem and a restart of the docker service did it. Now I’m facing this Discourse Meta


(axil) #10

There is another command for 14.04 in docker’s site, does the same as yours but is simpler and more straighforward:

curl -sSL https://get.docker.io/ubuntu/ | sudo sh

(cosy) #11
  1. Installing with curl -sSL https://get.docker.io/ubuntu/ | sudo sh comes with lxc-docker is already the newest version.
  2. docker info says 2014/09/30 02:22:05 Get http:///var/run/docker.sock/v1.14/info: dial unix /var/run/docker.sock: no such file or directory

(Jeff Atwood) #12

I suggest removing docker, via apt-get remove lxc-docker, then trying again to install it.


(cosy) #13

I reinstalled docker.
Now docker info actually have some info:

cosy@cosy-HP-EliteBook-8540w:/var/discourse$ sudo docker info
Containers: 3
Images: 21
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Dirs: 28
Execution Driver: native-0.2
Kernel Version: 3.13.0-35-lowlatency
Operating System: Ubuntu 14.04.1 LTS
WARNING: No swap limit support

But the error on launcher bootstrap app still same as below.
Even after " sudo service docker restart".


(cosy) #15

@sam @codinghorror ? Any ideas, guys?

  1. I stopped with same error as in 1st topic message after “./launcher bootstrap app” and have no idea how to start discource.

Figured out that troubles due log starting with this lines:

INFO -- : > socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
2014/10/09 01:18:25 socat[54] E connect(4, AF=1 "/shared/postgres_run/.s.PGSQL.5432", 36): No such file or directory

INFO -- : > /root/upgrade_postgres
cat: /shared/postgres_data/PG_VERSION: No such file or directory
/root/upgrade_postgres: line 2: [: 9.2: unary operator expected

INFO -- : > su postgres -c 'createdb discourse' || true
createdb: could not connect to database template1: could not connect to server: No such file or directory
	Is the server running locally and accepting
	connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
I, [2014-10-09T01:18:30.996811 #46]  INFO -- : 
I, [2014-10-09T01:18:31.008665 #46]  INFO -- : > su postgres -c 'psql discourse -c "create user discourse;"' || true
psql: could not connect to server: No such file or directory
	Is the server running locally and accepting
	connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
I, [2014-10-09T01:18:31.072893 #46]  INFO -- : 
I, [2014-10-09T01:18:31.073980 #46]  INFO -- : > su postgres -c 'psql discourse -c "grant all privileges on database discourse to discourse;"' || true
psql: could not connect to server: No such file or directory
	Is the server running locally and accepting
	connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
I, [2014-10-09T01:18:31.138713 #46]  INFO -- : 
I, [2014-10-09T01:18:31.139386 #46]  INFO -- : > su postgres -c 'psql discourse -c "alter schema public owner to discourse;"'
psql: could not connect to server: No such file or directory
	Is the server running locally and accepting
	connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
I, [2014-10-09T01:18:31.200614 #46]  INFO -- : 
  1. Main hook now that “/shared/postgres_data” is not a valid data directory" and "postgres PG_VERSION is missing ". googling…

2.1) According this case: Postgresql 8.4 on Ubuntu - PG_VERSION is missing

sudo sysv-rc-conf postgresql on
service postgresql start

– without result.

2.2) As I figure out, PostgreSQL’s data directory missing. mac os x - How do I find PostgreSQL’s data directory? - Database Administrators Stack Exchange
On Debian/Ubuntu:

pg_lsclusters
Ver Cluster Port Status Owner    Data directory               Log file
9.3 main    5432 online postgres /var/lib/postgresql/9.3/main /var/log/postgresql/postgresql-9.3-main.log

But how I can use this info? Is there is any ways to link it with docker?

  1. Seems like I not alone with this.
    Guy in this topic had same error 2 days ago during update: “socat[51] E connect(4, AF=1 “/shared/postgres_run/.s.PGSQL.5432”, 36): No such file or directory”.

  2. launcher start app comes with:

    cosy@cosy-HP-EliteBook-8540w:/var/discourse$ sudo ./launcher start app
    WARNING: No swap limit support
    No cid found, creating a new container
    Calculated ENV: -e LANG=en_US.UTF-8 -e RAILS_ENV=production -e UNICORN_WORKERS=2 -e UNICORN_SIDEKIQS=1 -e RUBY_GC_MALLOC_LIMIT=40000000 -e RUBY_HEAP_MIN_SLOTS=800000 -e DISCOURSE_DB_SOCKET=/var/run/postgresql -e DISCOURSE_DB_HOST= -e DISCOURSE_DB_PORT= -e HOME=/root -e DISCOURSE_DEVELOPER_EMAILS=craft37@gmail.com -e DISCOURSE_HOSTNAME=localhost -e DISCOURSE_SMTP_ADDRESS=smtp.mandrillapp.com -e DISCOURSE_SMTP_PORT=587 -e DISCOURSE_SMTP_USER_NAME=mail@gmail.com -e DISCOURSE_SMTP_PASSWORD=pass-Q
    Unable to find image ‘local_discourse/app’ locally
    Pulling repository local_discourse/app
    2014/10/09 07:15:00 Error: image local_discourse/app not found


(Jeff Atwood) #17

If you failed to install on a new install, why does it matter if your db is corrupt? Blow everything away and start over from scratch, following the official install guide closely.


(cosy) #18

I started from scratch with removing docker as I reported earlier.

Will try it now on another distributive or virtual machine.


(Tom) #19

Hi there,

Let me know if I should start a separate topic for this, but:

Running into the exact same error while bootstrapping on a Debian GCE instance:

FAILED
--------------------
RuntimeError: su postgres -c 'psql discourse -c "alter schema public owner to discourse;"' failed with return #<Process::Status: pid 97 exit 2>
Location of failure: /pups/lib/pups/exec_command.rb:105:in `spawn'
exec failed with the params "su postgres -c 'psql discourse -c \"alter schema public owner to discourse;\"'"

Currently trying to bootstrap a separate data container for a multisite Discourse setup, so I can’t throw my database away, if it is corrupt. Although I don’t know if that’s the case because my first site works perfectly fine.

The first discourse site was set up with the instructions here: discourse/INSTALL-digital-ocean.md at master · discourse/discourse · GitHub although the Digital Ocean stuff was skipped in favour of GCE.

@craft37, did you make any progress with this issue?

@sam, is this actually a sign that the database is corrupt? The first discourse site is working fine and I’d prefer not to nuke the database and start over.


(Tom) #20

Also, I was following this post on how to set up multisite Discourse: Discourse Meta

So my data.yml file looks almost exactly the same as the one there, but here’s mine just in case (with SOME_SECRET subbed in for my password):

# A container for all things Data, be sure to set a secret password for
# discourse account, SOME_SECRET is just an example 
#

templates:
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/sshd.template.yml"

expose:
  - "5431:5431"
  - "6379:6379"
  - "2221:22"

params:
  db_default_text_search_config: "pg_catalog.english"
  ## Set db_shared_buffers to 1/3 of the memory you wish to allocate to postgres
  ## on 1GB install set to 128MB on a 4GB instance you may raise to 1GB
  #db_shared_buffers: "256MB" 

env:
  # ensure locale exists in container, you may need to install it
  LANG: en_US.UTF-8

volumes:
  - volume: 
        host: /var/discourse/shared/data
        guest: /shared 
  - volume: 
        host: /var/discourse/shared/data/log/var-log
        guest: /var/log

# TODO: SOME_SECRET to a password for the discourse user
hooks:
  after_postgres:
    - exec: 
        stdin: |
          alter user discourse with password 'SOME_SECRET';
        cmd: sudo - postgres -c 'psql discourse'

        raise_on_fail: false
#create second database 
hooks:
  after_postgres:
     - exec: sudo -u postgres createdb discourse_b || exit 0 # designate name of 2nd db
     - exec: 
          stdin: |
            grant all privileges on database discourse_b to discourse;
          cmd: sudo -u postgres psql discourse_b 
          raise_on_fail: false

     - exec: /bin/bash -c 'sudo -u postgres psql discourse_b <<< "alter schema public owner to discourse;"'

     - exec: /bin/bash -c 'sudo -u postgres psql discourse_b <<< "create extension if not exists hstore;"' 

     - exec: /bin/bash -c 'sudo -u postgres psql discourse_b <<< "create extension if not exists pg_trgm;"'

(Tom) #21

Hm, so based on this topic: Discourse Meta it looks like my problem might be the presence of the old database.

Is it not possible to add multisite-ness to Discourse once you’ve already set up a standalone Discourse?


(Sam Saffron) #22

It is possible, but when it comes to multisite you are dealing with a highly technical feature, you need to be comfortable spawning a container to snoop around and understand the templates real well.