-
Notifications
You must be signed in to change notification settings - Fork 264
/
Vagrantfile
65 lines (54 loc) · 2.59 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/jammy64"
config.ssh.forward_agent = true
config.ssh.insert_key = false
config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
# # Customize the amount of memory on the VM:
vb.memory = "2048"
end
config.vm.provision "shell", inline: <<-SHELL
set -e
wget -qO - https://deb.nodesource.com/setup_16.x | bash -
apt-get install -qqy nodejs libpq-dev build-essential python-is-python3 postgresql postgresql-client fail2ban git libcap2-bin unattended-upgrades libsystemd-dev chromium-browser python3-pip python3-pytest
sudo -iu postgres psql -U postgres -d template1 -c 'create extension if not exists "uuid-ossp";'
sudo -iu postgres createdb saltcorn
sudo -iu postgres createdb saltcorn_test
sudo -iu postgres psql -U postgres -c "ALTER USER postgres WITH PASSWORD 'foobar';"
sudo -iu vagrant mkdir -p /home/vagrant/.config/
cat <<EOF > /home/vagrant/.config/.saltcorn
{
"host":"localhost",
"port":5432,
"database":"saltcorn",
"user":"postgres",
"password":"foobar",
"session_secret":"jjtrjtyjd",
"multi_tenant": true
}
EOF
chown vagrant:vagrant /home/vagrant/.config/.saltcorn
chmod 600 /home/vagrant/.config/.saltcorn
echo '127.0.0.1 example.com sub.example.com sub1.example.com sub2.example.com sub3.example.com sub4.example.com sub5.example.com' | sudo tee -a /etc/hosts
echo '127.0.0.1 otherexample.com' | sudo tee -a /etc/hosts
sudo -iu vagrant pip3 install requests
sudo -iu vagrant git clone https://github.com/saltcorn/saltcorn.git
sudo -iu vagrant bash -c "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true cd saltcorn && npm install --legacy-peer-deps"
sudo -iu vagrant bash -c "cd saltcorn && packages/saltcorn-cli/bin/saltcorn run-tests"
sudo -iu vagrant bash -c "cd saltcorn && pytest-3 infosec-scan/"
sudo -iu vagrant bash -c "SQLITE_FILEPATH=/tmp/db cd saltcorn && packages/saltcorn-cli/bin/saltcorn run-tests saltcorn-data"
sudo -iu vagrant bash -c "SQLITE_FILEPATH=/tmp/db cd saltcorn && packages/saltcorn-cli/bin/saltcorn run-tests server"
SHELL
end
#then:
# git clone https://github.com/saltcorn/saltcorn.git
# git checkout <branch>
# packages/saltcorn-cli/bin/saltcorn run-tests