Syntax errors in discourse-setup

Hi,

I’m desperately trying to setup discourse on a small server I just rented, but it won’t work.

I ran the full installer, but received an error message later down that I could not locate, even after running the doctor. Apparently the app was never started, although the setup seems to have finished. I have tried to remove all files and clone the current git version again for a new try, and received some syntax errors right at the start.

(Please excuse the German error messages, translation below)

root@XXXXXXX:/var/discourse# ./discourse-setup
./discourse-setup: Zeile 119: [: : Ganzzahliger Ausdruck erwartet.
./discourse-setup: Zeile 139: [: : Ganzzahliger Ausdruck erwartet.
./discourse-setup: Zeile 148: [: : Ganzzahliger Ausdruck erwartet.
Ports 80 and 443 are free for use
'samples/standalone.yml' -> 'containers/app.yml'
./discourse-setup: Zeile 119: [: : Ganzzahliger Ausdruck erwartet.
Found GB of memory and 12 physical CPU cores
./discourse-setup: Zeile 220: [: : Ganzzahliger Ausdruck erwartet.
./discourse-setup: Zeile 224: [: : Ganzzahliger Ausdruck erwartet.
./discourse-setup: Zeile 228: 256 *  : Syntax Fehler: Operator erwartet. (Fehlerverursachendes Zeichen ist »*  «).
Hostname for your Discourse? [discourse.example.com]:

“Ganzzahliger Ausdruck erwartet.” -> expected Integer

"Syntax Fehler: Operator erwartet. (Fehlerverursachendes Zeichen ist » «)." -> Syntax error: expected operator. (Error-causing character is »* «).*

I tried just entering my data and running the whole setup, and it’s still failing.

Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake assets:precompile' failed with return #<Process::Status: pid 12943 exit 137>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"assets_precompile", "cmd"=>["su discourse -c 'bundle exec rake assets:precompile'"]}
cb10fb746d89de8e9589ec186ee279c70744ef0a4b876057e297a3a81c195c63
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.

Unfortunately, the doctor did not help me diagnose it. I also couldn’t find any prior error messages that might have led to the issue. Is it possible to retroactively search through output in a windows cmd?

I am really lost on what even caused the issue - all I did was follow the 30 min or less guide.
Any help would be appreciated, I am really looking forward to finally using a good forum-software :smiley:

Paul

1 Like

I just ran an installation and it worked fine, so I’m confused how you’d get those syntax errors. You didn’t edit discourse-setup did you?

Oh!

Found GB of memory and 12 physical CPU cores

implies that the test it did to check your memory is broken somehow. What OS are you using?

So your fastest solution is probably to edit containers/app.yml with nano or vi and then run

./launcher rebuild app

Maybe that’s what you did and then you have some error. As that message implies, it is likely above the output that you have provided.

You could try running the command in tmux which would then let you scroll backward to see the error, but just making your window much bigger might do it.

6 Likes

Hey, thanks for that fast reply!

I didn’t change anything - just copied the repo and went ahead.

I’m accessing an Ubuntu 18.04 LTS 64bit V-server via the cmd on my Win10 computer.
Just a random trail of thought regarding the missing integers and the error in the memory check: Maybe I don’t have enough RAM? I set for 1 GB (as I read somewhere that the 1 GB version is stable for small communities and I’m aiming for 15 users tops), but as some of the RAM is occupied by the OS etc., maybe less than 1 GB is available for the installer, which results in a number <1 for the test, which is not an Int?

When checking the last few messages the installer is giving me, nothing unusual catches my eye. Further up, everything seems to be fine, but after about a hundred lines of different writing commands, the MaxMind section catches my eye and is the last thing to happen before the installer terminates:

 I, [2020-03-24T17:55:55.518887 #12945]  INFO -- : Writing /var/www/discourse/public/assets/wizard/routes/application-d59d123de31ce4332833591002517bc2c672f4837258af1fb9d5c4191082002e.js
MaxMind IP database updates require a license
Please set DISCOURSE_MAXMIND_LICENSE_KEY to one you generated at https://www.maxmind.com
MaxMind IP database updates require a license
Please set DISCOURSE_MAXMIND_LICENSE_KEY to one you generated at https://www.maxmind.com
12276.612175452 Compressing: vendor-dc7fee7c0b1cb94afec0da9db0ad4b537128c9997d485b64f152c7d398a75b74.js
uglifyjs '/var/www/discourse/public/assets/_vendor-dc7fee7c0b1cb94afec0da9db0ad4b537128c9997d485b64f152c7d398a75b74.js' -m -c -o '/var/www/discourse/public/assets/vendor-dc7fee7c0b1cb94afec0da9db0ad4b537128c9997d485b64f152c7d398a75b74.js' --source-map "base='/var/www/discourse/public/assets',root='/assets',url='/assets/vendor-dc7fee7c0b1cb94afec0da9db0ad4b537128c9997d485b64f152c7d398a75b74.js.map'"
gzip -f -c -9 /var/www/discourse/public/assets/vendor-dc7fee7c0b1cb94afec0da9db0ad4b537128c9997d485b64f152c7d398a75b74.js > /var/www/discourse/public/assets/vendor-dc7fee7c0b1cb94afec0da9db0ad4b537128c9997d485b64f152c7d398a75b74.js.gz

brotli -f --quality=11 /var/www/discourse/public/assets/vendor-dc7fee7c0b1cb94afec0da9db0ad4b537128c9997d485b64f152c7d398a75b74.js --output=/var/www/discourse/public/assets/vendor-dc7fee7c0b1cb94afec0da9db0ad4b537128c9997d485b64f152c7d398a75b74.js.br


Done compressing vendor-dc7fee7c0b1cb94afec0da9db0ad4b537128c9997d485b64f152c7d398a75b74.js : 18.45 secs

12295.058740555 Compressing: admin-edcafb9306d097acc8fe3a6da2ce52cd58e14efeb973b4be9ecedf12329e78dd.js
uglifyjs '/var/www/discourse/public/assets/_admin-edcafb9306d097acc8fe3a6da2ce52cd58e14efeb973b4be9ecedf12329e78dd.js' -m -c -o '/var/www/discourse/public/assets/admin-edcafb9306d097acc8fe3a6da2ce52cd58e14efeb973b4be9ecedf12329e78dd.js' --source-map "base='/var/www/discourse/public/assets',root='/assets',url='/assets/admin-edcafb9306d097acc8fe3a6da2ce52cd58e14efeb973b4be9ecedf12329e78dd.js.map'"
Killed
I, [2020-03-24T17:57:00.642830 #1]  INFO -- : Downloading MaxMindDB...
Compressing Javascript and Generating Source Maps

I, [2020-03-24T17:57:00.643769 #1]  INFO -- : Terminating async processes
I, [2020-03-24T17:57:00.643906 #1]  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/10/bin/postmaster -D /etc/postgresql/10/main pid: 64
I, [2020-03-24T17:57:00.644087 #1]  INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 181
2020-03-24 17:57:00.644 UTC [64] LOG:  received fast shutdown request
2020-03-24 17:57:00.645 UTC [64] LOG:  aborting any active transactions
2020-03-24 17:57:00.649 UTC [64] LOG:  worker process: logical replication launcher (PID 73) exited with exit code 1
2020-03-24 17:57:00.950 UTC [68] LOG:  shutting down
2020-03-24 17:57:00.971 UTC [64] LOG:  database system is shut down
181:M 24 Mar 2020 17:54:40.069 * 10 changes in 300 seconds. Saving...
181:M 24 Mar 2020 17:54:40.107 * Background saving started by pid 12973
12973:C 24 Mar 2020 17:54:40.182 * DB saved on disk
12973:C 24 Mar 2020 17:54:40.183 * RDB: 0 MB of memory used by copy-on-write
181:M 24 Mar 2020 17:54:40.234 * Background saving terminated with success
181:signal-handler (1585072620) Received SIGTERM scheduling shutdown...
181:M 24 Mar 2020 17:57:00.734 # User requested shutdown...
181:M 24 Mar 2020 17:57:00.734 * Saving the final RDB snapshot before exiting.
181:M 24 Mar 2020 17:57:00.738 * DB saved on disk
181:M 24 Mar 2020 17:57:00.738 # Redis is now ready to exit, bye bye...


FAILED
--------------------

Exactly the same happens when I run the ./launcher rebuild app without changing anything in the .yml
You suggested changes in there, but I honestly wouldn’t know what to edit. The shared-buffer value looks fine, regarding I’ve got 1GB RAM, does it?
Here’s the full file (with blacked out inputs for domain and mailing. The respective tests were successful)

## this is the all-in-one, standalone Discourse Docker container template
##
## After making changes to this file, you MUST rebuild
## /var/discourse/launcher rebuild app
##
## BE *VERY* CAREFUL WHEN EDITING!
## YAML FILES ARE SUPER SUPER SENSITIVE TO MISTAKES IN WHITESPACE OR ALIGNMENT!
## visit http://www.yamllint.com/ to validate this file as needed

templates:
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  - "templates/web.ratelimited.template.yml"
## Uncomment these two lines if you wish to add Lets Encrypt (https)
  - "templates/web.ssl.template.yml"
  - "templates/web.letsencrypt.ssl.template.yml"

## which TCP/IP ports should this container expose?
## If you want Discourse to share a port with another webserver like Apache or nginx,
## see https://meta.discourse.org/t/17247 for details
expose:
  - "80:80"   # http
  - "443:443" # https

params:
  db_default_text_search_config: "pg_catalog.english"

  ## Set db_shared_buffers to a max of 25% of the total memory.
  ## will be set automatically by bootstrap based on detected RAM, or you can override
  #db_shared_buffers: "256MB"

  ## can improve sorting performance, but adds memory usage per-connection
  #db_work_mem: "40MB"

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

env:
  LANG: en_US.UTF-8
  # DISCOURSE_DEFAULT_LOCALE: en

  ## How many concurrent web requests are supported? Depends on memory and CPU cores.
  ## will be set automatically by bootstrap based on detected CPUs, or you can override
  #UNICORN_WORKERS: 3

  ## TODO: The domain name this Discourse instance will respond to
  ## Required. Discourse will not work with a bare IP number.
  DISCOURSE_HOSTNAME: xxxxxxxxxxxxxx.de

  ## Uncomment if you want the container to be started with the same
  ## hostname (-h option) as specified above (default "$hostname-$config")
  #DOCKER_USE_HOSTNAME: true

  ## 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: 'xxxxx@xxxxxxxxxxx.de'

  ## TODO: The SMTP mail server used to validate new accounts and send notifications
  # SMTP ADDRESS, username, and password are required
  # WARNING the char '#' in SMTP password can cause problems!
  DISCOURSE_SMTP_ADDRESS: smtp.strato.de
  DISCOURSE_SMTP_PORT: 587
  DISCOURSE_SMTP_USER_NAME: xxxxx@xxxxxxxxxx.de
  DISCOURSE_SMTP_PASSWORD: "xxxxxxxx"
  #DISCOURSE_SMTP_ENABLE_START_TLS: true           # (optional, default true)

  ## If you added the Lets Encrypt template, uncomment below to get a free SSL certificate
  LETSENCRYPT_ACCOUNT_EMAIL: me@example.com

  ## The http or https CDN address for this Discourse instance (configured to pull)
  ## see https://meta.discourse.org/t/14857 for details
  #DISCOURSE_CDN_URL: https://discourse-cdn.example.com

## The Docker container is 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

## Plugins go here
## see https://meta.discourse.org/t/19157 for details
hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/discourse/docker_manager.git

## Any custom commands to run after building
run:
  - exec: echo "Beginning of custom commands"
  ## If you want to set the 'From' email address for your first registration, uncomment and change:
  ## After getting the first signup email, re-comment the line. It only needs to run once.
  #- exec: rails r "SiteSetting.notification_email='info@unconfigured.discourse.org'"
  - exec: echo "End of custom commands"

Thanks for helping me through this! If you need anything else, please let me know!

1 Like

My best guess is that you have 1000MB of ram and the script expects you to have 1024MB of ram and somehow the text processing got confused. I’d try bumping the ram to 2GB.

5 Likes

That was a very good guess :+1:, despite the error in the suffix, so I’m interested to hear if you nailed the problem.

@Paul_Schweiger, did that suggestion fix your install?

4 Likes

I’ll have to upgrade my server, which might take a moment due to Corona and the fact that it’s currently 1:30 am in Germany :stuck_out_tongue:
I’ll let you know as soon as I’ve tested it. Thanks to everybody!

5 Likes

Hey guys,

Good news! The installer has worked this time around, upgrading my RAM seems to have been the key here.

On a sidenote: The syntax errors however remain the same when starting the installer under the latest docker version.

root@h2876733:/var/discourse# ./discourse-setup
./discourse-setup: Zeile 119: [: : Ganzzahliger Ausdruck erwartet.
./discourse-setup: Zeile 139: [: : Ganzzahliger Ausdruck erwartet.
./discourse-setup: Zeile 148: [: : Ganzzahliger Ausdruck erwartet.
Ports 80 and 443 are free for use
'samples/standalone.yml' -> 'containers/app.yml'
./discourse-setup: Zeile 119: [: : Ganzzahliger Ausdruck erwartet.
Found GB of memory and 12 physical CPU cores
./discourse-setup: Zeile 220: [: : Ganzzahliger Ausdruck erwartet.
./discourse-setup: Zeile 224: [: : Ganzzahliger Ausdruck erwartet.
./discourse-setup: Zeile 228: 256 *  : Syntax Fehler: Operator erwartet. (Fehlerverursachendes Zeichen ist »*  «).

Hostname for your Discourse? [discourse.example.com]:

I’ve also noticed that the installer immediately starts to fetch additional resources from origin although I have already pulled from the repo in the first step of the installer guide - which might be intended behavior.

Overall thanks for your help, and have a nice day!

1 Like

This is Ubuntu 18.04?

1 Like

The server info says Ubuntu 18.04 LTS 64bit

1 Like

What do these commands produce?

free -m --si | awk ' /Mem:/ {print $2}

free -m --si 
2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.