Installing Discourse with Apache2 Installed

Hi!
I am running an Ubuntu 18.04 server with Apache installed. I am wanting to install Discourse on a different port then use a reverse proxy via apache to make it accessible via a URL. I tried making an app.yml & changing the settings in there then ran: ./launcher rebuild app and everything goes well until the end where I get a ‘Failed’ error with this:

FAILED

Pups::ExecError: cd /var/www/discourse && su discourse -c ‘bundle exec rake themes:update assets:precompile’ failed w ith return #<Process::Status: pid 3801 exit 134>
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 t hemes:update assets:precompile’”]}
2beda643ff51279f145c96cdede83a1d6b65f67e00225be74100c8fb9fe3f790
** 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.

I tried using discourse-doctor but this told me nothing. Does anyone have a way to fix this? Also, I am using Apache as I find it easier to use and have more experience with Apache. So switching to Nginx isn’t an option.
Here is some logs from above the failed section:

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
98765.375844045 Compressing: vendor-9297d3b5d396b76cde3e1a19c960cf10c5edf8be99b1f5aeff21012e3ae57a34.js
terser ‘/var/www/discourse/public/assets/_vendor-9297d3b5d396b76cde3e1a19c960cf10c5edf8be99b1f5aeff21012e3ae57a34.js’ -m -c -o ‘/var/www/discourse/public/assets/vendor-9297d3b5d396b76cde3e1a19c960cf10c5edf8be99b1f5aeff21012e3ae57a34.js’ --source-map “base=‘/var/www/discourse/public/assets’,root=‘/assets’,url=‘/assets/vendor-9297d3b5d396b76cde3e1a19c960cf10c5edf8be99b1f5aeff21012e3ae57a34.js.map’”
<— Last few GCs —>

[3798:0x4872980] 2679 ms: Scavenge 108.1 (126.5) → 97.8 (129.8) MB, 9.0 / 0.0 ms (average mu = 1.000, current mu = 1.000) allocation failure
[3798:0x4872980] 2823 ms: Scavenge 111.4 (129.8) → 101.3 (132.8) MB, 8.4 / 0.0 ms (average mu = 1.000, current mu = 1.000) allocation failure
[3798:0x4872980] 2964 ms: Scavenge 114.8 (133.0) → 104.8 (135.3) MB, 32.7 / 0.0 ms (average mu = 1.000, current mu = 1.000) allocation failure

<— JS stacktrace —>

FATAL ERROR: NewSpace::Rebalance Allocation failed - JavaScript heap out of memory
1: 0xa89e60 node::Abort() [node]
2: 0x9ade29 node::FatalError(char const*, char const*) [node]
3: 0xc7583e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
4: 0xc75bb7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
5: 0xe3f6d5 [node]
6: 0xe7ec67 [node]
7: 0xe90b11 v8::internal::MarkCompactCollector::CollectGarbage() [node]
8: 0xe4c9d8 v8::internal::Heap::MarkCompact() [node]
9: 0xe4e368 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
10: 0xe5190c v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
11: 0xe157da v8::internal::factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]
12: 0x116d5e8 v8::internal::Runtime_AllocateInOldGeneration(int, unsigned long*, v8::internal::Isolate*) [node]
13: 0x15045f9 [node]
Aborted (core dumped)
rake aborted!
Errno::ENOENT: No such file or directory @ rb_file_s_size - /var/www/discourse/public/assets/vendor-9297d3b5d396b76cde3e1a19c960cf10c5edf8be99b1f5aeff21012e3ae57a34.js
/var/www/discourse/lib/tasks/assets.rake:293:in size' /var/www/discourse/lib/tasks/assets.rake:293:in block (4 levels) in ’
/var/www/discourse/lib/tasks/assets.rake:182:in block in concurrent?' /var/www/discourse/lib/tasks/assets.rake:284:in block (3 levels) in ’
/var/www/discourse/lib/tasks/assets.rake:273:in each' /var/www/discourse/lib/tasks/assets.rake:273:in block (2 levels) in ’
/var/www/discourse/lib/tasks/assets.rake:182:in concurrent?' /var/www/discourse/lib/tasks/assets.rake:270:in block in ’
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rake-13.0.6/exe/rake:27:in <top (required)>' /usr/local/bin/bundle:23:in load’
/usr/local/bin/bundle:23:in `’
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
I, [2021-07-21T16:25:26.467914 #1] INFO – : Downloading MaxMindDB…
Compressing Javascript and Generating Source Maps

I, [2021-07-21T16:25:26.469702 #1] INFO – : Terminating async processes
I, [2021-07-21T16:25:26.469947 #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/13/bin/postmaster -D /etc/postgresql/13/main pid: 56
I, [2021-07-21T16:25:26.470157 #1] INFO – : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 174
2021-07-21 16:25:26.470 UTC [56] LOG: received fast shutdown request
174:signal-handler (1626884726) Received SIGTERM scheduling shutdown…
2021-07-21 16:25:26.473 UTC [56] LOG: aborting any active transactions
174:M 21 Jul 2021 16:25:26.473 # User requested shutdown…
174:M 21 Jul 2021 16:25:26.474 * Saving the final RDB snapshot before exiting.
2021-07-21 16:25:26.479 UTC [56] LOG: background worker “logical replication launcher” (PID 65) exited with exit code 1
174:M 21 Jul 2021 16:25:26.480 * DB saved on disk
2021-07-21 16:25:26.480 UTC [60] LOG: shutting down
174:M 21 Jul 2021 16:25:26.480 # Redis is now ready to exit, bye bye…
2021-07-21 16:25:26.515 UTC [56] LOG: database system is shut down

Thanks,
Kian

Can you

? We really need to earlier log lines in order to provide any meaningful help.

Just attached them, sorry :slight_smile:

Your server doesn’t have enough RAM to install Discourse.

What is your memory and swap capacity?

It has 8GB memory and 10GB swap. By the looks of it my system isnt using swap.

Are the current application using all available memory and swappiness configured to never happen?

Since I don’t see any other reports I think it’s something on your server.

1 Like

Hi!
I have 8GB memory, 10 GB swap. Im running ./launcher rebuild app and the RAM is sat at 3.4GB RAM and no swap. Im using htop and swap just says OK/10.00G. Not sure if this means swap is working or not.

on HTOP swap says OK/10.00G. Not sure what this means. And the RAM is sat at 3.4G ish whilst running ./launcher rebuild app.

I think it has worked. I closed Clamd with sigterm using htop. The end has a docker ID. So im guessing its worked.

Edit: Seems to be working fine. I have loaded it via IP and port and it shows up fine! Just gotta setup the reverse proxy and its all done. Thanks for the help @Falco & @pfaffman :slight_smile:

2 Likes

Also,
I want to disable SSL on Discourse so it doesnt require a port. Can I disable it on Discourse and enable it on a reverse proxy, where I have the cert on my machine, etc

Yes, you just need to remove the first few lines on the app.yml file. The one with ssl on it and the one with letsencrypt.

How would I go about doing it with an apache reverse proxy using SSL? And Can I remove the 443:443 line in app.yml also?

Yes. Normally for doing reverse proxy you will want your service running in a unix socket. You can add the line

  - "templates/web.socketed.template.yml" 

to the templates list in the app.yml for that. Socket will be created at /var/discourse/shared/standalone/nginx.http.sock

1 Like

What would my Reverse proxy .conf look like? Or arent you too sure?

While there are some examples by community members like Configure Apache proxy with Let's Encrypt it’s outside the scope of support we provide here officially. Also keep in mind Sam warning:

1 Like

Ive ran apache as a proxy before so i know the stress :smiley:

1 Like

Hi!
Just wondering is this right for emails? As im not receiving any.

Rendered layouts/email_template.html.erb (Duration: 0.4ms | Allocations: 30)
Delivered mail 2d4e2472-28bc-4eba-a9d6-4ca666feb9d1@forum.domain.com (6.7ms)
Job exception: end of file reached

The email server is mail.domain.com not forum.domain.com, or is that meant to be there?

If you don’t receive the test email at /admin/email it’s not right :wink:. You can change the SMTP setting in the app.yml and fix any mistakes.

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