To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / deploy / vagrant @ 1587:d8949733849d

1 1577:e38eee2e1d47 Chris
# -*- mode: ruby -*-
2
# vi: set ft=ruby :
3
4
Vagrant.configure("2") do |config|
5 1583:0dcd4f8c2b8a Chris
  config.vm.box = "ubuntu/xenial64"
6 1577:e38eee2e1d47 Chris
  config.vm.network "forwarded_port", guest: 80, host: 8080
7 1587:d8949733849d Chris
  config.vm.synced_folder "../..", "/code-to-deploy"
8 1577:e38eee2e1d47 Chris
  config.vm.provision :shell, path: "vagrant-provision.sh"
9
end
10 1581:ae8043b014c7 Chris
#!/bin/bash
11
12 1586:d0d59d12db94 Chris
mydir=$(dirname "$0")
13
14 1581:ae8043b014c7 Chris
dbpwd="$1"
15
if [ -z "$dbpwd" ]; then
16
    echo "Usage: $0 <database-password>" 1>&2
17
    exit 2
18
fi
19
20 1587:d8949733849d Chris
set -eu -o pipefail
21 1581:ae8043b014c7 Chris
22 1587:d8949733849d Chris
rootdir="$mydir/../.."
23 1586:d0d59d12db94 Chris
24 1587:d8949733849d Chris
deploydir="$rootdir"/deploy
25 1581:ae8043b014c7 Chris
if [ ! -d "$deploydir" ]; then
26 1586:d0d59d12db94 Chris
    echo "ERROR: Unexpected repository layout - expected directory at $deploydir"
27 1581:ae8043b014c7 Chris
    exit 2
28
fi
29
30
managerdir="$deploydir/vagrant"
31
if [ ! -d "$managerdir" ]; then
32
    echo "ERROR: Required directory $managerdir not found"
33
    exit 2
34
fi
35
36
configdir="$deploydir/config"
37
if [ ! -d "$configdir" ]; then
38
    echo "ERROR: Required directory $configdir not found"
39
    exit 2
40
fi
41
42 1586:d0d59d12db94 Chris
if [ ! -f "$rootdir/postgres-dumpall" ]; then
43
    echo "ERROR: I expect to find a Postgres SQL multi-db dump file in $rootdir/postgres-dumpall"
44
    exit 2
45
fi
46
47
fontdir="$rootdir"/public/themes/soundsoftware/stylesheets/fonts
48
if [ ! -f "$fontdir/24BC0E_0_0.woff" ]; then
49
    echo "ERROR: I expect to find necessary webfonts in $fontdir"
50 1581:ae8043b014c7 Chris
    exit 2
51
fi
52
53
for f in database.yml code.conf ; do
54 1587:d8949733849d Chris
    cat "$configdir/$f.in" |
55 1581:ae8043b014c7 Chris
        sed 's/INSERT_POSTGRES_PASSWORD_HERE/'"$dbpwd"'/g' > \
56 1587:d8949733849d Chris
            "$configdir/$f"
57 1581:ae8043b014c7 Chris
done
58
59
cd "$managerdir"
60
61
vagrant up
62
63 1577:e38eee2e1d47 Chris
#!/bin/bash
64
65
#!!! still not covered:
66
# * cron jobs
67
# * https
68
# * web fonts
69 1586:d0d59d12db94 Chris
# * reposman scripts (and their API key setup, etc)
70
# * docgen script install
71
# * logrotate config (check against system one)
72 1577:e38eee2e1d47 Chris
73
set -e
74
75 1587:d8949733849d Chris
for f in /code-to-deploy/deploy/provision.d/[0-9]* ; do
76 1577:e38eee2e1d47 Chris
    case "$f" in
77
        *~) ;;
78
        *) echo "Running provision script: $f"
79
           /bin/bash "$f";;
80
    esac
81
done