Skip to content

Instantly share code, notes, and snippets.

@qnkxsovc
Created April 13, 2017 00:13
Show Gist options
  • Save qnkxsovc/ab1530dff26d5b049f49327b856867e1 to your computer and use it in GitHub Desktop.
Save qnkxsovc/ab1530dff26d5b049f49327b856867e1 to your computer and use it in GitHub Desktop.
#PolkHacks Technology Guide

#PolkHacks Technology Guide

Connecting to the WiFi

The WiFi login involves two networks, "POLKSTATE-GUESTS" and "POLKSTATE-SECURE." Connect using the following steps:

  1. Connect to the network “POLKSTATE-GUEST”
  2. You will be redirected to a login portal. Please enter your contact information, including your phone number and email. You will not receive your login code through SMS if you do not at the country code to your phone number.
  3. Once you receive the code, connect to the network “POLKSTATE-SECURE” using that code as your access key.

Scaffolding our template applications

Our templates ("generators") are built using Yeoman. Yeoman and associated generators are Node packages.

  1. To install Yeoman, use:

     npm install -g yo
    
  2. We provide templates for AngularJS, ReactJS, and BackboneJS. They are as close to pre-existing boilerplate packages as possible, but they have been modified to include a configuration file for Docker ("Dockerfile") and a few more command line arguments. Install them using:

     npm install -g generator-docker-angular // For angular
     npm install -g generator-docker-backbone // For backbone
     npm install -g generator-docker-react // For react
    
  3. Once your generator of choice is installed, scaffold an application with:

     yo docker-angular // For angular
     yo docker-backbone // For backbone
     yo docker-react // For react
    
  4. Once the application files are in place, you can start the webservers using the command below:

     // Note: In both of the following cases, use the --port 80 switch to run the servers on port 80 
     // and the --production switch to have the web server listen on 0.0.0.0 instead of localhost.
     grunt serve // For angular and backbone.
     npm run // For react
    

Making Docker containers from your application source files:

To host the application on DigitalOcean, please package them into Docker containers. The Yeoman generators all include pre-made Docker configuration files, so packaging is very simple:

docker build -t "<teamname>/<appname>" "path/to/Dockerfile" // This will allow you to push the application the the repository associated with the <teamname> account in the next step.
docker push "<teamname>/<appname>" // You will be asked to login using your team-specific credentials.

Hosting your Docker container in DigitalOcean

To perform this step, you will need to have your application packaged and pushed to Docker, using the naming convention "/."

  1. Login to DigitalOcean using your team-specific credentials.

  2. Click the green "Create Droplet" button. Watch out for the following options to set in the "Create Droplet" dialog:

    1. In the "Choose an image" section, click the "One-click apps" slider and select the "Docker 17.03.0-ce on 16.04" option.
    2. In the "Choose a size" section, click the "$5/mo" pricing option (this will charge the prepaid credit for your accoint).
    3. In the "Choose a datacenter region" section, select any of the New York options.
    4. In the "Add your SSH keys" section, you can add an SSH key which will allow you to SSH into the application container. If you choose not to make the key, you will have to reset the root password manually, and then retrieve it from your team's email.
  3. Wait for your Droplet to be created. Once it is ready, take a note of the Droplet's IP address.

  4. If you did not provide an SSH key while creating the Droplet, navigate to the "Access" section in the Droplet's configuration and click the "Reset root password" button. Retrieve the new root password from your team's email inbox.

  5. Use an SSH client to authenticate to the "root" account at the Droplet's IP address.

  6. Once you connect to the Droplet, retrieve your application package from the Docker repository using this command:

     docker -p 80:80 run "<teamname>/<appname>" // The -p argument allows the web-server to listen for HTTP requests.
    
  7. At this point you can safely terminate your SSH connection (containers run in the docker daemon and will persist afterwords).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment