--- a/elog2labfolder/installation_cups.rst Wed Feb 07 16:53:37 2018 +0100
+++ b/elog2labfolder/installation_cups.rst Tue Mar 27 16:07:14 2018 +0200
@@ -1,11 +1,19 @@
Printing via CUPS and attaching files to labfolder logbooks
===========================================================
-If you want to print a webpage as PDF and send it to onf of labfolder's logbooks you could create a CUPS printer for each logbook that uses the labfolder API to attach this PDF to a newly created entry. First, you need to install CUPS on the virtual machine that runs labfolder::
+Follow this guide to set up CUPS virtual printers to be able to print webpages and pictures/files (PDF, PNG, JPG, PS) to one of labfolder's logbooks, thus, creating a new entry with an attachment. If you are an admin of the labfolder VM read the section :ref:`section_cups_admin`. Users of labfolder read the section :ref:`section_cups_user`.
+
+
+.. _section_cups_admin:
+
+Set up CUPS as labfolder admin
+------------------------------
+
+First, you need to install CUPS on the virtual machine that runs labfolder::
sudo apt-get install cups cups-client cups-bsd
-Next, you need to configure ``/etc/cups/cupsd.conf``. This is how it looks like on *lftest*::
+Next, configure ``/etc/cups/cupsd.conf``::
# Sample configuration file for the CUPS scheduler. See "man cupsd.conf" for a
# complete description of this file.
@@ -20,7 +28,7 @@
# Administrator user group...
SystemGroup lpadmin
- ServerAdmin weiher@fhi-berlin.mpg.de
+ ServerAdmin <name>@fhi-berlin.mpg.de
HostNameLookups On
ServerAlias *
@@ -85,38 +93,39 @@
... # probably as in the original
</Policy>
-Now, you need to create a file system that will hold all CUPS printers, For example, the printers belonging to the logbooks *FEL/operating* and *FEL/installation* could be put in ``/usr/local/labfolder/printers/FEL``. Copy the lplisten script from the git repository ``https://github.molgen.mpg.de/weiher/elog2labfolder.git`` to ``/usr/local/labfolder/printers/FEL/operating`` and to ``.../FEL/installation``. Also, create a pipe that redirects the printer input to the lplisten script::
+Change the *Server Admin*'s e-mail address and the server that shall be listened to (see the ``Listen`` statement). Set ``FileDevice Yes`` in ``/etc/cups/cups-files.conf``. Now, create a directory where all printers will go, e.g. ``/usr/local/labfolder/printers``.
- /usr/local/labfolder/printers/FEL/operating$ mkfifo prnt
-
-Adapt rights and ownership of lplisten and prnt::
+Get the package for creating new printers from git::
- $ chmod 744 lplisten
- $ chmod 666 prnt
- $ chown lp:lpadmin lplisten prnt
+ labfolder@lftest:~$ git clone https://github.molgen.mpg.de/weiher/cupsPrinters
+ labfolder@lftest:~$ ls
+ cupsPrinters labfolder
-Add the labfolder user to the lpadmin group in /etc/group::
+The only file you need to adapt is ``newPrinter.sh``. It is not a must but it is suggested to name the printers like the projects. For example, the FEL projects *operating* and *installation* could be placed at ``.../printers/FEL/operating`` and ``.../printers/FEL/installation``. Execute the script with sudo rights::
- lpadmin:x:115:labfolder
+ labfolder@lftest:~/cupsPrinters$ sudo ./newPrinter.sh
-Now, create the CUPS printers via the web interface at ``http://lftest.rz-berlin.mpg.de:631/`` (as configured in cupsd.conf). For example, the *operating* printer points at ``FEL/operating/prnt``. The ready configured printer looks like this in the web interface:
+To prevent ``DENIED`` errors from apparmor install and set the following and restart the CUPS server::
-.. image:: _static/cups_print_operating.png
- :width: 100 %
- :align: center
+ $ sudo apt-get install apparmor-utils apparmor-profiles
+ $ sudo aa-complain cupsd
+ $ sudo service cups restart
-To prevent ``DENIED`` errors from apparmor install and set the following::
+In case you need to debug some logfiles can be found here: */var/log/syslog*, */var/log/cups/error_log* and */var/log/cups/acces_log*
+
+One last change is that you need to once add a user named *Printer Print* (firstname lastname) to the labfolder database. This can be done manually inside the DB by this command::
- sudo apt-get install apparmor-utils apparmor-profiles
- sudo aa-complain cupsd
-
-Restart the CUPS server::
+ $ mysql -u root -p
+ Enter password:
+ ...
+ mysql> use labfolder;
+ mysql> INSERT INTO user (email, password, firstname, lastname, signupTimestamp, maxStorage) VALUES ('printer@fhi-berlin.mpg.de', '91a13f2aba4a35b00c35dfacadd1d75f4a5171dfa7a465fca9c40e6b007ce982', 'Printer', 'Print', '2018-03-21 10:54:00', '10000000');
- $ service cupsd restart
+
+.. _section_cups_user:
-Start the lplisten script in the background::
-
- /usr/local/labfolder/printers/FEL/operating$ ./lplisten &
+Printing to labfolder projects
+------------------------------
The last thing you need to do is to set up a printer *operating* on your local machine. In Ubuntu Gnome hit Alt+F2 keys and enter ``system-config-printer``. In this printer config interface add a new printer *operating* as follows:
@@ -124,26 +133,32 @@
:width: 70 %
:align: center
+
.. image:: _static/create_local_printer02.png
:width: 70 %
:align: center
+
.. image:: _static/create_local_printer03.png
:width: 70 %
:align: center
+
.. image:: _static/create_local_printer04.png
:width: 70 %
:align: center
+
.. image:: _static/create_local_printer05.png
:width: 70 %
:align: center
+
.. image:: _static/create_local_printer06.png
:width: 70 %
:align: center
+
.. image:: _static/create_local_printer07.png
:width: 70 %
:align: center