Vagrantfile 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. # -*- mode: ruby -*-
  2. # vi: set ft=ruby :
  3. # All Vagrant configuration is done below. The "2" in Vagrant.configure
  4. # configures the configuration version (we support older styles for
  5. # backwards compatibility). Please don't change it unless you know what
  6. # you're doing.
  7. Vagrant.configure("2") do |config|
  8. # The most common configuration options are documented and commented below.
  9. # For a complete reference, please see the online documentation at
  10. # https://docs.vagrantup.com.
  11. # Every Vagrant development environment requires a box. You can search for
  12. # boxes at https://vagrantcloud.com/search.
  13. config.vm.box = "archlinux/archlinux"
  14. config.vm.box_version = "20241001.267073"
  15. config.vm.hostname = "spring-v20241213"
  16. config.vm.define "spring" do |h|
  17. h.vm.provider :virtualbox
  18. h.vm.disk :disk, size: "200GB", primary: true
  19. end
  20. # Disable automatic box update checking. If you disable this, then
  21. # boxes will only be checked for updates when the user runs
  22. # `vagrant box outdated`. This is not recommended.
  23. # config.vm.box_check_update = false
  24. # Create a forwarded port mapping which allows access to a specific port
  25. # within the machine from a port on the host machine. In the example below,
  26. # accessing "localhost:8080" will access port 80 on the guest machine.
  27. # NOTE: This will enable public access to the opened port
  28. config.vm.network "forwarded_port", guest: 8000, host: 8000
  29. config.vm.network "forwarded_port", guest: 3000, host: 3000
  30. config.vm.network "forwarded_port", id: "ssh", guest: 22, host: 10022
  31. # Create a forwarded port mapping which allows access to a specific port
  32. # within the machine from a port on the host machine and only allow access
  33. # via 127.0.0.1 to disable public access
  34. # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
  35. # Create a private network, which allows host-only access to the machine
  36. # using a specific IP.
  37. # config.vm.network "private_network", ip: "192.168.33.10"
  38. # Create a public network, which generally matched to bridged network.
  39. # Bridged networks make the machine appear as another physical device on
  40. # your network.
  41. config.vm.network "public_network"
  42. # Share an additional folder to the guest VM. The first argument is
  43. # the path on the host to the actual folder. The second argument is
  44. # the path on the guest to mount the folder. And the optional third
  45. # argument is a set of non-required options.
  46. config.vm.synced_folder "./mnt", "/mnt"
  47. # Disable the default share of the current code directory. Doing this
  48. # provides improved isolation between the vagrant box and your host
  49. # by making sure your Vagrantfile isn't accessible to the vagrant box.
  50. # If you use this you may want to enable additional shared subfolders as
  51. # shown above.
  52. # config.vm.synced_folder ".", "/vagrant", disabled: true
  53. # Provider-specific configuration so you can fine-tune various
  54. # backing providers for Vagrant. These expose provider-specific options.
  55. # Example for VirtualBox:
  56. #
  57. config.vm.provider "virtualbox" do |vb|
  58. vb.name = "mint"
  59. # # Display the VirtualBox GUI when booting the machine
  60. # vb.gui = true
  61. #
  62. # Customize the amount of memory on the VM:
  63. vb.memory = "4096"
  64. vb.cpus = "8"
  65. end
  66. #
  67. # View the documentation for the provider you are using for more
  68. # information on available options.
  69. # config.ssh.insert_key = false
  70. # config.ssh.password = "vagrant"
  71. # Enable provisioning with a shell script. Additional provisioners such as
  72. # Ansible, Chef, Docker, Puppet and Salt are also available. Please see the
  73. # documentation for more information about their specific syntax and use.
  74. config.vm.provision "shell", inline: <<-SHELL
  75. pacman-key --init
  76. pacman -Sy --noconfirm archlinux-keyring
  77. pacman-key --populate
  78. pacman -Syu --noconfirm
  79. pacman -S --needed --noconfirm base-devel bzip2 bzip3 p7zip unarchiver vim git cmake wget zsh man-db man-pages \
  80. pwgen sshpass openssl openssh rsync zip unzip tree tmux asciidoc doxygen cpio net-tools bind-tools \
  81. imagemagick ffmpeg xorg-font-util \
  82. ttf-dejavu wqy-bitmapfont wqy-microhei wqy-zenhei \
  83. composer xdebug php-fpm php-pgsql php-sqlite php-redis php-mongodb php-imagick php-gd php-intl php-enchant php-snmp php-tidy php-xsl php-sodium php-odbc php-pspell \
  84. hspell nuspell libvoikko hunspell hunspell-en_us \
  85. nodejs npm yarn \
  86. postgresql rabbitmq redis
  87. pacman -Scc --noconfirm
  88. echo "en_US.UTF-8 UTF-8" > /etc/locale.gen locale-gen
  89. systemctl enable postgresql
  90. systemctl enable redis
  91. systemctl enable rabbitmq
  92. sed -i 's/memory_limit =.*/memory_limit = 1G/' /etc/php/php.ini
  93. sed -i 's/;extension=bcmath/extension=bcmath/' /etc/php/php.ini
  94. sed -i 's/;extension=bz2/extension=bz2/' /etc/php/php.ini
  95. sed -i 's/;extension=calendar/extension=calendar/' /etc/php/php.ini
  96. sed -i 's/;extension=enchant/extension=enchant/' /etc/php/php.ini
  97. sed -i 's/;extension=exif/extension=exif/' /etc/php/php.ini
  98. sed -i 's/;extension=ftp/extension=ftp/' /etc/php/php.ini
  99. sed -i 's/;extension=gd/extension=gd/' /etc/php/php.ini
  100. sed -i 's/;extension=gettext/extension=gettext/' /etc/php/php.ini
  101. sed -i 's/;extension=gmp/extension=gmp/' /etc/php/php.ini
  102. sed -i 's/;extension=iconv/extension=iconv/' /etc/php/php.ini
  103. sed -i 's/;extension=intl/extension=intl/' /etc/php/php.ini
  104. sed -i 's/;extension=mysqli/extension=mysqli/' /etc/php/php.ini
  105. sed -i 's/;extension=odbc/extension=odbc/' /etc/php/php.ini
  106. sed -i 's/;extension=pdo_mysql/extension=pdo_mysql/' /etc/php/php.ini
  107. sed -i 's/;extension=pdo_odbc/extension=pdo_odbc/' /etc/php/php.ini
  108. sed -i 's/;extension=pdo_pgsql/extension=pdo_pgsql/' /etc/php/php.ini
  109. sed -i 's/;extension=pdo_sqlite/extension=pdo_sqlite/' /etc/php/php.ini
  110. sed -i 's/;extension=pgsql/extension=pgsql/' /etc/php/php.ini
  111. sed -i 's/;extension=pspell/extension=pspell/' /etc/php/php.ini
  112. sed -i 's/;extension=snmp/extension=snmp/' /etc/php/php.ini
  113. sed -i 's/;extension=soap/extension=soap/' /etc/php/php.ini
  114. sed -i 's/;extension=sockets/extension=sockets/' /etc/php/php.ini
  115. sed -i 's/;extension=sodium/extension=sodium/' /etc/php/php.ini
  116. sed -i 's/;extension=sqlite3/extension=sqlite3/' /etc/php/php.ini
  117. sed -i 's/;extension=tidy/extension=tidy/' /etc/php/php.ini
  118. sed -i 's/;extension=xsl/extension=xsl/' /etc/php/php.ini
  119. sed -i 's/;extension=redis/extension=redis/' /etc/php/conf.d/redis.ini
  120. sed -i 's/;extension=igbinary/extension=igbinary/' /etc/php/conf.d/igbinary.ini
  121. sed -i 's/; extension = imagick/extension=imagick/' /etc/php/conf.d/imagick.ini
  122. sed -i 's/;zend_extension=opcache/zend_extension=opcache/' /etc/php/php.ini
  123. sed -i 's/;zend_extension=xdebug/zend_extension=xdebug/' /etc/php/conf.d/xdebug.ini
  124. sed -i 's/;xdebug.mode=debug/xdebug.mode=develop,profile,coverage,debug/' /etc/php/conf.d/xdebug.ini
  125. echo 'xdebug.start_with_request=yes' | tee -a /etc/php/conf.d/xdebug.ini
  126. echo 'xdebug.client_host=0.0.0.0' | tee -a /etc/php/conf.d/xdebug.ini
  127. echo 'xdebug.client_port=9003' | tee -a /etc/php/conf.d/xdebug.ini
  128. echo 'xdebug.cli_color = 2' | tee -a /etc/php/conf.d/xdebug.ini
  129. su -l -c 'mkdir -p ~/downloads ~/build ~/local ~/tmp' vagrant
  130. su -l -c 'git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh' vagrant
  131. su -l -c 'cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc' vagrant
  132. su -l -c "echo 'export LANG=en_US.UTF-8' >> ~/.zshrc" vagrant
  133. su -l -c "echo 'export LC_ALL=en_US.UTF-8' >> ~/.zshrc" vagrant
  134. su -l -c "echo 'export EDITOR=vim' >> ~/.zshrc" vagrant
  135. su -l -c 'git config --global core.quotepath false' vagrant
  136. su -l -c 'git config --global http.version HTTP/1.1' vagrant
  137. su -l -c 'git config --global pull.rebase false' vagrant
  138. su -l -c "echo 'set-option -g history-limit 102400' > ~/.tmux.conf" vagrant
  139. su -l -c "echo 'set-option -g default-shell "/bin/zsh"' >> ~/.tmux.conf" vagrant
  140. chsh -s /bin/zsh vagrant
  141. SHELL
  142. end