Provides a web-based interface for managing lab assistants. Allows TAs to configure seections for lab assistants to sign up for along with facilitating the check in process.
Set up VirtualBox, Vagrant & Homestead
Download and install virtual box: https://www.virtualbox.org/wiki/Downloads
Download and install vagrant: https://www.vagrantup.com/downloads.html
Install the Homestead Vagrant Box:
vagrant box add laravel/homestead
Install Homestead
cd ~
git clone https://github.com/laravel/homestead.git Homestead
# Clone the desired release...
git checkout v6.1.0
# If on Mac / Linux...
bash init.sh
# If on Windows...
init.bat
Update Homestead.yaml
to point to where you are cloning this repo. E.g:
folders:
- map: ~/Projects/Check-In
to: /home/vagrant/Code/Check-In
sites:
- map: la.local
to: /home/vagrant/Code/Check-In/public
php: "5.6"
Append the following lines to after.sh
:
# Install MySQL Server, PHP 5.6 and required packages
sudo apt update
sudo apt install -y mysql-server php5.6-common php5.6-cli php5.6-curl php5.6-fpm php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml
# Use PHP5.6 as system default PHP
sudo update-alternatives --set php $(which php5.6)
# Change any PHP7 references in Nginx sites
sudo sed -i -E 's/php7[.0-9]*?/php5.6/g' /etc/nginx/sites-available/*
# Change PHP5.6 FPM to run under vagrant user (necessary for writing data to Check-In folder)
sudo sed -i -e 's/www-data/vagrant/g' /etc/php/5.6/fpm/pool.d/www.conf
# Reload config changes
sudo service nginx restart
sudo service php5.6-fpm restart
Set up your hosts file
You must add the "domains" for your Nginx sites to the hosts file on your machine. The hosts file will redirect requests for your Homestead sites into your Homestead machine. On Mac and Linux, this file is located at /etc/hosts
. On Windows, it is located at C:\Windows\System32\drivers\etc\hosts
. The lines you add to this file will look like the following:
192.168.10.10 la.local
Make sure the IP address listed is the one set in your Homestead.yaml file. Once you have added the domain to your hosts file and launched the Vagrant box you will be able to access the site via your web browser:
Set up environment variables
cd ~/Projects/Check-In
# Copy the example environment variable file to .env
cp env.example .env
# Edit .env as necessary
vim .env # or with your editor of choice
Start the Vagrant instance
cd ~/Homestead
vagrant up
SSH into the Vagrant instance
vagrant ssh
# Set working directory to project location
cd ~/Code/Check-In
In SSH: Install dependencies using composer
(PHP package manager)
composer install
In SSH: Run the database migrations
php artisan migrate
In SSH: Seed the database with initial values
php artisan db:seed --class DefaultSettingsSeeder
In SSH: Generate an application key
php artisan key:generate
Write the codestuffs
Point your browser to http://la.local.
Edit files in ~/Projects/Check-In
as necessary
Stop the VM when you're done working
vagrant halt
The next time you want to start working again, simply start the Vagrant instance again
vagrant up
And stop it when you're done
vagrant halt
If you change the sites or maps inside of Homestead.yaml
you will need to run the following to update Vagrant:
vagrant reload --provision
First point a git remote to the Dokku server (the example below is CS61A specific):
git remote add dokku dokku@app.cs61a.org:la
To deploy from master:
git push dokku master
Deploy from another branch:
git push dokku my_branch:master
Note: These are deployment instructions to the CS61A managed Dokku platform. They should be generic enough to follow to deploy to your own Dokku instance however.
Tip: add alias dokku="ssh -t dokku@app.cs61a.org"
to your aliases file (e.g. ~/.bashrc
).
dokku apps:create <app_name>
dokku checks:disable <app_name>
git remote add <app_name> dokku@hostedapps.cs61a.org:<app_name>
dokku mysql:create <db_name>
dokku mysql:link <db_name> <app_name>
dokku config:set --no-restart <app_name> APP_ENV=prod APP_OAUTH_KEY=<oauth secret> COURSE_NAME=CS61A OK_COURSE_OFFERING="cal/cs61a/fa17"
git push <app_name> HEAD:master
dokku enter <app_name> web php artisan key:generate --no-interaction --no-ansi --show
dokku config:set --no-restart <app_name> APP_KEY=<key copied from key:generate command>
dokku enter <app_name> web php artisan migrate --force
dokku enter <app_name> web php artisan db:seed --class=DefaultSettingsSeeder --force
dokku checks:enable <app_name>
dokku ps:restart <app_name>
dokku domains:add <app_name> domain.cs61a.org
dokku letsencrypt <app_name>
# Change OK OAuth to allow the domain redirect URL
Note: when setting course offering, make sure it is exact. "cal/cs61a/fa17" is not the same as "cal/cs61a/fa17/"!