From e6b2e4584884b97925dfb22c22bf80898afa0a4c Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Mon, 21 Dec 2015 01:04:00 -0600 Subject: [PATCH] basic setup --- .gitignore | 1 + Vagrantfile | 21 +++++++++++++++++++++ deploy | 2 ++ scripts/requirements.txt | 2 ++ scripts/setup.sh | 11 +++++++++++ server/app.py | 9 +++++++++ 6 files changed, 46 insertions(+) create mode 100644 .gitignore create mode 100644 Vagrantfile create mode 100644 deploy create mode 100644 scripts/requirements.txt create mode 100644 scripts/setup.sh create mode 100644 server/app.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8000dd9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.vagrant diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..8e5b14d --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,21 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure(2) do |config| + config.vm.box = "ubuntu/trusty64" + # config.vm.box_check_update = false + + config.vm.network :forwarded_port, guest: 80, host: 8080, auto_correct: true + config.vm.network :forwarded_port, guest: 8000, host: 8000, auto_correct: true + config.vm.network :forwarded_port, guest: 27017, host: 27017, auto_correct: true + + config.vm.synced_folder "server", "/home/vagrant/server" + config.vm.synced_folder "scripts", "/home/vagrant/scripts" + + config.vm.provision :shell, :path => "scripts/setup.sh" + config.ssh.forward_agent = true + + config.vm.provider "virtualbox" do |vb| + vb.customize ["modifyvm", :id, "--memory", "2048"] + end +end diff --git a/deploy b/deploy new file mode 100644 index 0000000..05a7907 --- /dev/null +++ b/deploy @@ -0,0 +1,2 @@ +#!/bin/bash + diff --git a/scripts/requirements.txt b/scripts/requirements.txt new file mode 100644 index 0000000..1167f2f --- /dev/null +++ b/scripts/requirements.txt @@ -0,0 +1,2 @@ +Flask +gunicorn \ No newline at end of file diff --git a/scripts/setup.sh b/scripts/setup.sh new file mode 100644 index 0000000..d2504e2 --- /dev/null +++ b/scripts/setup.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +echo "Updating system..." +apt-get -y update +apt-get -y upgrade + +echo "Installing dependencies..." +apt-get -y install python-pip + +echo "Installing pip dependencies..." +pip install -r scripts/requirements.txt \ No newline at end of file diff --git a/server/app.py b/server/app.py new file mode 100644 index 0000000..6f18e99 --- /dev/null +++ b/server/app.py @@ -0,0 +1,9 @@ +from flask import Flask + +app = Flask(__name__) + +@app.route("/") +def hello_world(): + return "Hello, EasyCTF!" + +app.run(port=8000) \ No newline at end of file