Beginners Guide to Install Discourse on Ubuntu for Development


(SMHassanAlavi) #155

Hi,
I have installed discourse step by step.
but whenI run :
bundle exec rails server
and open localhost:3000
I see this error:


what should I do???


(OG) #156

From what I see I think you don’t have “root” user created in your PostGres database.

In original article it should be named after user using Ubuntu - eg. techapj (see Setup Database in first post) for security reasons you shouldn’t be using superuser (root).


(SMHassanAlavi) #157

I find the answer.
I have installed discourse as root.
It shouldn’t be like that.


(Philip Colmer) #158

Errors are being reported during this step:

df: /home/ubuntu/discourse/public/uploads: No such file or directory

There definitely is a directory there:

df /home/ubuntu/discourse/public/uploads
Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/xvda1      32888828 10808136  20639128  35% /

so I’m not sure what - if anything - can be done about that error.

Next:

jhead worker: `jhead` not found; please provide proper binary or disable this worker (--no-jhead argument or `:jhead => false` through options)

Do I need to install the jhead package?

Similarly:

svgo worker: `svgo` not found; please provide proper binary or disable this worker (--no-svgo argument or `:svgo => false` through options)

I’m not sure if there is an Ubuntu package for svgo, so that might need to be installed manually?

convert: unable to open image `/home/ubuntu/discourse/public/uploads/default/9/1234567890123456.png': No such file or directory @ error/blob.c/OpenBlob/2712.

This might be because jhead and svgo are missing, I guess.

Does it matter if autospec has problems? Presumably it is running a series of test?


(Mittineague) #159

Running autospec will run the tests that have been written.

I found this online, so I can’t say as it’s the best way to do it, inside ~/discourse

sudo apt install linuxbrew-wrapper
brew install advancecomp gifsicle jhead jpegoptim jpeg optipng pngcrush pngquant

But I still get 29 Fails of these two

jhead worker: jhead not found; please provide proper binary or disable this worker (–no-jhead argument or :jhead => false through options)
svgo worker: svgo not found; please provide proper binary or disable this worker (–no-svgo argument or :svgo => false through options)svgo

AFAIK jhead and svgo are used for optimizing images, which is not that important to me in my localhost install.

The errors prickle me a bit, but the good news is that they haven’t gotten in the way of what I’vve been interested in doing yet.


(Philip Colmer) #160

Thanks, @Mittineague, for your feedback.

I find it a little bit concerning that a guide for beginners seems to be resulting in an installation that isn’t passing the tests. As a beginner, I don’t know how important it is that these tests are passed or not. Normally, one might expect it to be really important, otherwise why go to the trouble of writing the test?

Hopefully someone from the team (perhaps @techAPJ as the original author) might be able to suggest edits to the page in order to overcome whatever is causing the tests to fail.


(Arpit Jalan) #161

Yes, from developer’s point of view it matters.

Try installing image libraries via:

sudo apt-get -y install advancecomp gifsicle jpegoptim libjpeg-progs optipng pngcrush pngquant jhead

curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get -y install nodejs
sudo npm install -g svgo

If the above commands fixes this issue for you I will add them to original install script.


Install discourse on localhost
(Philip Colmer) #162

Thanks for the prompt reply, @techAPJ.

The installation of jhead is failing:

sudo apt-get -y install advancecomp gifsicle jpegoptim libjpeg-progs optipng pngcrush pngquant jhead
Reading package lists... Done
Building dependency tree
Reading state information... Done
optipng is already the newest version (0.7.6-1).
gifsicle is already the newest version (1.88-1).
jpegoptim is already the newest version (1.4.3-1).
libjpeg-progs is already the newest version (1:9b-1ubuntu1).
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 jhead : Depends: libjpeg-turbo-progs but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

If I try to manually install libjpeg-turbo-progs, this is the output:

sudo apt-get install libjpeg-turbo-progs
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
  libjpeg9
Use 'sudo apt autoremove' to remove it.
The following packages will be REMOVED:
  libjpeg-progs
The following NEW packages will be installed:
  libjpeg-turbo-progs

After that, jhead does install, and I’ve installed the rest of the packages so now I’ll run the tests.


(Philip Colmer) #163

It is looking a lot better, although I’m assuming the red Fs mean there are some failures.

The tests are still running but here is the first displayed problem:

convert: unable to open image `/home/ubuntu/discourse/public/uploads/default/25/1234567890123456.png': No such file or directory @ error/blob.c/OpenBlob/2712.
convert: unable to open file `/home/ubuntu/discourse/public/uploads/default/25/1234567890123456.png' @ error/png.c/ReadPNGImage/3922.
convert: no images defined `/tmp/discourse-thumbnail20170127-29049-19myulm.png' @ error/convert.c/ConvertImageCommand/3210.

There are only green dots leading up to that output.

Another message output during the tests:

WARN: Redis is in a readonly state. Performed a noop

then, after the tests, there were 11 failures that were noted as “expected and not affecting the suite’s status”, followed by:

bundler: failed to load command: rspec (/home/ubuntu/.rbenv/versions/2.3.0/bin/rspec)

#164

Anyone managed to overcome these problems? I have exactly same errors as @Philip_Colmer. I checked the listed paths and the needed folders don’t exist (I only have ‘optimized’ and ‘original’ folders under ‘default’):

convert: unable to open image `/media/files/PBF/discourse/public/uploads/default/17/1234567890123456.png': No such file or directory @ error/blob.c/OpenBlob/2712.
convert: unable to open file `/media/files/PBF/discourse/public/uploads/default/17/1234567890123456.png' @ error/png.c/ReadPNGImage/3922.
convert: no images defined `/tmp/discourse-thumbnail20170203-25274-iazz5i.png' @ error/convert.c/ConvertImageCommand/3210.

What’s more the ‘folder_name’ /media/files/PBF/discourse/public/uploads/default/folder_name
is generated randomly - it’s different number every time i run bundle exec rake autospec.

I can also confirm that the rspec file exists in the searched directory:
bundler: failed to load command: rspec (/home/lukasz/.rbenv/versions/2.3.0/bin/rspec)


(Jafeth Díaz Castañeda) #165

Hello,

I have followed this guide and everything was working fine except the email. When I wanted to sign up a new user, the mail didn’t appear in mailcatcher. I looked at the admin dashboard and noticed a message informing that sidekiq wasn’t running and therefore emails wouldn’t be sent. After that, I ran bundle exec sidekiq and everything worked fine.

I was wondering whether that is a required step or it happened only to me?


(cpradio) #166

Sidekiq is a required step.


#167

This works great.
Only issue I noticed: after following the full install process, redis-server is not launched at startup (you need to run it manually)


(MorphZan) #168

I got to the step where you type the following:

source ~/.bashrc
bundle install

And I get “Could not Locate Gemfile”

Any suggestions ??


(Régis Hanol) #169

Are you running bundle install in the directory where you cloned the discourse repository?


(MorphZan) #170

Thank You
I made a typo and on looking at the screen properly realised my stupidty

!!! :laughing:


(Karl) #172

Thanks for the guide, it has been very helpful!

I just ran through the guide on an Ubuntu 16.04 system and had (broadly speaking) the same errors during rake auto spec as someone in the guide to installing on OSX.

To try and resolve them I installed a number of packages

apt install advancecomp gifsicle jhead jpegoptim optipng pngcrush pngquant

of which advancecomp jhead libjpeg-turbo-progs pngcrush pngquant were missing.

I had to install npm and nodejs-legacy so i could install and run svgo, another thing the tests were after.

then ran rake following the same post
RAILS_ENV=test rake db:drop db:create db:migrate

and then back to following the guide.

bundle exec rake db:migrate db:test:prepare db:seed_fu

and so on

It doesn’t seem to have fixed the spec issues, they seem to go on forever. I do have a discourse install that loads though!


(MorphZan) #173

Hi Guys

When I go to sidekiq it comes as follows:

But when I look in the Dashboard I get this:

Any Clues how to make this right?

EDIT: My Fix lasted all of 2min until i Rebooted and now I get the following:

Also any clues/links to posts on how to update the Development Version would be much appreciated:


(Owen Sullivan) #174

I created a tutorial on how to use Screen to allow a user to run commands after bootstrapping Discourse for development.


#175

Hi,

I have upload issues on my install (during import from SMF). The installs noted in this thread all completed correctly but the issue remains. Any ideas please?

645 / 25313 ( 2.5%) [2720 items/min] Failed to create upload: Bin resolving errors:
pngout worker: pngout not found; please provide proper binary or disable this worker (--no-pngout argument or :pngout => false through options)
pngquant worker: pngquant not found; please provide proper binary or disable this worker (--no-pngquant argument or :pngquant => false through options)undefined method `persisted?' for nil:NilClass

I have installed all of these:

sudo apt-get -y install advancecomp gifsicle jpegoptim libjpeg-progs optipng pngcrush pngquant jhead
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get -y install nodejs
sudo npm install -g svgo