Permalink
Browse files

Clean up readme and vagrant setup

  • Loading branch information...
Benestar committed Jul 29, 2017
1 parent b08b354 commit 6188470dde5d93a6b702b9d2c41d0ea97667f5c1
Showing with 39 additions and 33 deletions.
  1. +15 −8 README.md
  2. +1 −1 Vagrantfile
  3. +20 −21 bootstrap.sh
  4. +3 −3 requirements.txt
@@ -10,7 +10,7 @@ assign managers for each depot and group them into several organizations.

The development of the Verleihtool happens via [Vagrant](https://www.vagrantup.com/)
and preferably with the [VirtualBox](https://www.virtualbox.org/) provider.
After installing these components, doing `vagrant up` from the project's
After installing these components, invoking `vagrant up` from the project's
directory will create the virtual machine and run the provisioner on it.
When the process is finished, one can login to the machine using `vagrant ssh`.
In case the provision script gets updated afterwards, the command
@@ -19,12 +19,13 @@ In case the provision script gets updated afterwards, the command
### Starting the tool

To install the dependencies, run `pip install -r requirements.txt` and
`npm install` from the `/vagrant` directory in the virtual machine. Afterwards,
apply all migrations using the command `python manage.py migrate`. To generate
the JavaScript and CSS files, enter `npm run dev` or alternatively
`npm install` from the `/vagrant` directory in the virtual machine.
On a Windows host, the parameter `--no-bin-links` is most likely required.
Afterwards, apply all migrations using the command `python manage.py migrate`.
To generate the JavaScript and CSS files, enter `npm run dev` or alternatively
`npm run watch-poll` if the script should automatically detect changes to the
source files. Finally, the server can be started using the provided script in
the home directory of the vagrant user called `startServer.sh`. The tool can
the home directory of the vagrant user called `server.sh`. The tool can
then be reached at [http://127.0.0.1:1337/](http://127.0.0.1:1337/).

To create a superuser, execute the command `python manage.py createsuperuser`
@@ -37,12 +38,18 @@ The Verleihtool comes with a full test suite that can be run using the command
new test database every time. To run the lint script, execute `flake8` from
the `/vagrant` directory.

Alternatively, when using vagrant a `test.sh` script is provided to automate
the steps described above.

## Deployment

The Verleihtool requires Python 3 to be installed on the server as well as a
database software that is [supported by Django](https://docs.djangoproject.com/en/1.10/ref/databases/).
The Verleihtool requires Python 3.6 to be installed on the server as well as a
database backend that is [supported by Django](https://docs.djangoproject.com/en/1.10/ref/databases/).
The web server must be configured to access static files from the `static`
directory of this project. Before each deployment, the resource files have to be
directory of this project. for more information, please consult the
[Django manual for deployments](https://docs.djangoproject.com/en/1.10/howto/deployment/).

Before each deployment, the resource files have to be
generated either on the production server or on another device using the
`npm run production` command. This will place the minified JavaScript and CSS
files in the `static` directory.
@@ -6,7 +6,7 @@ Vagrant.configure("2") do |config|
config.vm.provision :shell, path: "bootstrap.sh", privileged: false

# Configure port forwarding
config.vm.network :forwarded_port, guest: 8000, host: 1337, host_ip: "127.0.0.1"
config.vm.network :forwarded_port, guest: 8000, host: 1337, host_ip: "127.0.0.1", auto_correct: true

# Virtualbox configuration
config.vm.provider "virtualbox" do |v|
@@ -3,7 +3,8 @@
echo "Bootstrapping Django Vagrant machine..."
sudo apt-get update
sudo apt-get install -y vim git make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \
libncursesw5-dev xz-utils

# Install NodeJS

@@ -43,32 +44,30 @@ which pip
python -V
pip -V

echo "Installing Django"
pip install django
# Link vagrant directory to home

python -m django --version

echo "Installing html2text"
pip install html2text
html2text --version

echo "Installing Flake8"
pip install flake8

flake8 --version
echo "Create symbolic link to the repository"
ln -sfn /vagrant /home/vagrant/verleihtool

# Create helper scripts

cat > /home/vagrant/startServer.sh <<- EOF
echo "Create helper scripts"
cat > /home/vagrant/server.sh <<- EOF
echo "Server listening at http://127.0.0.1:1337/"
python /vagrant/manage.py runserver [::]:8000
EOF

cat > /home/vagrant/lint.sh <<- EOF
pylint --load-plugins pylint_django \
/vagrant/verleihtool \
/vagrant/depot \
/vagrant/rental
cat > /home/vagrant/test.sh <<- EOF
set -e
cd /vagrant
echo "-- Running linter flake8"
flake8
echo "Linter succeeded"
echo
echo "-- Running tests"
python manage.py test
EOF

chmod u+x /home/vagrant/startServer.sh
chmod u+x /home/vagrant/lint.sh
chmod u+x /home/vagrant/server.sh /home/vagrant/test.sh
@@ -1,3 +1,3 @@
Django>=1.10.6
flake8>=3.3.0
html2text>=2016.9.19
Django==1.10.6
flake8==3.3.0
html2text==2016.9.19

0 comments on commit 6188470

Please sign in to comment.