-
Notifications
You must be signed in to change notification settings - Fork 0
Install Movim
This tutorial describes the different steps you need to take to deploy Movim on your webserver. It can be followed from version 0.9 (included).
Movim requires some dependencies to be setup properly.
- A fully working webserver like Apache or Nginx (version 1.3.13 minimal)
- Root access by SSH with access to the webserver user (most of the time via the user www-data)
- A database server like MySQL or PostgreSQL with a schema for Movim (more info in Database Configuration)
-
PHP 5.4 minimum with :
- Curl (package ''php5-curl'')
- PHP ImageMagick and GD for the picture processing (package ''php5-imagick'' and ''php5-gd'')
- Your database PHP driver (package ''php5-pgsql'' or ''php5-mysqlnd'' depending on the type of database server you want to use)
- And the PHP XML package ''php-xml'' or ''php5-xml''
It's mandatory to understand the general architecture of the project to a certain extent before trying to deploy it.
When you use Movim, it acts as an intermediary between the user's browser and an XMPP server. All the data that is sent and received by these two parties are managed by the Movim core, some of them are also saved in a database (for cache purposes).
From the browser perspective, all communication with Movim is done using WebSockets (except for the "default" page loading). These sockets are proxied through your web-server to the Movim daemon. On the XMPP side Movim connects using pure TCP connections (like any XMPP client).
So all these streams will be managed by the Movim daemon. This daemon needs to be launched with the same user and rights as the web-server (most of the time using the www-data
user).
The Movim source code is not available in a packaged version for now, please follow the next paragraph. You simply have to clone it from git and put it on your web server. The package contains everything to make Movim run on your system.
The next part is only required for those who want to install the development version. If you took the Movim package from the repository please jump to the next chapter and go directly to the Deployment section.
The development version of Movim only comes with the core of the project. To install the dependencies you need to install a couple of version control systems to download the source codes from different repositories.
# Install Git and Mercurial so that Composer
# can clone the dependencies into your project
apt-get install git mercurial
Git is required to properly get the source code from the official repository. We recommend to execute the following commands with the www-data
user (which is the common user for most of the GNU/Linux web servers).
cd /var/www/ # Server directory
sudo -s -u www-data # We use the web-server user
# We copy the source code from the repository
git clone https://github.com/movim/movim.git
cd movim
Movim requires several dependencies to work properly. These libraries are managed using Composer. You can install Composer in the Movim directory using the following command.
curl -sS https://getcomposer.org/installer | php
Now you will be able to install the dependencies.
# Finally install your project's dependencies
php composer.phar install
You can also update your current Movim instance with the following lines (check anyway if the updates do not include any incompatibilities with your current version).
cd /var/www/movim/
git pull # To update the Movim source-code
php composer.phar install # To update the libraries
If the update comes with some database changes, please check in the Administration Panel (Database tab) if Movim asks you to update it.
This part of the tutorial can be followed for the stable and testing installation. They need to be applied in the correct order.
Movim needs to have permissions to create some folders in its root folder to be deployed properly. You can easily fix this with something like these few lines. You don't need to apply these rights recursively, only the root folder needs to be writable.
# Use the root user to do the chown
chown www-data movim/
As soon as Movim has the correct write rights, it will create several folders:
- log/ for the PHP logs
- users/ for the users pictures
- cache/ for the thumbnails and some temporary files
Movim needs to be connected to an existing database to work properly. The minimal required schema is therefore an empty database associated with a user. The default configuration file uses the following values:
$conf = array(
# The type can be 'pgsql' or 'mysql'
'type' => 'mysql',
# The database username
'username' => 'username',
# The password
'password' => 'password',
# Where can we find the database ?
'host' => 'localhost',
# The port number, 3306 for MySQL and 5432 for PostGreSQL
'port' => 3306,
# The database name
'database' => 'movim'
);
It is not advised to keep the same values when you go to production, rename the example file in the config
folder to db.inc.php
and fill the fields with your personal configuration.
cd movim/config/
cp db.example.inc.php db.inc.php
# Edit db.inc.php with your current configuration
To let the browser communicate with the Movim server, you need to launch the daemon. It also needs to be launched using the web server user.
sudo -s -u www-data # if you are on Ubuntu
Then launch the daemon with two mandatory parameters:
-
The public URL of Movim. For the official pod it is
http://pod.movim.eu/
, for a test on your own machine it could also behttp://localhost/movim/
. - The port used by the daemon, 8080 in our case.
cd /var/www/movim
# we launch the daemon
php daemon.php {public url of your pod} {port used by the daemon}
If everything runs as expected you should see:
Movim daemon launched
Base URI : https://pod.movim.eu/
...
Encrypted Public WebSocket URL : wss://pod.movim.eu/ws/
This daemon will be killed once your console is closed. Use a command like screen
(see How To Use Linux Screen) or tmux
to keep the console open, even after your disconnection.
When you launch the daemon, it will generate the configuration to apply to your web server to "proxify" the WebSockets and display it in the console.
These configurations are dynamically generated to fit your current setup. Whether you use Apache or Nginx, both possible configuration will be displayed and will display even after you successfully applied them.
Here is an example of generated configuration:
Enable the Proxy WebSocket module.
# a2enmod proxy_wstunnel
Add this in your configuration file (default-ssl.conf)
ProxyPass /ws/ ws://localhost:8080/
Note that default-ssl.conf is the file to edit if you enabled HTTPS, otherwise you should edit 000-default.conf. Also remember to restart Apache to make sure your new configuration has been applied correctly.
Add the following configuration
location /ws/ { proxy_pass http://localhost:8080/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto https; proxy_redirect off; }
Now that everything is setup, you can configure Movim using the Admin Panel at {your public domain}/?admin
, so if you're on your local host:
http://localhost/movim/?admin
The default credentials are admin
and password
.
This page will also let you reset these values to more secure ones.
Some of the configuration elements are only applied after the reboot of the daemon.