Deploying pimentaCHAT on FreeBSD
Note: This is a community supported installation method. You can discuss about this in the forum thread.
- FreeBSD 10.3-RELEASE
(64bit, meteor’s development scripts will not compile under 32bit)
Please use a fresh system without traces of node or npm. Most of my initial problems came from old and/or special versions of node/npm/meteor
You need to install the following packages either as root or via sudo:
$ sudo pkg install git scons python gcc48 gmake npm bash wget
Also install mongodb if you will be running the database setup on this server as well.
If you get the following output:
The package management tool is not yet installed on your system. Do you want to fetch and install it now? [y/N]:
It’s just because the pkg-ng binary package system have not been setup / bootstraped yet. Simply choose yes (y) here. And press enter.
We need pm2 later to daemonize or pimentaCHAT build.
Now, install pm2:
$ sudo npm install pm2 -g $ sudo pm2 startup freebsd
Add user for pimentaCHAT
This user will be the one used for running pimentaCHAT server.
$ adduser Username: pimentachat Full name: User used for running pimenta chat Uid (Leave empty for default): *press enter* Login group [pimentachat]: *press enter* Login group is pimentachat. Invite pimentachat into other groups? : *press enter* Login class [default]: *press enter* Shell (sh csh tcsh git-shell bash rbash nologin) [sh]: bash Home directory [/home/pimentachat]: *press enter, or pick where you want your pimentaCHAT installation to be* Home directory permissions (Leave empty for default): *press enter* Use password-based authentication? [yes]: *press enter* Use an empty password? (yes/no) [no]: *press enter* Use a random password? (yes/no) [no]: yes Lock out the account after creation? [no]: *press enter* Username : pimentachat Password : <random> Full Name : User used for running pimentaCHAT Uid : 1001 Class : Groups : pimentachat Home : /home/pimentachat Home Mode : Shell : /usr/local/bin/bash Locked : no OK? (yes/no): yes adduser: INFO: Successfully added (pimentachat) to the user database. adduser: INFO: Password for (pimentachat) is: qGn&j9nXBx&j*C#u Add another user? (yes/no): no
Be sure to save the password somewhere safe if you will need to login as the pimentaCHAT user in the future.
Switch to the newly created user
$ su -l pimentachat
(Or what ever username you picked).
Building the dev_bundle
Setting up the environment
Set some environment Variables to make the build work under FreeBSD:
$ export MAKE_CMD=gmake $ export CXX=clang++ $ export CC=clang
MAKE_CMD=gmake is important, because meteor requires GNU make to build. The fork we will be building lets us set
MAKE_CMD so we don’t have to do nasty stuff to our BSD make.
We need a fork of meteor which allows us to set
MAKE_CMD as mentioned before:
$ cd $HOME $ git clone -b freebsd https://github.com/williambr/meteor
Meteor comes with scripts to build it:
$ cd meteor $ ./scripts/build-mongo-for-dev-bundle.sh $ ./scripts/build-node-for-dev-bundle.sh $ ./scripts/generate-dev-bundle.sh
(These commands might take a long time to run depending on your hardware)
After compiling the development bundles above test out the meteor setup
$ ./meteor --version
This should give you output:
It's the first time you've run Meteor from a git checkout. I will download a kit containing all of Meteor's dependencies. Skipping download and installing kit from /usr/home/pimentachat/meteor2/dev_bundle_FreeBSD_amd64_0.5.16.tar.gz *** SNIPPED HERE *** Unreleased, running from a checkout at 9719021 (HEAD -> freebsd, origin/freebsd)
This should output no errors (Also version numbers might change).
That should run without problems. If you run into issues check the following:
- is the Environment setup right?
- Are the scripts running in bash?
- do I have
First, we need the
meteor binary in our
$ export PATH=$PATH:$HOME/meteor
Next, we need to download pimentaCHAT:
$ cd $HOME $ git clone https://bitbucket.org/pimenta-group/pimenta.chat.git $ cd pimentaCHAT
We need to install bcrypt separately.
$ npm install --clang=1 bcrypt
After that: Go ahead and start pimentaCHAT!
The first launch of pimentaCHAT might take some time as its installing dependencies. If all goes well you would see output like this:
=> App running at: http://localhost:3000/ I20160422-21:52:50.733(2)? ➔ System ➔ startup I20160422-21:52:50.734(2)? ➔ +----------------------------------------+ I20160422-21:52:50.735(2)? ➔ | SERVER RUNNING | I20160422-21:52:50.735(2)? ➔ +----------------------------------------+ I20160422-21:52:50.736(2)? ➔ | | I20160422-21:52:50.737(2)? ➔ | Version: 0.27.0 | I20160422-21:52:50.737(2)? ➔ | Process Port: 21690 | I20160422-21:52:50.738(2)? ➔ | Site URL: http://localhost:3000/ | I20160422-21:52:50.739(2)? ➔ | | I20160422-21:52:50.739(2)? ➔ +----------------------------------------+
If you would like to have the pimentaCHAT daemon running while signed out. You could use tmux to keep it running.
Install tmux (optional)
$ sudo pkg install tmux
Start a tmux session and run pimentaCHAT
$ tmux (when tmux is running) $ meteor
This will run pimentaCHAT inside a tmux session allowing you to disconnect from the terminal and let the daemon running.
ctrl+b dto exit the tmux session.
- And use
tmux ato access the session again.
To read more about using tmux see this page:
Or look up one of the many tmux guides online.
If you run into any troubles with bcrypt, try this:
cp -R ~/meteor/packages/non-core/npm-bcrypt ~/pimentaCHAT/packages/*
If you run into problems with
fibers check your
npm version. Then try to build it again.
- This guide is tested in a FreeBSD 10.3-RELEASE jail.
- Ensure you don’t expose the mongoDB instance to the internet without setting up security for it!