- Uses Python 2.7
- There is still sqlite code in here, but we are using mysql
-
Ensure that you have the proper binaries installed by running
which docker docker-compose
and verifying the output (there should be a path for both). New student VMs should already be ready. If you do not have them, install them.sudo apt-get install docker.io
- Use the Linux instructions from https://docs.docker.com/compose/install/
- Your user should be in the docker group or you will need sudo privileges.
-
Clone this repository.
-
In your new repo directory, use docker-compose to start your application.
docker-compose up
-
If this is successful, access your application at your server + the port
- If on your computer: http://localhost:8080
- If on your student VM, use that IP: e.g., http://172.31.3.69:8080
-
The application data will persist in your docker/data/db/ directory. To re-initialize it, use the appropriate script in tools/.
-
To understand more about using Docker and docker-compose, read http://172.31.2.178/en/docker.
- Ensure you have the necessary packages to run this application.
apt install git mysql-server python2.7 python-pip virtualenv
- You must be using Python 2.7
- If you are unsure how to fix this, read http://172.31.2.178/en/python-versions
- Ensure you have access to the git repo using ssh keys
- Try and clone this repository. If it doesn't work, do the next step
- Paste your public key into bitbucket
- If you are unsure how to get your key, read http://172.31.2.178/en/ssh
- Clone this repo.
- Ensure MySQL is running, with the proper root password set
- test with
mysql -u root --password="root"
- if you can't connect and you do not have sudo privileges, someone will have to set this up for you
sudo systemctl start mysql
echo "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root'; flush privileges;" | sudo mysql -u root --password=root
- test with
- Create the user and database
- This will erase any existing data!
- There will be ignorable errors if this is the initial setup.
- Run
./erase_mysql_db_and_use_real_data.sh
from the tools directory.
- Edit the application configuration for your db host.
- In
api/config.yaml
, change your database host from "db" to your mysql host (e.g., "localhost")
- Initialize the application:
./setup.sh
- Activate your virtual environment:
source venv/bin/activate
- Run the application:
python api.py
- If this is successful, access your application at your server + the port
- If on your computer: http://localhost:8080
- If on your student VM, use that IP: e.g., http://172.31.3.69:8080
- The application data will persist in mysql database. To re-initialize it, use the appropriate script in tools/.
- If you run into this error
bind: address already in use
, run the following command:sudo systemctl stop mysql
- run
phpmyadmin-ctl install
to run the phpmyadmin client. - navigate to the phpmyadmin interface