This manual is deprecated. Please visit https://groupoffice.readthedocs.io for the latest documentation.

Difference between revisions of "Server Manager"

From Group-Office Groupware and CRM Documentation
Jump to: navigation, search
(New page: ==Server manager== The server manager is a module that can manage other Group-Office installations on a Debian server. Partners can obtain the installation package from Intermesh. You nee...)
 
(Run SQL on all)
 
(36 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
==Server manager==
 
==Server manager==
The server manager is a module that can manage other Group-Office installations on a Debian server. Partners can obtain the installation package from Intermesh.
+
The server manager is a module that can manage other Group-Office installations on a Debian server. You need to have a domain and all subdomains point to the IP address of the server. For example *.groupoffice.eu.
 
+
You need to have a domain and all subdomains point to the IP address of the server. For example *.groupoffice.eu.
+
 
CustomerX will get the domain http://customerx.groupoffice.eu
 
CustomerX will get the domain http://customerx.groupoffice.eu
  
 +
By default the servermanager is installed at https://<IP_ADDRESS>/groupoffice
  
By default the servermanager is installed at https://<IP_ADDRESS>/
+
 
 +
===Installation===
 +
 
 +
Become root on your Debian or Ubuntu system and type:
 +
<pre>
 +
apt-get install groupoffice-servermanager
 +
</pre>
 +
 
 +
For the servermanager to work you need to raise the groupoffice-com user's permissions. It must be able to create new databases. Execute this SQL when you installed the groupoffice-servermanager package:
 +
 
 +
<pre>REVOKE ALL PRIVILEGES ON * . * FROM 'groupoffice-com'@'localhost';
 +
GRANT ALL PRIVILEGES ON * . * TO 'groupoffice-com'@'localhost' WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;</pre>
 +
 
 +
After this you can add an installation with the name test.mydomain.com for example. If test.mydomain.com points to the server IP it should work. You can also test this by putting test.mydomain.com in your hosts file.
  
 
===How is the server organized?===
 
===How is the server organized?===
Line 12: Line 24:
  
 
====Apache and Group-Office====
 
====Apache and Group-Office====
A virtual host for all Group-Office installations is created in /etc/apache2/sites-enabled/000-groupoffice.
+
You should not have to edit any of these configuration files. Everything can be managed through the servermanager. This is just to explain how it works.
 +
 
 +
A virtual host for all Group-Office installations is created in: <b>/etc/apache2/sites-enabled/000-groupoffice.</b>
 +
 
 
It uses a VirtualDocumentRoot (More info: http://httpd.apache.org/docs/2.0/mod/mod_vhost_alias.html) so any domain name pointing to the server IP will automatically work when it's created in the servermanager.
 
It uses a VirtualDocumentRoot (More info: http://httpd.apache.org/docs/2.0/mod/mod_vhost_alias.html) so any domain name pointing to the server IP will automatically work when it's created in the servermanager.
 
SSL is also preconfigured with a test certificate using the apache module mod_ssl.
 
SSL is also preconfigured with a test certificate using the apache module mod_ssl.
  
The VirtualDocumentRoot is located at: /var/www/groupoffice/ so there's a directory for each domain in that directory. For example;
+
The VirtualDocumentRoot is located at <b>/home/govhosts/</b>. There's a directory for each domain in that directory. For example: /home/govhosts/customer.groupoffice.eu/.
 +
 
 +
The home directories and other data files are stored in /home/govhosts/customer.groupoffice.eu/data. The database is called groupoffice_groupoffice_eu.
 +
 
 +
In that directory there is a symlink called "groupoffice" that points to <b>"/usr/share/groupoffice"</b>. That is where the actual source of Group-Office is located.
 +
 
 +
The config.php file for each Group-Office installation can be found in <b>"/etc/groupoffice/<DOMAIN>/config.php"</b>. There is also a <b>"/etc/groupoffice/globalconfig.php"</b>. The configuration parameters in here apply to all installations.
 +
 
 +
There is also a configuration file for the servermanager module: <b>"/etc/groupoffice/servermanager.inc.php"</b>. It contains some default configuration values for new installations.
 +
 
 +
Apache and PHP errors are logged in <b>/var/log/apache2/groupoffice_error_log</b>
 +
 
 +
====Postfix and Dovecot====
 +
Postfix is setup to use virtual accounts in MySQL like described in detail here:
 +
 
 +
http://www.group-office.com/wiki/Mailserver
 +
 
 +
All users are stored in the MySQL database "servermanager" and can be managed with the servermanager. A special perl script is used to handle autoresponse when a user is on vacation.
 +
Dovecot checks the quota in MySQL.
 +
 
 +
The actual mails are stored in /vmail/<domain>/<user>/
 +
 
 +
====Changing the MySQL root password====
 +
Because Postfix and Dovecot connect to the MySQL database using the root password, you will have to edit the following configuration files:
 +
 
 +
#/etc/postfix/mysql_*
 +
#/etc/dovecot/dovecot-sql.conf
 +
#/etc/groupoffice/config.php
 +
 
 +
====Moving the servermanager installation to servermanager.yourdomain.com====
 +
You might dislike the fact that the default installation sits at http://yourdomain/grouoffice/. Take the following steps to change this.
 +
 
 +
# Remove the alias from /etc/apache2/groupoffice.conf. Just add a # before Alias /groupoffice /usr/share/groupoffice
 +
# Create the directory:<br /><pre>mkdir /home/govhosts/servermanager.yourdomain.com</pre>
 +
# Create a symlink:<br /><pre>ln -s /usr/share/groupoffice /home/govhosts/servermanager.yourdomain.com/groupoffice</pre>
 +
# Edit /etc/groupoffice/config.php and change:<br /><pre>$config['host']='/';</pre>
 +
# Edit /etc/groupoffice/globalconfig.inc.php and change:<br /><pre>$config['serverclient_server_url']="http://servermanager.yourdomain.com/";</pre>
 +
 
 +
Now it should work.
 +
 
 +
==Configurable options==
 +
There are a couple of things that you can configure for the servermanager.
 +
 
 +
You can add the following configuration variables to the Group-Office config file (default location: /etc/groupoffice/config.php):
 +
 
 +
With the following variable you can automatically add groups to newly created installations with the servermanager.
 +
You can define the "read" and the "manage" permissions for each module.
 +
<pre>
 +
$config['servermanager_auto_groups']=array(
 +
  'Group1'=>array(
 +
    'modules_read'=>'addressbook,calendar',
 +
    'modules_manage'=>'tickets'
 +
  ),
 +
  'Group2'=>array(
 +
    'modules_read'=>'addressbook',
 +
    'modules_manage'=>'tickets,calendar'
 +
));
 +
</pre>
 +
 
 +
==Backup the server==
 +
To be able to restore the servermanager completely you need to backup the following folders:
 +
 
 +
#/home/govhosts: The files stored in Group-Office
 +
#/home/vmail: The e-mail
 +
#/etc/groupoffice The configuration
 +
 
 +
A backup from all MySQL databases should also be made. The easiest would be to just backup the entire /home and /etc/directory.
 +
 
 +
A server can be restored by reinstalling Debian and the Group-Office servermanager. After that you can restore the folders and databases.
 +
 
 +
==Useful tools==
 +
 
 +
===Enable modules for all===
 +
Set module tools allowed for every installation (change allow to 0 to disallow):
 +
<pre>
 +
sudo /usr/share/groupoffice/groupofficecli.php -r=servermanager/installation/setAllowed -c=/etc/groupoffice/config.php -u=admin --allow=1 --module=tools
 +
</pre>
 +
 
 +
===Undelete an installation===
 +
<pre>
 +
sudo /usr/share/groupoffice/groupofficecli.php -r=servermanager/installation/undestroy -c=/etc/groupoffice/config.php --name=example.groupoffice.eu -u=admin
 +
</pre>
 +
 
 +
===Set config value for all===
 +
<pre>
 +
sudo /usr/share/groupoffice/groupofficecli.php -r=servermanager/installation/setConfigValue -c=/etc/groupoffice/config.php --name=smtp_server --value="newsmtp.example.com" -u=admin
 +
</pre>
 +
 
 +
===Run SQL on all===
 +
<pre>
 +
sudo /usr/share/groupoffice/groupofficecli.php -r=servermanager/installation/executeQuery --query="update em_accounts set smtp_host='newsmtp.example.com';" where smtp_host='oldsmtp.example.com'  -u=admin -c=/etc/groupoffice/config.ph
 +
</pre>
 +
 
 +
===Migrate an installation===
  
/var/www/groupoffice/customer.groupoffice.eu/
+
Export to target host
 +
<pre>
 +
sudo php /usr/share/groupoffice/groupofficecli.php -r=servermanager/installation/migrate --name=test1.intermesh.dev --target=root@localhost:/tmp/test/ -u=admin -c=/etc/groupoffice/config.php
 +
</pre>
  
In that directory there is a symlink called "groupoffice" that points to /usr/local/groupoffice. That is where the actual source of Group-Office is located.
 
There is also a folder called /usr/local/servermanager. This is the Group-Office source that also contains the servermanager module and the postfixadmin module.
 
  
The config.php file for each Group-Office installation can be found in /etc/groupoffice/<DOMAIN>/config.php. There is also a /etc/groupoffice/globalconfig.php. The configuration parameters in here apply to all installations.
+
Import on target host
 +
<pre>
 +
sudo php /usr/share/groupoffice/groupofficecli.php -r=servermanager/installation/importMigrated --source=/tmp/test/test1.intermesh.dev --name=test2.intermesh.dev -u=admin -c=/etc/groupoffice/config.php
 +
</pre>

Latest revision as of 13:03, 23 April 2013

Server manager

The server manager is a module that can manage other Group-Office installations on a Debian server. You need to have a domain and all subdomains point to the IP address of the server. For example *.groupoffice.eu. CustomerX will get the domain http://customerx.groupoffice.eu

By default the servermanager is installed at https://<IP_ADDRESS>/groupoffice


Installation

Become root on your Debian or Ubuntu system and type:

apt-get install groupoffice-servermanager

For the servermanager to work you need to raise the groupoffice-com user's permissions. It must be able to create new databases. Execute this SQL when you installed the groupoffice-servermanager package:

REVOKE ALL PRIVILEGES ON * . * FROM 'groupoffice-com'@'localhost';
GRANT ALL PRIVILEGES ON * . * TO 'groupoffice-com'@'localhost' WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;

After this you can add an installation with the name test.mydomain.com for example. If test.mydomain.com points to the server IP it should work. You can also test this by putting test.mydomain.com in your hosts file.

How is the server organized?

The server uses Apache 2, Postfix, Dovecot and Spamassassin

Apache and Group-Office

You should not have to edit any of these configuration files. Everything can be managed through the servermanager. This is just to explain how it works.

A virtual host for all Group-Office installations is created in: /etc/apache2/sites-enabled/000-groupoffice.

It uses a VirtualDocumentRoot (More info: http://httpd.apache.org/docs/2.0/mod/mod_vhost_alias.html) so any domain name pointing to the server IP will automatically work when it's created in the servermanager. SSL is also preconfigured with a test certificate using the apache module mod_ssl.

The VirtualDocumentRoot is located at /home/govhosts/. There's a directory for each domain in that directory. For example: /home/govhosts/customer.groupoffice.eu/.

The home directories and other data files are stored in /home/govhosts/customer.groupoffice.eu/data. The database is called groupoffice_groupoffice_eu.

In that directory there is a symlink called "groupoffice" that points to "/usr/share/groupoffice". That is where the actual source of Group-Office is located.

The config.php file for each Group-Office installation can be found in "/etc/groupoffice/<DOMAIN>/config.php". There is also a "/etc/groupoffice/globalconfig.php". The configuration parameters in here apply to all installations.

There is also a configuration file for the servermanager module: "/etc/groupoffice/servermanager.inc.php". It contains some default configuration values for new installations.

Apache and PHP errors are logged in /var/log/apache2/groupoffice_error_log

Postfix and Dovecot

Postfix is setup to use virtual accounts in MySQL like described in detail here:

http://www.group-office.com/wiki/Mailserver

All users are stored in the MySQL database "servermanager" and can be managed with the servermanager. A special perl script is used to handle autoresponse when a user is on vacation. Dovecot checks the quota in MySQL.

The actual mails are stored in /vmail/<domain>/<user>/

Changing the MySQL root password

Because Postfix and Dovecot connect to the MySQL database using the root password, you will have to edit the following configuration files:

  1. /etc/postfix/mysql_*
  2. /etc/dovecot/dovecot-sql.conf
  3. /etc/groupoffice/config.php

Moving the servermanager installation to servermanager.yourdomain.com

You might dislike the fact that the default installation sits at http://yourdomain/grouoffice/. Take the following steps to change this.

  1. Remove the alias from /etc/apache2/groupoffice.conf. Just add a # before Alias /groupoffice /usr/share/groupoffice
  2. Create the directory:
    mkdir /home/govhosts/servermanager.yourdomain.com
  3. Create a symlink:
    ln -s /usr/share/groupoffice /home/govhosts/servermanager.yourdomain.com/groupoffice
  4. Edit /etc/groupoffice/config.php and change:
    $config['host']='/';
  5. Edit /etc/groupoffice/globalconfig.inc.php and change:
    $config['serverclient_server_url']="http://servermanager.yourdomain.com/";

Now it should work.

Configurable options

There are a couple of things that you can configure for the servermanager.

You can add the following configuration variables to the Group-Office config file (default location: /etc/groupoffice/config.php):

With the following variable you can automatically add groups to newly created installations with the servermanager. You can define the "read" and the "manage" permissions for each module.

$config['servermanager_auto_groups']=array(
  'Group1'=>array(
    'modules_read'=>'addressbook,calendar',
    'modules_manage'=>'tickets'
  ),
  'Group2'=>array(
    'modules_read'=>'addressbook',
    'modules_manage'=>'tickets,calendar'
));

Backup the server

To be able to restore the servermanager completely you need to backup the following folders:

  1. /home/govhosts: The files stored in Group-Office
  2. /home/vmail: The e-mail
  3. /etc/groupoffice The configuration

A backup from all MySQL databases should also be made. The easiest would be to just backup the entire /home and /etc/directory.

A server can be restored by reinstalling Debian and the Group-Office servermanager. After that you can restore the folders and databases.

Useful tools

Enable modules for all

Set module tools allowed for every installation (change allow to 0 to disallow):

sudo /usr/share/groupoffice/groupofficecli.php -r=servermanager/installation/setAllowed -c=/etc/groupoffice/config.php -u=admin --allow=1 --module=tools

Undelete an installation

sudo /usr/share/groupoffice/groupofficecli.php -r=servermanager/installation/undestroy -c=/etc/groupoffice/config.php --name=example.groupoffice.eu -u=admin

Set config value for all

sudo /usr/share/groupoffice/groupofficecli.php -r=servermanager/installation/setConfigValue -c=/etc/groupoffice/config.php --name=smtp_server --value="newsmtp.example.com" -u=admin 

Run SQL on all

sudo /usr/share/groupoffice/groupofficecli.php -r=servermanager/installation/executeQuery --query="update em_accounts set smtp_host='newsmtp.example.com';" where smtp_host='oldsmtp.example.com'  -u=admin -c=/etc/groupoffice/config.ph

Migrate an installation

Export to target host

sudo php /usr/share/groupoffice/groupofficecli.php -r=servermanager/installation/migrate --name=test1.intermesh.dev --target=root@localhost:/tmp/test/ -u=admin -c=/etc/groupoffice/config.php


Import on target host

sudo php /usr/share/groupoffice/groupofficecli.php -r=servermanager/installation/importMigrated --source=/tmp/test/test1.intermesh.dev --name=test2.intermesh.dev -u=admin -c=/etc/groupoffice/config.php