Vagrant uses mariadb database rather than sqlite - Fixes #648 (#649)

selenium-screenshot-testing
Cliffe 2018-07-29 08:08:05 +01:00 committed by Kevin Chung
parent 36dadcf1d5
commit 3676d4dbd5
1 changed files with 16 additions and 2 deletions

16
Vagrantfile vendored
View File

@ -3,7 +3,7 @@
# Install tmux and virtualenv to support development # Install tmux and virtualenv to support development
$preProvision= <<SCRIPT $preProvision= <<SCRIPT
sudo apt-get install tmux virtualenvwrapper -y sudo apt-get install tmux virtualenvwrapper mariadb-server -y
SCRIPT SCRIPT
# Wrap provisioning script with a virutalenv for pip packages # Wrap provisioning script with a virutalenv for pip packages
@ -14,12 +14,26 @@ workon ctfd
cd /vagrant cd /vagrant
./prepare.sh ./prepare.sh
pip install -r development.txt pip install -r development.txt
echo "Initialising database"
commands="CREATE DATABASE ctfd;
CREATE USER 'ctfduser'@'localhost' IDENTIFIED BY 'ctfd';
GRANT USAGE ON *.* TO 'ctfduser'@'localhost' IDENTIFIED BY 'ctfd';
GRANT ALL privileges ON ctfd.* TO 'ctfduser'@'localhost';FLUSH PRIVILEGES;"
echo "${commands}" | sudo /usr/bin/mysql -u root -pctfd
SCRIPT SCRIPT
# Start development server in a tmux session # Start development server in a tmux session
$startServer= <<SCRIPT $startServer= <<SCRIPT
source /usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh source /usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh
workon ctfd workon ctfd
export DATABASE_URL="mysql+pymysql://ctfduser:ctfd@localhost/ctfd"
cd /vagrant
python manage.py db upgrade
echo "Starting CTFd"
tmux new-session -d -n "ctfd" -c "/vagrant" -s "ctfd" "gunicorn --bind 0.0.0.0:8000 -w 4 'CTFd:create_app()'" tmux new-session -d -n "ctfd" -c "/vagrant" -s "ctfd" "gunicorn --bind 0.0.0.0:8000 -w 4 'CTFd:create_app()'"
SCRIPT SCRIPT