File tree 1 file changed +16
-2
lines changed
1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change 3
3
4
4
# Install tmux and virtualenv to support development
5
5
$preProvision= <<SCRIPT
6
- sudo apt-get install tmux virtualenvwrapper -y
6
+ sudo apt-get install tmux virtualenvwrapper mariadb-server -y
7
7
SCRIPT
8
8
9
9
# Wrap provisioning script with a virutalenv for pip packages
@@ -14,12 +14,26 @@ workon ctfd
14
14
cd /vagrant
15
15
./prepare.sh
16
16
pip install -r development.txt
17
+
18
+ echo "Initialising database"
19
+ commands="CREATE DATABASE ctfd;
20
+ CREATE USER 'ctfduser'@'localhost' IDENTIFIED BY 'ctfd';
21
+ GRANT USAGE ON *.* TO 'ctfduser'@'localhost' IDENTIFIED BY 'ctfd';
22
+ GRANT ALL privileges ON ctfd.* TO 'ctfduser'@'localhost';FLUSH PRIVILEGES;"
23
+ echo "${commands}" | sudo /usr/bin/mysql -u root -pctfd
17
24
SCRIPT
18
25
19
26
# Start development server in a tmux session
20
27
$startServer= <<SCRIPT
21
28
source /usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh
22
29
workon ctfd
30
+
31
+ export DATABASE_URL="mysql+pymysql://ctfduser:ctfd@localhost/ctfd"
32
+
33
+ cd /vagrant
34
+ python manage.py db upgrade
35
+
36
+ echo "Starting CTFd"
23
37
tmux new-session -d -n "ctfd" -c "/vagrant" -s "ctfd" "gunicorn --bind 0.0.0.0:8000 -w 4 'CTFd:create_app()'"
24
38
SCRIPT
25
39
@@ -36,7 +50,7 @@ Vagrant.configure("2") do |config|
36
50
37
51
# Pre-provision
38
52
config . vm . provision "shell" , inline : $preProvision
39
-
53
+
40
54
# Provisioning scripts
41
55
config . vm . provision "shell" , inline : $provision, privileged : false
42
56
You can’t perform that action at this time.
0 commit comments