Tux Web Services

Tagged with: tux

The Tux ecosystem has several web services available, designed to meet different needs for academic coursework. Their general usage is explained below.

Public Services
(accessible from anywhere in the world)

Plain HTML and PHP:

Plain HTML sites with PHP can be served directly from the Tux web server, www.cs.drexel.edu (a new alias may come with more CCI-inclusive naming). This is an Apache web server, which loads any information in your home directory under the public_html directory. This directory must be world readable and executable (eg 755 permissions) in order for the web server to serve the content from it. Also, your Tux home directory must be world executable (711 permissions) in order for the web server to have permission to see your public_html folder. 

To access these sites, navigate to https://www.cs.drexel.edu/~abc123 where abc123 is your Drexel username.

To run cgi-bin applications using PHP, place the appropriate files in public_html/cgi-bin. These can be accessed at https://www.cs.drexel.edu/~abc123/cgi-bin/ where abc123 is your Drexel username.

Please also see:

Please note the steps prior to this. 

  • SSH into your Tux account 
  • Create a folder named public_html "mkdir public_html
  • You can quickly scp your files from your host machine to your vm.
    CD into your windows directory with the file location.
    Then enter command:
    scp index.html abc123@192.1.xxx.xx~/ 
    This will be your tux IP. You can get this by typing:
    nmcli
    ...or....
    ip addr show
    Next, you'll want to make sure your directory has the right permissions. You can do this by:
    chmod 711 public_html

Private Services
(only available on campus or through VPN)

Databases

CCI hosts several databases. Currently, available options are MariaDB and MongoDB. Other database systems may be developed, depending on course requirements.

Currently, all database access must be granted on a per-user level, with dedicated login information. Professors may request access for their students at least two weeks before the start of the term in which they are needed, and individuals may request access for class projects with approval from their professor. Requests should be sent to ihelp@drexel.edu and include the subject line "Request for database - course #". Please indicate which database type you would like when requesting the database, and provide an indication as to when the database will no longer be needed. Typically, this will be assumed to be the end of the term.

Jupyterhub

Jupyterhub is provided as a way of running Jupyter notebooks. To use Jupyterhub, you must first log in to the Jupyterhub server over SSH - from Tux, you can just type "ssh jupyterhub" and you should connect automatically and be prompted for your Drexel/Tux password. Once you've connected, you can access the web interface at https://jupyterhub.cci.drexel.edu and login with your Drexel/Tux credentials. Within Jupyterhub, you can choose which notebook to open from your home directory.

Here you can find more detailed instructions on how to connect to Jupyterhub.

Node.js and Python app port numbers:

For Node and Python sites, a port number must be assigned to your app. To get a port number, visit https://www.cs.drexel.edu/~bjb344/portman.php

Node.js

Node is available on node.cci.drexel.edu. Sites are managed through pm2, a production-grade Node.js server, which can track changes in files, automatically restart services, remain running when logged out, and provide centralized logs.

To start a Node application, log in via SSH to node.cci.drexel.edu (either through VPN or through Tux) and cd to the directory where your node application lives. Once there, you can run the command 

pm2 start <<app-name.js>>

You can append the option --watch to have pm2 monitor the file for changes, allowing you to edit your code on Tux and it should automatically reload when you save your changes. To see logs, run the command 

pm2 logs

To exit the log viewer, type ctrl-c.


When you're done with your project, please run the command 

pm2 stop <<app-name.js>>

Accessing Node.Js


When you're on your tux, or windows command line you'll essentially want to SSH into your node.js server. The way you'll do this is 

abc123@node.cci.drexel.edu

Navigating 


Once in you'll navigate to your application directory. You can do this by CD'ing (change directory) into where your folder/application is located at. 

Starting Your Node.js Application:


Remember the commands above? Perfect, you'll need to be properly cd 'ed and then you can enter pm2 start <<app-name.js>> in order to start your application. 


Or, you could have write the command --watch to have pm2 monitor that file for changes. Ergo, whenever you edit your code on another machine such as tux,  pm2 can automatically reload your application whenever you save changes. 

pm2 start <<app-name.js>>
pm2 <<app-name.js>> --watch

Viewing Logs:

If you want to view your logs that's generated by the node.js application. You can enter pm2 logs it essentially allows you to see what's going on in the application.  pm2 logs can be ran from anywhere in your directory. 

Example:  abc123@tux:~/Downloads/Code/project/

Run ls (lists files within a folder) , then type pm2 logs

pm2 logs


Stopping Application:


Enter pm2 stop <<app-name.js>> (remember this is the name of whatever your application is named)

pm2 stop <<app-name.js>>

to stop running your app.


Python apps/frameworks (uWSGI)

Python apps and frameworks with a uWSGI interface can be run on the uWSGI server, temporarily hosted at bvm48.cci.drexel.edu.

To create a uWSGI site, create a directory inside your public_html directory on Tux called "uwsgi". Inside of this directory, make an INI file like the following. Replace <<PORT>> with the port number you've been assigned by your professor, or gotten by visiting https://www.cs.drexel.edu/~bjb344/portman.php.  Replace abc123 with your username, and project.py with the name of your main Python file.

[uwsgi]
http-socket = 10.246.250.148:<<PORT>>
chdir = /home/abc123/public_html/uwsgi/
wsgi-file = project.py
processes = 4
threads = 2

To access your site, you'll need to be connected to VPN. Then, visit http://bvm48.cci.drexel.edu:<<PORT>>, where <<PORT>> is the port you specified in the ini file you created above.


For more information, visit https://uwsgi-docs.readthedocs.io/en/latest/WSGIquickstart.html . This includes instructions on making ini files for specific frameworks.