Skip to content

Commit

Permalink
Fix several issues in Vagrant provisioning (CTFd#1046)
Browse files Browse the repository at this point in the history
* Fixes to Vagrantfile
  • Loading branch information
joshuadugie authored and ColdHeat committed Sep 8, 2019
1 parent 7a7595c commit cee6fe3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
15 changes: 12 additions & 3 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

# Install tmux and virtualenv to support development
# Install tmux, virtualenv, and mariadb-server to support development
$preProvision= <<SCRIPT
sudo apt-get install tmux virtualenvwrapper mariadb-server -y
# Prevent attempt to access stdin, causing dpkg-reconfigure error output
export DEBIAN_FRONTEND=noninteractive
apt-get install -y tmux virtualenvwrapper
# As per instructions at https://downloads.mariadb.org/mariadb/repositories
apt-get install -y software-properties-common
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 2>&1
add-apt-repository -y 'deb [arch=amd64,arm64,i386,ppc64el] http://mirror.lstn.net/mariadb/repo/10.4/ubuntu xenial main'
apt-get update
apt-get install -y mariadb-server
SCRIPT

# Wrap provisioning script with a virutalenv for pip packages
Expand Down Expand Up @@ -59,6 +68,6 @@ Vagrant.configure("2") do |config|
run: "always"

# Install docker (convenience)
config.vm.provision "shell", path: "scripts/install_docker_ubuntu.sh"
config.vm.provision "shell", path: "scripts/install_docker.sh", privileged: false

end
2 changes: 1 addition & 1 deletion prepare.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
sudo apt-get update
sudo apt-get install build-essential python-dev python-pip libffi-dev -y
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential python-dev python-pip libffi-dev
pip install -r requirements.txt
10 changes: 5 additions & 5 deletions scripts/install_docker_ubuntu.sh → scripts/install_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# per: https://docs.docker.com/engine/installation/linux/debian/#install-docker-ce

# Install packages to allow apt to use a repository over HTTPS
sudo apt-get install -y \
python-pip
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y \
python-pip \
apt-transport-https \
ca-certificates \
curl \
Expand All @@ -25,14 +25,14 @@ sudo add-apt-repository \
sudo apt-get update

# Install the latest version of Docker
sudo apt-get install -y docker-ce
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y docker-ce

# Add user to the docker group
# Warning: The docker group grants privileges equivalent to the root user.
sudo usermod -aG docker ubuntu
sudo usermod -aG docker ${USER}

# Configure Docker to start on boot
sudo systemctl enable docker

# Install docker-compose
sudo pip install docker-compose
pip install docker-compose

0 comments on commit cee6fe3

Please sign in to comment.