Inheriting discourse install - need some assistance

So I took over a new position at a company, and we had been using Discourse - then moved to AnswerHub (:man_shrugging:) and I am probably going to move us back to Discourse.

I have used discourse before - but this install wasn’t really managed and no one knows what/how to access what’s currently running, and I need to get logged in and start Admin’ing it (it’s been set to Read Only).

I am trying to figure out where it’s being run on the box - I am not good with Docker but I have these instances:

   $ sudo docker images
   REPOSITORY            TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
   local_discourse/app   latest              ---------------        11 months ago       2.366 GB
   discourse/discourse   1.3.10              ---------------        11 months ago       1.539 GB
   discourse/discourse   1.3.5               ---------------        18 months ago       1.501 GB

What’s the easiest way to get in here and get access to the Admin?

Edit: I was able to enter the docker image (app) so that’s a start

1 Like
cd /var/discourse
./launcher enter app
rake admin:create
exit

And probably (to upgrade to latest, but you’ll probably need to upgrade Docker too)

cd /var/discourse
./launcher rebuild app
3 Likes

Awesome - will that walk through a process to create a whole new Admin?

1 Like

The script is pretty flexible – it can create a new account for you, but if you give it the email address of an already existing user, it will grant that user admin privileges instead :slight_smile:

2 Likes

got it - excellent. Thanks @fefrei and @pfaffman

1 Like

So after performing the above, I had to upgrade Docker on my server. With that done, everything came back up. However, I performed

./launcher rebuild app

And after waiting ~7min it failed with the following being the last bits of the readout:

FAILED

--------------------

Pups::ExecError: cd /var/www/discourse && ln -s /shared/uploads public/uploads failed with return #<Process::Status: pid 3244 exit 1>

Location of failure: /pups/lib/pups/exec_command.rb:108:in `spawn'

exec failed with the params {"cd"=>"$home", "cmd"=>["mkdir -p public/forum", "cd public/forum && ln -s ../uploads && ln -s ../backups", "ln -s /shared/uploads public/uploads", "ln -s /shared/backups public/backups"]}

14a2deb1523549c18cc7c67e71ec4774f267df552dce399e61105dd3ef954dc0

** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one

@jerdog

Could you paste the output of these commands

df -hP (to check free space)
free -m (to check free memory)
uptime (to check load in the server)

3 Likes

i will as soon as a reboot works - after rebooting the server I’m not able to connect to it - it’s denying my ssh key - so working with my server team. :confused:

@jerdog
Feel free to PM me if they aren’t able to bring it back up.
I can help you if you need any assistance.

4 Likes

Alright so to update here… after a bunch of smaller issues, I finally got back to the server and have re-ran sudo ./launcher rebuild app and here’s the last few screens:

Start compiling CSS: 2017-12-21 16:43:51 UTC

Compiling css for default 2017-12-21 16:43:51 UTC

precompile target: desktop Default

precompile target: mobile Default

precompile target: desktop_rtl Default

precompile target: mobile_rtl Default

precompile target: desktop 

precompile target: mobile 

precompile target: desktop_rtl 

precompile target: mobile_rtl 

Done compiling CSS: 2017-12-21 16:43:55 UTC

I, [2017-12-21T16:43:55.601570 #13]  INFO -- : Purging temp files

Bundling assets

Compressing Javascript and Generating Source Maps

I, [2017-12-21T16:43:55.605198 #13]  INFO -- : File > /usr/local/bin/discourse  chmod: +x

I, [2017-12-21T16:43:55.608262 #13]  INFO -- : File > /usr/local/bin/rails  chmod: +x

I, [2017-12-21T16:43:55.611291 #13]  INFO -- : File > /usr/local/bin/rake  chmod: +x

I, [2017-12-21T16:43:55.614115 #13]  INFO -- : File > /etc/update-motd.d/10-web  chmod: +x

I, [2017-12-21T16:43:55.615837 #13]  INFO -- : File > /etc/logrotate.d/rails  chmod: 

I, [2017-12-21T16:43:55.617538 #13]  INFO -- : File > /etc/logrotate.d/nginx  chmod: 

I, [2017-12-21T16:43:55.620467 #13]  INFO -- : File > /etc/runit/1.d/00-ensure-links  chmod: +x

I, [2017-12-21T16:43:55.623444 #13]  INFO -- : File > /root/.bash_profile  chmod: 644

I, [2017-12-21T16:43:55.623611 #13]  INFO -- : > echo "Beginning of custom commands"

I, [2017-12-21T16:43:55.624942 #13]  INFO -- : Beginning of custom commands

I, [2017-12-21T16:43:55.625256 #13]  INFO -- : > cd /var/www/discourse && mkdir -p public/forum

I, [2017-12-21T16:43:55.627464 #13]  INFO -- : 

I, [2017-12-21T16:43:55.627544 #13]  INFO -- : > cd /var/www/discourse && cd public/forum && ln -s ../uploads && ln -s ../backups

I, [2017-12-21T16:43:55.629935 #13]  INFO -- : 

I, [2017-12-21T16:43:55.630007 #13]  INFO -- : > cd /var/www/discourse && ln -s /shared/uploads public/uploads

ln: failed to create symbolic link 'public/uploads/uploads': File exists

I, [2017-12-21T16:43:55.632215 #13]  INFO -- : 

I, [2017-12-21T16:43:55.632491 #13]  INFO -- : Terminating async processes

I, [2017-12-21T16:43:55.632581 #13]  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-12-21T16:43:55.632690 #13]  INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 156

2017-12-21 16:43:55.632 UTC [43] LOG:  received fast shutdown request

2017-12-21 16:43:55.632 UTC [43] LOG:  aborting any active transactions

2017-12-21 16:43:55.632 UTC [50] LOG:  autovacuum launcher shutting down

156:signal-handler (1513874635) Received SIGTERM scheduling shutdown...

2017-12-21 16:43:55.635 UTC [47] LOG:  shutting down

156:M 21 Dec 16:43:55.657 # User requested shutdown...

156:M 21 Dec 16:43:55.657 * Saving the final RDB snapshot before exiting.

2017-12-21 16:43:55.676 UTC [47] LOG:  database system is shut down

156:M 21 Dec 16:43:55.884 * DB saved on disk

156:M 21 Dec 16:43:55.884 # Redis is now ready to exit, bye bye...

FAILED

--------------------

Pups::ExecError: cd /var/www/discourse && ln -s /shared/uploads public/uploads failed with return #<Process::Status: pid 3256 exit 1>

Location of failure: /pups/lib/pups/exec_command.rb:108:in `spawn'

exec failed with the params {"cd"=>"$home", "cmd"=>["mkdir -p public/forum", "cd public/forum && ln -s ../uploads && ln -s ../backups", "ln -s /shared/uploads public/uploads", "ln -s /shared/backups public/backups"]}

4b44820ca7a1600d0687192790f721fb36267d7e8529b1a0107b9a0df2977b56

** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one

any guidance here?

edit: looks like it’s failing here first on the custom commands:

I, [2017-12-21T16:43:55.630007 #13]  INFO -- : > cd /var/www/discourse && ln -s /shared/uploads public/uploads

ln: failed to create symbolic link 'public/uploads/uploads': File exists

and then everything shuts down… what already exists is this:

lrwxrwxrwx 1 discourse root 15 Dec 21 14:27 uploads -> /shared/uploads

This is the problem:

Looks like you are dealing with a subfolder install.

Check our guide Serve Discourse from a subfolder (path prefix) instead of a subdomain and amend your yml file on the containers folder to follow it.

3 Likes

Yeah just added to my thoughts above… let me have a peruse of that link

We were already setup for folders correctly - it was actually due to creating symbolic links which already existed - so it failed. Now we’re back up… however, login is disabled due to being in read only mode. Any way to change this manually so I can login?

Edit: found this How can Admin login while Read-only mode is enabled on multisite? and am checking it out

Ran discourse disable_readonly and got the “The site is now fully operable.” message, but when I reload the browser it doesn’t let me login, saying it’s still in readonly mode. I performed a ./launcher reload app and it is still in readonly mode

Tried:

rails c
Discourse.disable_readonly_mode

And it returned
=> true

No dice.

Tried:

rails c
Discourse.readonly_mode?

And it returned

=> true

Seems like it is locked in RO mode?

I went ahead and replied in here (Stuck in 'Read Only' Mode) as what I am experiencing now is more in line with that topic

There are 3 different types of read only.

Try:

rails c
Discourse.disable_readonly_mode(Discourse::USER_READONLY_MODE_KEY)
Discourse.disable_readonly_mode(Discourse::READONLY_MODE_KEY)
Discourse.disable_readonly_mode(Discourse::PG_READONLY_MODE_KEY)
2 Likes

yeah I ran all 3 of those - and it stays out of read only mode (or at least doesn’t have the note at the top about being in read only mode), when I try to login it does this and stays there:

Looks like you have 0 enabled login methods :smile:.

Go to /u/admin-login to login.

4 Likes

Thanks for all your help. Looks like I am back in. Assuming I can just make it read only while still being able to login as Admin via that link above

This topic was automatically closed after 2361 days. New replies are no longer allowed.