Skip to content

is210-faculty/development-environment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Student Development Environment Tookit

This project provides the resources to create a working development environment for students in the Information Systems and Data Analytics programs at the City University of New York School of Professional Studies(CUNY SPS [1]).

While the use of this toolkit is optional, students are nontheless strongly encouraged to adopt it, where possible, as it will save considerable effort in the creation and configuration of working development environme

Overview

The Student Development Environment Toolkit is a virtualized development platform comprised of several prominent technologies, seamlessly layered to create a functional development experience. While it would be beyond the scope of this section to detail the various use-cases of each component, their use in this project will be briefly outlined below.

VirtualBox

The core of a virtualized development platform is a virtual machine [2], which is, in essence, a small operating system with its own users, networking, hard drives, memory, etc living inside your primary operating hardware. The benefits of using virtual machines for development include:

  • Isolation and sandboxing of programs and developed code to prevent potentially dangerous or system-altering programs from harming the host computer.
  • Providing access to tools that may not be available on the host os.
  • Providing the ability to target code development on other operating systems (eg, if the code must be developed on a Windows machine but run on a Linux server).

In the case of this project, our virtual machine [2] will be built upon the VirtualBox [3] virtualization platform. It's not the most performance-oriented virtualization platform available, however, it is remarkably consistent across various operating systems and versions and a favorite of developers across the world.

Vagrant

Though VirtualBox [3] is the virtualization platform and must be installed for this to work, you won't often interact with it directly. Instead, we'll be using a tool called Vagrant [4] to interact with our virtual machine [2]. Vagrant [4] is a modern tool for configuring and managing virtual machines in a developer-centric manner.

In addition to the benefits of virtual machines listed above, Vagrant [4] adds two key benefits to the mix: destructability and consistency. Virtual machines managed by Vagrant [4] may be created or destroyed quickly and easily and with a high degree of reliability that each new instance of a particular virtual machine is, initially, exactly the same as the last.

In the context of your courses, you might find these attributes surprisingly helpful in the event your early programs cause irrevocable changes to your development environment. With Vagrant [4] you can easily destroy the old environment and create a new one on the fly.

Git

If you're reading this file, there's a good chance you've already installed Git [5] or have visited GitHub [6]. Git [5] is an industry-leading version control [7] software that allows code and project assets to be worked-on in a collaborative fashion with changes tracked and distributed through the tool.

Within the context of this project, the Vagrant [4] configuration files that instruct Vagrant [4] how-to setup your new development environment are distributed through Git [5].

While it is possible to distribute and install these files without Git [5], Microsoft Windows users, in particular, may wish to use it as the Windows Git [5] installer includes several other helpful software packages for interacting with Vagrant [4].

Linux

Lastly, the development environment itself is a version of the Linux [8] operating system. Linux is the world's leading server operating system and is the operating system of choice for many types of development especially with open source tools such as `Python`_. Linux has recently also gained fame as the world's leading mobile operating system as its many variants include Google Android [9].

In our case, the version of Linux [8] being used is a low-memory variant of the popular Ubuntu [10] operating system known as Lubuntu [11]. While there are less resource-intensive operating systems available, Lubuntu [11] was chosen to provide the easiest transition to those unfamiliar with such concepts as consoles [12] or headless [13] computers.

Requirements

To run this development environment you must have at least:

  • A computer on which you are an administrator

  • 768MB of free memory

    To determine the amount of free memory available to your system, fully power off your computer (don't just suspend it).

    Now, turn on your computer, log-in, and wait for for about ten (10) minutes for all the normal software to load without explicitly starting up any other software. Now, follow the directions for your given operating system on determining available (unused) memory. These directions will vary from operating system to operating system.

    For example, Windows users may follow the following:

    http://windows.microsoft.com/en-us/windows7/view-how-much-memory-your-computer-is-using

    Whereas OS X users may follow this artcile:

    http://support.apple.com/en-us/HT2353

    Linux users may use the free command to list available memory.

  • At least, 10GB of free hard-drive / disk space

    As with the memory requirements above, you should follow the directions specific to your operating systems.

  • A multi-core CPU

Installation

To install the Student Development Environment Toolkit, you must first download and install the three primary software tools used to provision your development environment.

  1. Begin by following the directions to download the Git [5] software from the Git downloads page.

    Students should follow the installation instructions for their operating system. Defaults are almost always fine and should be left as-is.

  2. Next, install VirtualBox [3] by visiting the VirtualBox downloads page [14] to download VirtualBox [3].

    After downloading, install VirtualBox [3] following the appropriate directions for your operating system and leaving the defaults as-is.

  3. Finally, install Vagrant [4] by visiting the Vagrant downloads page [15] to download Vagrant [4].

    After downloading, install Vagrant [4] following the appropriate directions for your operating system and leaving the defaults as-is.

Getting the Development Environment

At this point you have all of the tools necessary to create and run virtual machines but haven't yet downloaded the CUNY SPS Student Development Environment Toolkit. There are two options for downloading the environment, each with specific strengths:

Git

The preferred way to download the Student Development Environment Toolkit is through Git [5]. By doing so through Git [5], any updates to the environment issued by your instructor may be more easily integrated in the future. To download the Student Development Environment Toolkit via Git [5]:

  1. Open a console or terminal window in the folder where you want to store your development environment. As was discussed in the requirements section, make sure this location has at least 10GB of free disk space.

    Mac OS X and Linux users may use the terminal (aka console) and the cd command to navigate to the appropriate file or folder.

    Windows users can use Windows Explorer to go to the correct location and can right-click in the folder. Select the git bash option to open a console window.

  2. If you haven't already done so, set up your git username and email address as follows, replacing the name and email address appropriately.

    $ git config --global user.name "John Doe"
    $ git config --global user.email "[email protected]"

    You'll only ever need to do this step once.

  3. Download the latest version of the Student Development Environment Toolkit from its GitHub [6] repository.

    $ git clone https://github.com/is210-faculty/development-environment.git

    This will create a folder called development-environment on your filesystem and download the appropriate configuration files. To enter that folder, simply type:

    $ cd development-environment

Direct Download

If you are unable to download the development environment via Git [5], you may visit the project's releases page [16] on GitHub [6] and downloading the most recent version as a zipfile or tarball.

Unzip or untar the archive into your desired project folder.

Running the First Time

When you run your virtual machine the first time, it downloads your base Lubuntu [11] operating system then downloads, installs, and configures several hundred additional pieces of software before the machine is ready to use.

  1. Begin by opening a console in the same folder as your development environment. If you list the contents of the directory, you should see your VagrantFile, eg:

    $ ls ./
    bootstrap  data  LICENSE  README.rst  salt  Vagrantfile
  2. From here, starting up your new environment is just as simple as typing:

    $ vagrant up

    At this point, Vagrant will start working to download and install your environment. Part-way through it will open a VirtualBox window with a generic command-line open on it but you can safely wait until you see a regular desktop login. Once you have a desktop (with a background and mouse response) in your VirtualBox window, you can start using your development environment.

Working With Your Development Environment

Working with your development environment in Vagrant is quite straightforward. All commands are issued via the console from the same location as your Vagrantfile (exactly as with the first-run).

To start your development environment, type:

$ vagrant up

Similarly, to shut it down, type:

$ vagrant halt

If you have any need to destroy and re-create your sandbox environment, simply type:

$ vagrant destroy

On the next vagrant up the environment will be restarted.

Warning

On occasion, you may want to reboot your virtual machine either because you've received a prompt to do so or for personal reasons. Vagrant will not be able to recover from a reboot issued from inside the virtual machine. Instead, exit use the vagrant halt and vagrant up commands from your Vagrantfile directory to turn the machine off and back-on.

User Credentials

From your first Vagrant run you'll notice that the virtual machine is already configured to automatically log you in. You may, however, have occasion to know your username and/or password inside the virtual machine. These have not been changed from the Vagrant defaults and are:

username: vagrant
password: vagrant

Data Persistence

If you take note of the contents of your development-environment folder, you can see a folder called data.

$ ls ./
bootstrap  data  LICENSE  README.rst  salt  Vagrantfile

This folder stores all of the permanent data of your virtual machine. Any files created by your user in your virtual machine will be saved in this folder and accessible even when the virtual machine has been shut-down or destroyed. Similarly, files placed in this folder will be available in your virtual machine as soon as they're placed there.

Upgrading Your Student Development Environment

From time to time your instructor may wish to add things to the Student Development Environment Toolkit that were not included with the original version you installed at the outset of this course. Luckily, if you used Git to install your Student Development Environment Toolkit, this process is painless and fast. Just follow these easy steps to upgrade:

  1. In your host machine, open a terminal window in the same directory as your Vagrantfile. This is the same folder where you execute vagrant up and vagrant halt to start-up and shut-down your virtual machine, respectively

    If you list the contents of the directory, you should see your Vagrantfile.

    $ ls ./
    bootstrap  data  LICENSE  README.rst  salt  Vagrantfile
  2. Next, pull the changes from the original source repository that has been updated by your instructor.

    $ git pull origin master
    From github.com:is210-faculty/development-environment
     * branch            master     -> FETCH_HEAD
  3. Next, start your vagrant box, if it hasn't already been started with a vagrant up.

    It's perfectly fine if your vagrant box was already running!

  4. Inside the vagrant box, open a terminal and type the following command:

    $ sudo salt-call state.highstate

    This will initiate the orchestration tool, Salt, to finish configuring your system.

Congratulations! Your environment is now up-to-date!

Conclusion

If you've made it this far, you should have a fully-functioning development environment. Try clicking around or running your first program and enjoy!

References

[1]http://sps.cuny.edu/
[2](1, 2, 3) https://en.wikipedia.org/wiki/Virtual_machine
[3](1, 2, 3, 4, 5) https://www.virtualbox.org/
[4](1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) https://www.vagrantup.com/
[5](1, 2, 3, 4, 5, 6, 7, 8, 9, 10) http://git-scm.com/
[6](1, 2, 3) https://github.com/
[7]https://en.wikipedia.org/wiki/Revision_control
[8](1, 2) https://en.wikipedia.org/wiki/Linux
[9]http://www.android.com/
[10]http://www.ubuntu.com/
[11](1, 2, 3) http://lubuntu.net/
[12]https://en.wikipedia.org/wiki/System_console
[13]https://en.wikipedia.org/wiki/Server_%28computing%29
[14]https://www.virtualbox.org/wiki/Downloads
[15]https://www.vagrantup.com/downloads.html
[16]https://github.com/is210-faculty/development-environment/releases