Difference between revisions of "Print"
(19 intermediate revisions by 7 users not shown) | |||
Line 1: | Line 1: | ||
{{services |
{{services |
||
+ | |ip_addr = 128.153.145.200 |
||
− | |contact_person = [[User:Vaillap|Peter Vaillancourt]] & [[User:woodsj|Jake Woods]] |
||
+ | |contact_person = Alex Macri |
||
− | |last_update = ''unknown'' |
||
+ | |last_update = January 2016 |
||
− | |host_vm = [[Print]] |
||
− | | |
+ | |host_vm = [[DubsDot]] |
+ | |vm_host = [[7 Grand Dad]] |
||
|services = Print |
|services = Print |
||
− | |category = |
+ | |category = Service |
− | |handoff = |
+ | |handoff = yes |
}} |
}} |
||
{{VM |
{{VM |
||
|hostname=[http://print.cslabs.clarkson.edu print.cslabs.clarkson.edu] |
|hostname=[http://print.cslabs.clarkson.edu print.cslabs.clarkson.edu] |
||
− | |maintainer= [[User: |
+ | |maintainer= [[User:Northug|Graham Northup]] and [[User:Lannonbr|Benjamin Lannon]] |
− | |operating_system = [[wikipedia: |
+ | |operating_system = [[wikipedia:Debian|Debian Jessie]] (8) amd64 |
− | |ldap= |
+ | |ldap=Yes |
|development_status=Stable |
|development_status=Stable |
||
|status=Running |
|status=Running |
||
− | | |
+ | |vm_host=[[7 Grand Dad]] |
}} |
}} |
||
==Purpose== |
==Purpose== |
||
− | The print |
+ | The print VM is a web-based printing interface that offers accounts to COSI members. Users can register accounts using their Clarkson usernames and print to the CSLabs Printer using the web interface. This service supports only Open Source file types, promoting the [[Guiding Principles]] of COSI. See [[Printing]] for more information on this process. |
==Technical Information== |
==Technical Information== |
||
− | The machine uses |
+ | The machine uses CUPS (specifically the <code>lp</code> command) to interface with the printer, PyKota to handle quotas, and uWSGI and Flask (in a Python backend) to handle the web interface. The source code for the web interface is available through the [https://github.com/COSI-Lab/print.dev/tree/wsgi COSI-Lab GitHub account, under "print.dev" in the "wsgi" branch]. |
===Set up process=== |
===Set up process=== |
||
+ | The critical software components of this setup are: |
||
− | To interface with the printer, cupsys and cupsys-client were installed. The packages python-mysqldb, python-egenix-mxdatetime, python-pysnmp4, pkpgcounter, python-reportlab, and subversion were installed as dependencies for PyKota. PyKota 0.07 was installed from source following the instructions on [http://pykota.com] and in the README. Finally, apache2, php5, libapache2-mod-php5, mysql-server, mysql-client, and php5-mysql were installed for the web services. The configuration files have been omitted because the primary changes from the defaults were to set passwords. |
||
+ | |||
+ | * Python version 2 (probably > 2.5), accessible through various <code>python2.''x''</code> Debian packages. |
||
+ | * uWSGI and its Python2 support, packages <code>uwsgi</code> and <code>uwsgi-plugin-python</code>. |
||
+ | * Flask, a Python module available in <code>python-flask</code>. |
||
+ | |||
+ | When this is done, call <code>test.sh</code> in the repository's root directory--it includes a sudo that will (typically) be elided if you're already the superuser. For long-term sessions or stable builds, you may consider running this in a long-term <code>tmux</code> session, possibly set up by an init script (the necessary script is left as an exercise to the reader). |
||
===Manual Maintenance=== |
===Manual Maintenance=== |
||
+ | |||
+ | First and foremost, print now has a console, located in /srv/wsgi/print as console.py. For best results, run it from within the directory it resides. ''Yes, it can create users and edit passwords,'' making the below redundant for all but the most involved of tasks. To see what the console can do, type ''help'' in it. |
||
Creating a user: |
Creating a user: |
||
Line 53: | Line 62: | ||
Pull balance information: |
Pull balance information: |
||
<code><pre> |
<code><pre> |
||
+ | $ pkusers -L # All users (quite probably a lot) |
||
− | $ pkusers -L |
||
+ | $ pkusers -L <<USERNAME>> # A user by name |
||
</pre></code> |
</pre></code> |
||
Line 59: | Line 69: | ||
<code><pre> |
<code><pre> |
||
$ pkusers --delete -- <<USERNAME>> |
$ pkusers --delete -- <<USERNAME>> |
||
+ | </pre></code> |
||
+ | |||
+ | Passwords are managed exclusively through code in the web interface; to access this, enter the terminal at the repository root and drop into a root python shell (with <code>sudo python</code> or <code>sudo python2.''x''</code>, of course): |
||
+ | <code><pre> |
||
+ | >>> import userdb, hashlib |
||
+ | >>> u = userdb.User.FromName('<<USERNAME>>') |
||
+ | >>> u.password = hashlib.sha512('<<PASSWORD>>').hexdigest() |
||
+ | >>> u.Update() |
||
</pre></code> |
</pre></code> |
||
==Development== |
==Development== |
||
+ | The development print server is being transitioned here; as such, no further separate development branch exists, but further bugfixes and feature additions will nonetheless continue to be added (live, as it were). |
||
− | A new print server is currently being developed to improve upon the current server. For more information see [[Print Development]]. |
||
+ | |||
+ | [[Category:Web Service]] |
Latest revision as of 20:42, 29 August 2017
IP Address(es): | 128.153.145.200 |
Contact Person: | Alex Macri |
Last Update: | January 2016 |
VM Host (Physical): | 7 Grand Dad |
Host VM: | DubsDot |
Services: |
Hostname: | print.cslabs.clarkson.edu |
Operating system: | Debian Jessie (8) amd64 |
LDAP Support: | Yes |
Development Status: | Stable |
Status: | Running |
Purpose
The print VM is a web-based printing interface that offers accounts to COSI members. Users can register accounts using their Clarkson usernames and print to the CSLabs Printer using the web interface. This service supports only Open Source file types, promoting the Guiding Principles of COSI. See Printing for more information on this process.
Technical Information
The machine uses CUPS (specifically the lp
command) to interface with the printer, PyKota to handle quotas, and uWSGI and Flask (in a Python backend) to handle the web interface. The source code for the web interface is available through the COSI-Lab GitHub account, under "print.dev" in the "wsgi" branch.
Set up process
The critical software components of this setup are:
- Python version 2 (probably > 2.5), accessible through various
python2.x
Debian packages. - uWSGI and its Python2 support, packages
uwsgi
anduwsgi-plugin-python
. - Flask, a Python module available in
python-flask
.
When this is done, call test.sh
in the repository's root directory--it includes a sudo that will (typically) be elided if you're already the superuser. For long-term sessions or stable builds, you may consider running this in a long-term tmux
session, possibly set up by an init script (the necessary script is left as an exercise to the reader).
Manual Maintenance
First and foremost, print now has a console, located in /srv/wsgi/print as console.py. For best results, run it from within the directory it resides. Yes, it can create users and edit passwords, making the below redundant for all but the most involved of tasks. To see what the console can do, type help in it.
Creating a user:
$ pkusers --add --limitby balance --balance 100 <<USERNAME>>
$ edpykota --add --printer CSLabsPrinter <<USERNAME>>
$ mysql pykota
mysql> UPDATE users SET password=<<MD5ed PASSWORD>> WHERE username=<<USERNAME>>
Increasing the balance for a user (Omit the <<USERNAME>> field to make changes to all users):
$ pkusers --balance +<<NUM PAGES>> --comment "<<REASON FOR INCREASE>>" <<USERNAME>>
Reset Balance for beginning of the Semester:
$ pkusers -b 200 -C "Reset for Semester"
Pull balance information:
$ pkusers -L # All users (quite probably a lot)
$ pkusers -L <<USERNAME>> # A user by name
Delete user (do not use unless absolutely necessary):
$ pkusers --delete -- <<USERNAME>>
Passwords are managed exclusively through code in the web interface; to access this, enter the terminal at the repository root and drop into a root python shell (with sudo python
or sudo python2.x
, of course):
>>> import userdb, hashlib
>>> u = userdb.User.FromName('<<USERNAME>>')
>>> u.password = hashlib.sha512('<<PASSWORD>>').hexdigest()
>>> u.Update()
Development
The development print server is being transitioned here; as such, no further separate development branch exists, but further bugfixes and feature additions will nonetheless continue to be added (live, as it were).