-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
executable file
·62 lines (56 loc) · 2.3 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
Vagrant.configure('2') do |config|
config.vm.box = 'debian/bullseye64'
# Linux and Windows host machines need to use different kind of
# technology to provide best out of their power. Linux machines
# should use NFS. VirtualBox provides simple synced_folder type, but
# also comes with speed penalty and known bugs.
#
synced_folder_options =
if Vagrant::Util::Platform.linux?
[type: 'nfs',
nfs_version: 4, mount_options: %w[noatime nodiratime relatime]]
end
# Default Vagrant installation comes with /vagrant synced_folder
# enabled. Since we don't need to provide identical path, and
# simplify web server configuration, we aimed to disable the default
# synced_folder path.
#
config.vm.synced_folder '.', '/vagrant', disabled: true
config.vm.synced_folder '.', '/var/www/html', *synced_folder_options
config.vm.network :forwarded_port, guest: 80, host: 8000, host_ip: '127.0.0.1'
config.vm.provider :libvirt do |guest|
guest.memory = 1024
# TODO: Remove personal storage pool name instead find different
# method
#
guest.storage_pool_name = 'berkhan'
end
config.vm.provider :virtualbox do |guest|
guest.memory = 1024
end
# TODO: Generate a self generated SSL for Apache HTTP and forward
# only 443 port
#
config.vm.provision :shell, inline: <<-SHELL
apt-get update
apt-get install --yes --no-install-recommends git apache2 php \
php-mbstring php-curl php-imap php-xml php-mysql php-zip php-gd \
unzip mariadb-server docker.io \
yarnpkg composer
su vagrant -c 'yarnpkg global add prettier @prettier/plugin-php'
su vagrant -c 'composer global require friendsofphp/php-cs-fixer'
su vagrant -c 'composer global require "squizlabs/php_codesniffer=*"'
echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> /home/vagrant/.bashrc
mariadb -e "
CREATE DATABASE IF NOT EXISTS turkuaz_development;
CREATE USER IF NOT EXISTS 'turkuaz'@'localhost' IDENTIFIED BY 'turkuaz';
GRANT ALL PRIVILEGES ON turkuaz_development.* TO 'turkuaz'@'localhost';
FLUSH PRIVILEGES;
"
cat <<-'EOF' > /etc/mysql/mariadb.conf.d/100-sql-mode.cnf
[mysqld]
sql_mode = ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
EOF
systemctl restart mariadb.service
SHELL
end