Error while doing discourse setup

Hello,
I am doing this discourse setup for the first time and i am going through this issue. As I am having less knowledge about this please try to help me by giving its solution.

I entered this command ./discourse-setup through root and faced the below issue

FAILED
--------------------
Pups::ExecError: su postgres -c 'psql discourse -c "alter schema public owner to discourse;"' failed with return #<Process::Status: pid 109 exit 2>
Location of failure: /pups/lib/pups/exec_command.rb:108:in `spawn'
exec failed with the params "su postgres -c 'psql $db_name -c \"alter schema public owner to $db_user;\"'"
e21a161606cfc570d4acda8edeec8c7ced8b48c63a94b9d670eef19cfdd7e179
** FAILED TO BOOTSTRAP **

Scroll up, that is not the official error, there should be another one.

1 Like
WARNING: We are about to start downloading the Discourse base image
This process may take anywhere between a few minutes to an hour, depending on your network speed

Please be patient

Unable to find image 'discourse/base:2.0.20170728' locally
2.0.20170728: Pulling from discourse/base
62ede6aff2e8: Pulling fs layer
fc19d60a83f1: Pulling fs layer
de413bb911fd: Pulling fs layer
2879a7ad3144: Pulling fs layer
668604fde02e: Pulling fs layer
75ea1d577cf2: Pulling fs layer
2879a7ad3144: Waiting
668604fde02e: Waiting
75ea1d577cf2: Waiting
de413bb911fd: Verifying Checksum
de413bb911fd: Download complete
fc19d60a83f1: Verifying Checksum
fc19d60a83f1: Download complete
2879a7ad3144: Verifying Checksum
2879a7ad3144: Download complete
668604fde02e: Verifying Checksum
668604fde02e: Download complete
62ede6aff2e8: Verifying Checksum
62ede6aff2e8: Download complete
62ede6aff2e8: Pull complete
fc19d60a83f1: Pull complete
de413bb911fd: Pull complete
2879a7ad3144: Pull complete
668604fde02e: Pull complete
75ea1d577cf2: Verifying Checksum
75ea1d577cf2: Download complete
75ea1d577cf2: Pull complete
Digest: sha256:24da785f6176a417ac2d282f33340ab7017c26627647c341e4de82e7a86ab464
Status: Downloaded newer image for discourse/base:2.0.20170728
Ensuring launcher is up to date
Fetching origin
Launcher is up-to-date
cd /pups && git pull && /pups/bin/pups --stdin
Already up-to-date.
I, [2017-10-05T09:26:42.866756 #13]  INFO -- : Loading --stdin
I, [2017-10-05T09:26:42.872073 #13]  INFO -- : > mkdir -p /shared/postgres_run
I, [2017-10-05T09:26:42.876789 #13]  INFO -- : 
I, [2017-10-05T09:26:42.876984 #13]  INFO -- : > chown postgres:postgres /shared/postgres_run
I, [2017-10-05T09:26:42.880460 #13]  INFO -- : 
I, [2017-10-05T09:26:42.880728 #13]  INFO -- : > chmod 775 /shared/postgres_run
I, [2017-10-05T09:26:42.882907 #13]  INFO -- : 
I, [2017-10-05T09:26:42.883067 #13]  INFO -- : > rm -fr /var/run/postgresql
I, [2017-10-05T09:26:42.885052 #13]  INFO -- : 
I, [2017-10-05T09:26:42.885174 #13]  INFO -- : > ln -s /shared/postgres_run /var/run/postgresql
I, [2017-10-05T09:26:42.887068 #13]  INFO -- : 
I, [2017-10-05T09:26:42.887217 #13]  INFO -- : > socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
2017/10/05 09:26:42 socat[21] E connect(6, AF=1 "/shared/postgres_run/.s.PGSQL.5432", 36): No such file or directory
I, [2017-10-05T09:26:42.898818 #13]  INFO -- : 
I, [2017-10-05T09:26:42.898976 #13]  INFO -- : > rm -fr /shared/postgres_run/.s*
I, [2017-10-05T09:26:42.900630 #13]  INFO -- : 
I, [2017-10-05T09:26:42.900769 #13]  INFO -- : > rm -fr /shared/postgres_run/*.pid
I, [2017-10-05T09:26:42.902373 #13]  INFO -- : 
I, [2017-10-05T09:26:42.902559 #13]  INFO -- : > mkdir -p /shared/postgres_run/9.5-main.pg_stat_tmp
I, [2017-10-05T09:26:42.907795 #13]  INFO -- : 
I, [2017-10-05T09:26:42.908117 #13]  INFO -- : > chown postgres:postgres /shared/postgres_run/9.5-main.pg_stat_tmp
I, [2017-10-05T09:26:42.909640 #13]  INFO -- : 
I, [2017-10-05T09:26:42.912543 #13]  INFO -- : File > /etc/service/postgres/run  chmod: +x
I, [2017-10-05T09:26:42.915269 #13]  INFO -- : File > /etc/runit/3.d/99-postgres  chmod: +x
I, [2017-10-05T09:26:42.918250 #13]  INFO -- : File > /root/upgrade_postgres  chmod: +x
I, [2017-10-05T09:26:42.918447 #13]  INFO -- : > chown -R root /var/lib/postgresql/9.5/main
I, [2017-10-05T09:26:45.009560 #13]  INFO -- : 
I, [2017-10-05T09:26:45.009831 #13]  INFO -- : > [ ! -e /shared/postgres_data ] && install -d -m 0755 -o postgres -g postgres /shared/postgres_data && sudo -E -u postgres /usr/lib/postgresql/9.5/bin/initdb -D /shared/postgres_data || exit 0

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
I, [2017-10-05T09:26:46.935213 #13]  INFO -- : The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /shared/postgres_data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
creating template1 database in /shared/postgres_data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
syncing data to disk ... ok

Success. You can now start the database server using:

    /usr/lib/postgresql/9.5/bin/pg_ctl -D /shared/postgres_data -l logfile start


I, [2017-10-05T09:26:46.935331 #13]  INFO -- : > chown -R postgres:postgres /shared/postgres_data
I, [2017-10-05T09:26:46.939985 #13]  INFO -- : 
I, [2017-10-05T09:26:46.940157 #13]  INFO -- : > chown -R postgres:postgres /var/run/postgresql
I, [2017-10-05T09:26:46.941654 #13]  INFO -- : 
I, [2017-10-05T09:26:46.941851 #13]  INFO -- : > /root/upgrade_postgres
I, [2017-10-05T09:26:46.950973 #13]  INFO -- : 
I, [2017-10-05T09:26:46.951133 #13]  INFO -- : > rm /root/upgrade_postgres
I, [2017-10-05T09:26:46.952657 #13]  INFO -- : 
I, [2017-10-05T09:26:46.953277 #13]  INFO -- : Replacing data_directory = '/var/lib/postgresql/9.5/main' with data_directory = '/shared/postgres_data' in /etc/postgresql/9.5/main/postgresql.conf
I, [2017-10-05T09:26:46.953851 #13]  INFO -- : Replacing (?-mix:#?listen_addresses *=.*) with listen_addresses = '*' in /etc/postgresql/9.5/main/postgresql.conf
I, [2017-10-05T09:26:46.954657 #13]  INFO -- : Replacing (?-mix:#?synchronous_commit *=.*) with synchronous_commit = $db_synchronous_commit in /etc/postgresql/9.5/main/postgresql.conf
I, [2017-10-05T09:26:46.955456 #13]  INFO -- : Replacing (?-mix:#?shared_buffers *=.*) with shared_buffers = $db_shared_buffers in /etc/postgresql/9.5/main/postgresql.conf
I, [2017-10-05T09:26:46.956420 #13]  INFO -- : Replacing (?-mix:#?work_mem *=.*) with work_mem = $db_work_mem in /etc/postgresql/9.5/main/postgresql.conf
I, [2017-10-05T09:26:46.957225 #13]  INFO -- : Replacing (?-mix:#?default_text_search_config *=.*) with default_text_search_config = '$db_default_text_search_config' in /etc/postgresql/9.5/main/postgresql.conf
I, [2017-10-05T09:26:46.958000 #13]  INFO -- : > install -d -m 0755 -o postgres -g postgres /shared/postgres_backup
I, [2017-10-05T09:26:46.959778 #13]  INFO -- : 
I, [2017-10-05T09:26:46.960030 #13]  INFO -- : Replacing (?-mix:#?max_wal_senders *=.*) with max_wal_senders = $db_max_wal_senders in /etc/postgresql/9.5/main/postgresql.conf
I, [2017-10-05T09:26:46.960329 #13]  INFO -- : Replacing (?-mix:#?wal_level *=.*) with wal_level = $db_wal_level in /etc/postgresql/9.5/main/postgresql.conf
I, [2017-10-05T09:26:46.961144 #13]  INFO -- : Replacing (?-mix:#?checkpoint_segments *=.*) with checkpoint_segments = $db_checkpoint_segments in /etc/postgresql/9.5/main/postgresql.conf
I, [2017-10-05T09:26:46.961929 #13]  INFO -- : Replacing (?-mix:#?logging_collector *=.*) with logging_collector = $db_logging_collector in /etc/postgresql/9.5/main/postgresql.conf
I, [2017-10-05T09:26:46.962736 #13]  INFO -- : Replacing (?-mix:#?log_min_duration_statement *=.*) with log_min_duration_statement = $db_log_min_duration_statement in /etc/postgresql/9.5/main/postgresql.conf
I, [2017-10-05T09:26:46.963831 #13]  INFO -- : Replacing (?-mix:^#local +replication +postgres +peer$) with local replication postgres  peer in /etc/postgresql/9.5/main/pg_hba.conf
I, [2017-10-05T09:26:46.964150 #13]  INFO -- : Replacing (?-mix:^host.*all.*all.*127.*$) with host all all 0.0.0.0/0 md5 in /etc/postgresql/9.5/main/pg_hba.conf
I, [2017-10-05T09:26:46.964776 #13]  INFO -- : > HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/9.5/bin/postmaster -D /etc/postgresql/9.5/main
I, [2017-10-05T09:26:46.965741 #13]  INFO -- : > sleep 5
2017-10-05 09:26:46.985 UTC [83] FATAL:  could not map anonymous shared memory: Cannot allocate memory
2017-10-05 09:26:46.985 UTC [83] HINT:  This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory, swap space, or huge pages. To reduce the request size (currently 1124007936 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections.
I, [2017-10-05T09:26:51.967715 #13]  INFO -- : 
I, [2017-10-05T09:26:51.967931 #13]  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, [2017-10-05T09:26:52.044633 #13]  INFO -- : 
I, [2017-10-05T09:26:52.044861 #13]  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, [2017-10-05T09:26:52.096126 #13]  INFO -- : 
I, [2017-10-05T09:26:52.096337 #13]  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, [2017-10-05T09:26:52.140997 #13]  INFO -- : 
I, [2017-10-05T09:26:52.141265 #13]  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, [2017-10-05T09:26:52.185829 #13]  INFO -- : 
I, [2017-10-05T09:26:52.186130 #13]  INFO -- : Terminating async processes


FAILED
--------------------
Pups::ExecError: su postgres -c 'psql discourse -c "alter schema public owner to discourse;"' failed with return #<Process::Status: pid 109 exit 2>
Location of failure: /pups/lib/pups/exec_command.rb:108:in `spawn'
exec failed with the params "su postgres -c 'psql $db_name -c \"alter schema public owner to $db_user;\"'"
e21a161606cfc570d4acda8edeec8c7ced8b48c63a94b9d670eef19cfdd7e179
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one

Sorry for above post,you can check it here @cpradio…Please help

@cpradio Also when i used command “docker ps” it is not showing anything .I think i am doing something wrong

This seems to be the culprit

2017-10-05 09:26:46.985 UTC [83] FATAL:  could not map anonymous shared memory: Cannot allocate memory
2017-10-05 09:26:46.985 UTC [83] HINT:  This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory, swap space, or huge pages. To reduce the request size (currently 1124007936 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections.

How much Memory is setup on this server? It seems to be wanting to reserve 1 GB of Memory.

I have checked the memory size and its still 2 GB free11.

Please correct me i am wrong and also advice me what to do further procedure

What is the output of

free -h

Thanks for ur kind reply.I have managed to increase the space.

After managing the space,now I have got one more issue while doing the setup.


I, [2017-10-05T14:11:33.664945 #14]  INFO -- : Purging temp files
Bundling assets
Compressing Javascript and Generating Source Maps

I, [2017-10-05T14:11:33.688472 #14]  INFO -- : File > /usr/local/bin/discourse  chmod: +x
I, [2017-10-05T14:11:33.694103 #14]  INFO -- : File > /usr/local/bin/rails  chmod: +x
I, [2017-10-05T14:11:33.700635 #14]  INFO -- : File > /usr/local/bin/rake  chmod: +x
I, [2017-10-05T14:11:33.707102 #14]  INFO -- : File > /etc/update-motd.d/10-web  chmod: +x
I, [2017-10-05T14:11:33.713173 #14]  INFO -- : File > /etc/logrotate.d/rails  chmod: 
I, [2017-10-05T14:11:33.715259 #14]  INFO -- : File > /etc/logrotate.d/nginx  chmod: 
I, [2017-10-05T14:11:33.723073 #14]  INFO -- : File > /etc/runit/1.d/00-ensure-links  chmod: +x
I, [2017-10-05T14:11:33.732440 #14]  INFO -- : File > /root/.bash_profile  chmod: 644
I, [2017-10-05T14:11:33.739029 #14]  INFO -- : Replacing (?-mix:server.+{) with limit_req_zone $binary_remote_addr zone=flood:10m rate=$reqs_per_secondr/s;
limit_req_zone $binary_remote_addr zone=bot:10m rate=$reqs_per_minuter/m;
limit_req_status 429;
limit_conn_zone $binary_remote_addr zone=connperip:10m;
limit_conn_status 429;
server {
 in /etc/nginx/conf.d/discourse.conf
I, [2017-10-05T14:11:33.740120 #14]  INFO -- : Replacing (?-mix:location @discourse {) with location @discourse {
  limit_conn connperip $conn_per_ip;
  limit_req zone=flood burst=$burst_per_second nodelay;
  limit_req zone=bot burst=$burst_per_minute nodelay; in /etc/nginx/conf.d/discourse.conf
I, [2017-10-05T14:11:33.741240 #14]  INFO -- : > echo "Beginning of custom commands"
I, [2017-10-05T14:11:33.743008 #14]  INFO -- : Beginning of custom commands

I, [2017-10-05T14:11:33.743167 #14]  INFO -- : > echo "End of custom commands"
I, [2017-10-05T14:11:33.744524 #14]  INFO -- : End of custom commands

I, [2017-10-05T14:11:33.747151 #14]  INFO -- : Terminating async processes
I, [2017-10-05T14:11:33.748461 #14]  INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/9.5/bin/postmaster -D /etc/postgresql/9.5/main pid: 43
I, [2017-10-05T14:11:33.749777 #14]  INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 156
2017-10-05 14:11:33.749 UTC [43] LOG:  received fast shutdown request
2017-10-05 14:11:33.750 UTC [43] LOG:  aborting any active transactions
2017-10-05 14:11:33.751 UTC [50] LOG:  autovacuum launcher shutting down
156:signal-handler (1507212693) Received SIGTERM scheduling shutdown...
156:M 05 Oct 14:11:33.807 # User requested shutdown...
156:M 05 Oct 14:11:33.807 * Saving the final RDB snapshot before exiting.
156:M 05 Oct 14:11:33.815 * DB saved on disk
156:M 05 Oct 14:11:33.816 # Redis is now ready to exit, bye bye...
2017-10-05 14:11:34.178 UTC [47] LOG:  shutting down
2017-10-05 14:11:34.196 UTC [47] LOG:  database system is shut down
sha256:daa340e9005f444287a88ee8e471a7cf5716e198dc71b7935acee1a566e6742e
58399d8d80b0b5c3df266cdd9e68392797d7ade44c2b8969f56a5aaef8a03303

+ /usr/bin/docker run -d --restart=always -e LANG=en_US.UTF-8 -e RAILS_ENV=production -e UNICORN_WORKERS=4 -e UNICORN_SIDEKIQS=1 -e RUBY_GLOBAL_METHOD_CACHE_SIZE=131072 -e RUBY_GC_HEAP_GROWTH_MAX_SLOTS=40000 -e RUBY_GC_HEAP_INIT_SLOTS=400000 -e RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.5 -e DISCOURSE_DB_SOCKET=/var/run/postgresql -e DISCOURSE_DB_HOST= -e DISCOURSE_DB_PORT= -e DISCOURSE_HOSTNAME=discousre.jackhamrr.com -e DISCOURSE_DEVELOPER_EMAILS=onkar.m@indictranstech.com -e DISCOURSE_SMTP_ADDRESS=Smtp.gmail.com -e DISCOURSE_SMTP_PORT=587 -e DISCOURSE_SMTP_USER_NAME=onkar.m@indictranstech.com -e DISCOURSE_SMTP_PASSWORD=onkar123 -h ip-172-31-8-70-app -e DOCKER_HOST_IP=172.17.0.1 --name app -t -p 80:80 -p 443:443 -v /var/discourse/shared/standalone:/shared -v /var/discourse/shared/standalone/log/var-log:/var/log --mac-address 02:fb:bc:8a:31:23 local_discourse/app /sbin/boot
208453a479da9771b6224f38eafe8550eb32ae00d17394d69f18bb2e305d4ced
/usr/bin/docker: Error response from daemon: driver failed programming external connectivity on endpoint app (b796c6c09a71cfe3ed04e2ffd5fc2e936211aeebc94f698ac489d14110f0cd77): Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use.

Do you have some other web server running already?

Yes. Nginx web server is running

I don’t know how discourse-setup didn’t see they port 80 was occupied. It does a test when it starts.

See Running other websites on the same machine as Discourse