Can't run Rocket.Chat server on Ubuntu without Docker - node.js

I've been following this tutorial to install Rocket.Chat on Ubuntu:
https://github.com/RocketChat/Rocket.Chat/wiki/Deploy-Rocket.Chat-without-docker
Everything looks good until I try to run the server with node main.js:
Error: failed to connect to [localhost:27017]
at Object.Future.wait (/home/gregoire/Rocket.Chat/programs/server/node_modules/fibers/future.js:398:15)
at new MongoConnection (packages/mongo/mongo_driver.js:213:1)
localhost could also be 127.0.0.1 or my IP address, it doesn't change anything. Sounds like an error coming from MongoDB.
So I tried to run with sudo and the error I'm getting is different:
Error: MONGO_URL must be set in environment
I follow the tutorial, this variable has been set using export:
export ROOT_URL=http://localhost/
export MONGO_URL=mongodb://localhost:27017/rocketchat
export PORT=80
EDIT:
I needed to start mongod to then run the main.js. But I also got an error:
mongodb failed to connect to 127.0.0.1
I made some research and found that I had a missing folder. I used this command to create it and then started mongod:
mkdir -p /data/db
It worked after that, but it's not implied in the tutorial. I'm currently repeating the setup on a server and I'm having the same problem: /data/db is missing.

Disclaimer: I work for Rocket.Chat.
Are you sure mongodb is running? Can you type mongo and see if you can get into a mongoDB shell? If it's running, can you please confirm it's running on port 27017?
You can also go to https://demo.rocket.chat and join #support channel or #dev, where you'll find quite a few developers willing to help you out.

Related

Can't get mongodb to run. Tried `mongod --repair` and tried deleting lock file?

I first try to connect via mongo, and I get the following:
Error: couldn't connect to server 127.0.0.1:<port> at src/mongo/shell/mongo.js:145
exception: connect failed
First, I've tried the following, as per answers here:
removed the sudo mongod.lock file with root permission
and tried sudo -u mongodb mongod -f /etc/mongodb.conf --repair
I received the error Can't specify both --journal and --repair options.
Then, I tried just using regular mongo --repair, and got the following:
file names: a list of files to run. files have to end in .js and will exit after unless --shell is specified
What is a way around these two erorrs, or what is the way to fix this? Thanks.
By restarting the server, the problem was solved:
service mongodb restart
And after this, it started as normal.

Mongo shell not connecting

Mongo shell not connecting
I have dedicated centos server
I installed mongodb as a service in my server from here
I even restarted server after installing mongodb
When i tries to run mongo shell it always saying
Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at src/mongo/shell/mongo.js:146
I tried to remove that mongod.lock but no joy
I dont understand why this happens, because when mongod starts as a service it creates a log in system and telling that it has opened the door to listen incoming connection on port 27017. But it is throwing error while i connecting to mongo shell.
Please see this steps i have used --> click here
Well i wants to use this mongo service first of all at local based with only 127.0.0.1 access. I can change that in mongod.conf file afterward.
Be sure with iptables, Firwalll causing this kind of issue on live server.
So please do this if you facing this kind of same issue,
Do iptables off for a moment
# /etc/init.d/iptables stop
# sudo service mongod start
# mongo
Here what i wanted to see finally,
MongoDB shell version: 2.6.7
connecting to: test
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the support group
http://groups.google.com/group/mongodb-user
show dbs
admin (empty)
local 0.078GB
Thanks guys who considered my question and looking in it.
Thanks a lot.

Deployd + MongoDB not working

I have problem with Deployd and MongoDB, I have fully configured deployd and fully functional mongodb, I can run mongod without any problems , mongoDB is in .bashrc file in my path.
The most interesting part is that my deployd used to work just fine, I was creating my first deployd app today, then I went to dentist got back to my home, turned on my PC and it's not working anymore.
When I try to debug dpd I get this message:
mongod starting mongod +0ms
mongod error: 1 +6ms
mongod killing mongod +1ms
Any ideas?
Problem solved, the problem was that I used wrong installation guide for mongoDB,
I used this guide: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-linux/
This installation is pretty small, and it doesn't include things like logs or configuration files for mongodb in /var/ or /etc/ folders.
If you have Linux Ubuntu you should use this guide:
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
and everything should be ok.

MongoDB not working. "ERROR: dbpath (/data/db) does not exist."

I'm getting the following error when I try to run "mongod" in the terminal. I've tried uninstalling, reinstalling, and restarting the machine. Any suggestions on how to get it working would be amazing.
ERROR:
dbpath (/data/db) does not exist.
Create this directory or give existing directory in --dbpath.
See http://dochub.mongodb.org/core/startingandstoppingmongo
Side note:
Node also stopped working on my machine around the same time that I got this error.
events.js:72
throw er; // Unhandled 'error' event
^
Error: failed to connect to [localhost:27017]
Any help would be much appreciated!
This should work to ensure that the directory is set up in the right place so that Mongo can find it:
sudo mkdir -p /data/db/
sudo chown `id -u` /data/db
You need to create the directory on root /data/db or set any other path with the following command :
mongod --dbpath /srv/mongodb/
See the example link
I solved the problem with :
sudo mongod --dbpath=/var/lib/mongodb and then mongo to access the mongodb Shell.
Change the user of the new data directory:
chown mongodb [rute_directory]
And try another time to start the mongo service
service mongod start
I solve the same problem with this.
Daemons (usually ending with d) are normally started as services. Starting the service (daemon) will allow mongodb to work as designed (without permission changes if integrates well with your distro). I start it using the service named mongodb instead of starting mongod directly--on distro with systemd enable on startup then run like:
sudo systemctl enable mongodb
sudo systemctl start mongodb
or, on distro with upstart (if you have /etc/init) or init (if you have /etc/init.d) ( https://www.tecmint.com/systemd-replaces-init-in-linux/ ) instead run:
sudo service mongodb enable
sudo service mongodb start
If you have a distro with rc ("run commands") such as Gentoo (settings in /etc/init.d) (https://forums.gentoo.org/viewtopic-t-854138-start-0.html) run:
rc-update add mongodb default
/etc/init.d/mongodb start
In a distro/version of FreeBSD which still has rc (check whether your version switched to systemd, otherwise see below):
add the following line to /etc/rc.conf:
mongod_enable="YES"
then:
sudo service mongod start
After starting the service, an unpriveleged user can use mongo, and each user will have separate data.
I also got the error that "The file /data/db doesn't exist" when I tried to save my file using the "mkdir -p /data/db" command(using both with and without sudo command). But later on one site, a person named Emil answered that the path "/data/db" no longer works on Mac, so use "~/data/db" instead
i.e., use the command
mkdir -p ~/data/db
instead of previous command.
Moreover, use
mongod --dbpath ~/data/db
to run mongod
It worked for me, hope it work for others too facing the same problem

postgresql commands not being executed

I downloaded postgresql-9.1.
but when I execute the command in terminal:
$ createdb mydb
I get the following message:
createdb: could not connect to database postgres: 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"?
please tell me how to sort this problem.I have even tried to uninstall and then reinstall it. I am trying to run this on linux mint 15 (cinnamon).
Use ps to see if the postgresql process is actually running. If not, start it (service postgresql start). Normally should start up itself on boot after installation but who knows. Also, some error may prevent it from starting on boot.
If postgresql is running, then you may need to edit pg_hba.conf in the data directory. Again, normally the database should listen for local connections by default but who knows.

Resources