-
Notifications
You must be signed in to change notification settings - Fork 26
/
Vagrantfile
128 lines (104 loc) · 3.19 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "debian/contrib-stretch64"
# Map HTTP port to port 8080 on host machine to make web server available as http://localhost:8080/
# Only allow access via 127.0.0.1 to disable public access.
config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
packages = []
# Install script/install.sh dependencies
packages += %w[
carton
cpanminus
fontconfig
gcc
ghostscript
git
graphicsmagick
imagemagick
make
rsync
shared-mime-info
unzip
xapian-tools
]
packages << "nginx"
packages += %w[cgit fcgiwrap]
# Install TeX Live
packages += %w[
texlive-base
texlive-fonts-recommended
texlive-generic-recommended
texlive-lang-all
texlive-latex-base
texlive-latex-extra
texlive-latex-recommended
texlive-luatex
texlive-xetex
]
# Install fonts
packages += %w[
fonts-cmu
fonts-dejavu
fonts-hosny-amiri
fonts-linuxlibertine
fonts-lmodern
fonts-sil-charis
fonts-sil-gentium
fonts-sil-gentium-basic
fonts-sil-scheherazade
fonts-texgyre
lmodern
]
# Perl module compilation dependencies
packages += %w[
g++
libssl-dev
libxapian-dev
libxml2-dev
libexpat1-dev
]
# Install Imager module dependencies
packages += %w[
libjpeg-dev
libpng-dev
]
# Install gettext required by /vagrant/script/upgrade_i18n
packages << "gettext"
# Install dependencies via APT
config.vm.provision "apt", type: "shell", privileged: false, inline: <<-SHELL
set -e
sudo apt-get update
sudo apt-get install --no-install-recommends --no-install-suggests -y #{packages.join(' ')}
SHELL
# Configure Amusewiki
config.vm.provision "amusewiki-configure", type: "shell", privileged: false, inline: <<-SHELL
set -e
cd /vagrant
cp dbic.yaml.sqlite.example dbic.yaml
script/install.sh
carton exec script/configure.sh localhost
carton exec script/amusewiki-generate-nginx-conf | sudo /bin/sh
carton exec script/generate-systemd-unit-files ./var/tmp/systemd
sudo cp -v ./var/tmp/systemd/* /etc/systemd/system/
sudo chown root:root /etc/systemd/system/amusewiki-*
sudo chmod 664 /etc/systemd/system/amusewiki-*
# It is impossible to create socket on VirtualBox filesystem.
# Move it to home as a workaround.
sudo sed -i 's|unix:/vagrant/var/amw.sock|unix:/home/vagrant/amw.sock|' /etc/nginx/amusewiki_include
sudo sed -i 's|/vagrant/var/amw.sock|/home/vagrant/amw.sock|' /etc/systemd/system/amusewiki-web.service
# Don't enable amusewiki-cgit here, because it is already started on port 9015 in /etc/nginx/sites-enabled/amusewiki
sudo systemctl enable --now amusewiki-jobber amusewiki-web
sudo systemctl restart nginx
SHELL
config.vm.hostname = 'amusewiki'
config.vm.post_up_message = <<~MESSAGE
Amusewiki is running at http://localhost:8080/
To change default password:
$ vagrant ssh
vagrant@amusewiki:~$ cd /vagrant/
vagrant@amusewiki:~$ carton exec script/amusewiki-reset-password amusewiki
Run tests with:
vagrant@amusewiki:~$ carton exec prove -l
MESSAGE
end