The main Bubble source repository. Contains the Bubble API server, the web UI, documentation and utilities. https://getbubblenow.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Vagrantfile 3.9 KiB

3 年之前
3 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. # -*- mode: ruby -*-
  2. # vi: set ft=ruby :
  3. # Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/
  4. #
  5. # ==================
  6. # Bubble Vagrantfile
  7. # ==================
  8. # Running `vagrant up` will create a full Bubble development environment including all
  9. # dependencies, and build all the code and website. You'll be ready to run a local
  10. # launcher or do dev work on the Bubble codebase.
  11. #
  12. # After a box is launched, use `vagrant ssh` to log in.
  13. # - the code is in ${HOME}/bubble
  14. # - API environment file is ${HOME}/.bubble.env
  15. # - start the API server (local launcher) with run.sh
  16. # - access the webapp at http://127.0.0.1:${BUBBLE_PORT}/
  17. #
  18. # There are a few environment variables that determine how the box is initialized,
  19. # described below.
  20. #
  21. # ## Environment Variables
  22. #
  23. # ### LETSENCRYPT_EMAIL
  24. # If you specify the LETSENCRYPT_EMAIL environment variable, then `vagrant up` will also
  25. # start a Local Launcher (see docs/local-launcher.md) which is your starting point for
  26. # launching new Bubbles. You can always change this later by editing the `~/.bubble.env`
  27. # file after the Vagrant box is setup.
  28. #
  29. # ### BUBBLE_PORT
  30. # By default, Bubble will listen on port 8090.
  31. # If something else is already using that port on your computer, `vagrant up` will fail.
  32. # Set the `BUBBLE_PORT` environment variable to another port, and Bubble will listen on
  33. # that port instead.
  34. #
  35. Vagrant.configure("2") do |config|
  36. config.vm.box = "ubuntu/focal64"
  37. # Forward ports
  38. port = ENV['BUBBLE_PORT'] || 8090
  39. config.vm.network "forwarded_port", guest: port, host: port
  40. # Update system
  41. config.vm.provision :shell do |s|
  42. s.inline = <<-SHELL
  43. apt-get update -y
  44. apt-get upgrade -y
  45. SHELL
  46. end
  47. # Get dependencies and build everything
  48. config.vm.provision :shell do |s|
  49. s.env = {
  50. BUBBLE_PORT: port,
  51. LETSENCRYPT_EMAIL: ENV['LETSENCRYPT_EMAIL']
  52. }
  53. s.privileged = false
  54. s.inline = <<-SHELL
  55. # Copy shared bubble dir to ${HOME}
  56. cd ${HOME} && rsync -azc --exclude="**/target/**" /vagrant . && mv vagrant bubble
  57. # Initialize the system
  58. cd ${HOME}/bubble && ./bin/first_time_ubuntu.sh
  59. # Clone and build all dependencies
  60. SKIP_BUBBLE_BUILD=1 ./bin/first_time_setup.sh
  61. # Build the bubble jar
  62. BUBBLE_PRODUCTION=1 mvn -DskipTests=true -Dcheckstyle.skip=true -Pproduction clean package 2>&1 | tee /tmp/build.log
  63. # Write bubble API port
  64. echo \"export BUBBLE_SERVER_PORT=${BUBBLE_PORT}\" > ~/.bubble.env
  65. # Allow website to be loaded from disk
  66. echo \"export BUBBLE_ASSETS_DIR=$(pwd)/bubble-web/dist\" >> ~/.bubble.env
  67. # Add bubble bin to PATH
  68. echo \"export PATH=\${PATH}:${HOME}/bubble/bin\" >> ~/.bashrc
  69. # Ensure Bubble API listens on all addresses
  70. echo \"export BUBBLE_LISTEN_ALL=true\" >> ~/.bashrc
  71. # Set LETSENCRYPT_EMAIL is defined
  72. if [[ -n \"${LETSENCRYPT_EMAIL}\" ]] ; then
  73. echo \"export LETSENCRYPT_EMAIL=${LETSENCRYPT_EMAIL}\" >> ~/.bubble.env
  74. fi
  75. # Create env file symlink for running tests
  76. cd ~ && ln -s .bubble.env .bubble-test.env
  77. # Done!
  78. echo "
  79. ==================================================================
  80. Bubble Vagrant Setup Complete
  81. ==================================================================
  82. Log in to this box using:
  83. vagrant ssh
  84. Once you are logged in:
  85. - the code is in ${HOME}/bubble
  86. - API environment file is ${HOME}/.bubble.env
  87. - start the API server (local launcher) with run.sh
  88. - access the webapp at http://127.0.0.1:${BUBBLE_PORT}/
  89. Enjoy!
  90. ==================================================================
  91. "
  92. SHELL
  93. end
  94. end