The main Bubble source repository. Contains the Bubble API server, the web UI, documentation and utilities. https://getbubblenow.com
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 

115 рядки
4.3 KiB

  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 = { LETSENCRYPT_EMAIL: ENV['LETSENCRYPT_EMAIL'] }
  60. s.privileged = false
  61. s.inline = <<-SHELL
  62. # Copy shared bubble dir to ${HOME}
  63. cd ${HOME} && rsync -azc --exclude="**/target/**" /vagrant . && mv vagrant bubble
  64. # Initialize the system
  65. cd ${HOME}/bubble && ./bin/first_time_ubuntu.sh
  66. # Clone and build all dependencies
  67. SKIP_BUBBLE_BUILD=1 ./bin/first_time_setup.sh
  68. # Build the bubble jar
  69. BUBBLE_PRODUCTION=1 mvn -DskipTests=true -Dcheckstyle.skip=true -Pproduction clean package 2>&1 | tee /tmp/build.log
  70. # Write bubble API port
  71. echo \"export BUBBLE_SERVER_PORT=${BUBBLE_PORT}\" > ~/.bubble.env
  72. # Allow website to be loaded from disk
  73. echo \"export BUBBLE_ASSETS_DIR=$(pwd)/bubble-web/dist\" >> ~/.bubble.env
  74. # Add bubble bin to PATH
  75. echo \"export PATH=\${PATH}:${HOME}/bubble/bin\" >> ~/.bashrc
  76. # Set LETSENCRYPT_EMAIL is defined
  77. if [[ -n \"${LETSENCRYPT_EMAIL}\" ]] ; then
  78. echo \"export LETSENCRYPT_EMAIL=${LETSENCRYPT_EMAIL}\" >> ~/.bubble.env
  79. fi
  80. # Create env file symlink for running tests
  81. cd ~ && ln -s .bubble.env .bubble-test.env
  82. # Done!
  83. echo "
  84. ==================================================================
  85. Bubble Vagrant Setup Complete
  86. ==================================================================
  87. Log in to this box using:
  88. vagrant ssh
  89. Once logged in:
  90. - the code is in ${HOME}/bubble
  91. - API environment file is ${HOME}/.bubble.env
  92. - start the API server (local launcher) with \`run.sh\`
  93. Enjoy!
  94. ==================================================================
  95. "
  96. SHELL
  97. end
  98. end