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 4.4 KiB

4 年之前
4 年之前
4 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. #
  17. # There are a few environment variables that determine how the box is initialized,
  18. # described below.
  19. #
  20. # ## Environment Variables
  21. #
  22. # ### LETSENCRYPT_EMAIL
  23. # If you specify the LETSENCRYPT_EMAIL environment variable, then `vagrant up` will also
  24. # start a Local Launcher (see docs/local-launcher.md) which is your starting point for
  25. # launching new Bubbles. You can always change this later by editing the `~/.bubble.env`
  26. # file after the Vagrant box is setup.
  27. #
  28. # ### BUBBLE_PORT
  29. # By default, Bubble will listen on port 8090.
  30. # If something else is already using that port on your computer, `vagrant up` will fail.
  31. # Set the `BUBBLE_PORT` environment variable to another port, and Bubble will listen on
  32. # that port instead.
  33. #
  34. # ### BUBBLE_PUBLIC_PORT
  35. # By default, Vagrant will only expose the Bubble API port (8090 or whatever BUBBLE_PORT
  36. # is set to) as listening on 127.0.0.1
  37. # If you want the Bubble API port to be listening on all addresses (bind to 0.0.0.0)
  38. # then set the BUBBLE_PUBLIC_PORT environment variable to any value except 'false'
  39. #
  40. Vagrant.configure("2") do |config|
  41. config.vm.box = "ubuntu/focal64"
  42. # You can access the launcher on port 8090 (or BUBBLE_PORT) but only on 127.0.0.1
  43. # If you want to allow outside access to port 8090 (listen on 0.0.0.0), use the version below
  44. if not ENV.include? 'BUBBLE_PUBLIC_PORT' or ENV['BUBBLE_PUBLIC_PORT'] == 'false' then
  45. config.vm.network "forwarded_port", guest: 8090, host: ENV['BUBBLE_PORT'] || 8090, host_ip: "127.0.0.1"
  46. else
  47. # Anyone who can reach port 8090 on this system will be able to access the launcher
  48. config.vm.network "forwarded_port", guest: 8090, host: ENV['BUBBLE_PORT'] || 8090
  49. end
  50. # Update system
  51. config.vm.provision :shell do |s|
  52. s.inline = <<-SHELL
  53. apt-get update -y
  54. apt-get upgrade -y
  55. SHELL
  56. end
  57. # Get dependencies and build everything
  58. config.vm.provision :shell do |s|
  59. s.env = {
  60. BUBBLE_PORT: ENV['BUBBLE_PORT'],
  61. LETSENCRYPT_EMAIL: ENV['LETSENCRYPT_EMAIL']
  62. }
  63. s.privileged = false
  64. s.inline = <<-SHELL
  65. # Copy shared bubble dir to ${HOME}
  66. cd ${HOME} && rsync -azc --exclude="**/target/**" /vagrant . && mv vagrant bubble
  67. # Initialize the system
  68. cd ${HOME}/bubble && ./bin/first_time_ubuntu.sh
  69. # Clone and build all dependencies
  70. SKIP_BUBBLE_BUILD=1 ./bin/first_time_setup.sh
  71. # Build the bubble jar
  72. BUBBLE_PRODUCTION=1 mvn -DskipTests=true -Dcheckstyle.skip=true -Pproduction clean package 2>&1 | tee /tmp/build.log
  73. # Write bubble API port
  74. echo \"export BUBBLE_SERVER_PORT=${BUBBLE_PORT}\" > ~/.bubble.env
  75. # Allow website to be loaded from disk
  76. echo \"export BUBBLE_ASSETS_DIR=$(pwd)/bubble-web/dist\" >> ~/.bubble.env
  77. # Add bubble bin to PATH
  78. echo \"export PATH=\${PATH}:${HOME}/bubble/bin\" >> ~/.bashrc
  79. # Set LETSENCRYPT_EMAIL is defined
  80. if [[ -n \"${LETSENCRYPT_EMAIL}\" ]] ; then
  81. echo \"export LETSENCRYPT_EMAIL=${LETSENCRYPT_EMAIL}\" >> ~/.bubble.env
  82. fi
  83. # Create env file symlink for running tests
  84. cd ~ && ln -s .bubble.env .bubble-test.env
  85. # Done!
  86. echo "
  87. ==================================================================
  88. Bubble Vagrant Setup Complete
  89. ==================================================================
  90. Log in to this box using:
  91. vagrant ssh
  92. Once logged in:
  93. - the code is in ${HOME}/bubble
  94. - API environment file is ${HOME}/.bubble.env
  95. - start the API server (local launcher) with run.sh
  96. Enjoy!
  97. ==================================================================
  98. "
  99. SHELL
  100. end
  101. end