Setting up local dev environment - SmartCampusUWindsor/smart-campus GitHub Wiki
Feel free to update this guide if it's incorrect, missing anything, or just plain bad :P. You can skip the database/mysql stuff if you don't need to see the Message Board.
1. Setup local web server and database server
A couple options:
- Download XAMPP, and choose the Apache and MySQL packages on installation. (recommended)
- or install Apache and MySQL servers.
2. Install git
See "Getting Started - Installing Git" for guide on installing the git client.
3. Add ssh key (optional)
See "Connecting to GitHub with SSH" to set up authenticating to github via SSH instead of username/password.
4. Set up the database
Depending on whether you are using XAMPP or MySQL server directly:
XAMPP:
- Start Apache and MySQL servers.
- Go to "Admin" for MySQL to open the control panel.
- Go to "SQL" and paste the contents of db_schema.sql. Press "Go" to create the database.
MySQL:
Download db_schema.sql. Run the script from within mysql or using the following command:
mysql -u $username -p < db_schema.sql
5. Clone repository and serve it.
Apache will use DocumentRoot
and Directory
fields in httpd.conf file to serve the project. Usually these point locations like /var/www/html
or /xampp/htdocs
. Heres a few ways to set up your environment to work with Apache - all assume /var/www/html
as Apache root:
Point Apache to the location of the repo (recommended):
git clone https://github.com/SmartCampusUWindsor/smart-campus.git
Open httpd.conf (XAMP: "Config" for Apache.)
Find and change DocumentRoot and Directory to the path for the cloned repo.
DocumentRoot "/path/to/smart-campus"
<Directory "/path/to/smart-campus">
or Create a symlink (linux/macos) from workspace to Apache root:
git clone https://github.com/SmartCampusUWindsor/smart-campus.git
ln -s ./smart-campus /var/www/html
or Clone the repo directly into the default DocumentRoot
This currently breaks the site due to relative links (site doesn't expect the extra smart-campus
level)
cd /var/www/html && git clone https://github.com/SmartCampusUWindsor/smart-campus.git
6. Create private_html
Where ever you ended up cloning the repo, create another folder called private_html
.
images/making_private_html.png
Create a file called db_config.ini
inside of private_html, with the following contents:
[database]
servername = localhost
dbname = message_board
username = root
password =
If you installed MySQL, you'll need to replace username/password with the ones you made on install. XAMPP defaults to a root account with no password. message_board
is the name of database created in db_schema.sql.
7. You're all set up!
Open your browser and go to http://localhost to see the site.
** Currently you need to be on secure_db_creds
branch for the database to work locally. You also need fix from add_locahost_googleapi
to use the Google sign-in locally.