The main Bubble source repository. Contains the Bubble API server, the web UI, documentation and utilities. https://getbubblenow.com
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 

85 lignes
2.8 KiB

  1. #!/bin/bash
  2. #
  3. # Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/
  4. #
  5. # Perform one-time setup of a new Mac OS X system.
  6. #
  7. # NOTE: you must manually install AdoptOpenJDK 11 from https://adoptopenjdk.net/index.html?variant=openjdk11&jvmVariant=hotspot
  8. #
  9. # It is safe to run this multiple times, it is idempotent.
  10. #
  11. function die {
  12. echo 1>&2 "${1}"
  13. exit 1
  14. }
  15. function db_user_exists {
  16. username="${1}"
  17. num_users="$(echo "select count(*) from pg_user where usename='${username}'" | psql -qt template1 | egrep -v '^$')"
  18. if [[ -z "${num_users}" || ${num_users} -eq 0 ]] ; then
  19. echo "0"
  20. else
  21. echo "1"
  22. fi
  23. }
  24. # Install packer
  25. BUBBLE_BIN="$(cd "$(dirname "${0}")" && pwd)"
  26. "${BUBBLE_BIN}/install_packer.sh" || die "Error installing packer"
  27. if [[ -z "$(which brew)" ]] ; then
  28. # Install homebrew
  29. /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
  30. fi
  31. # Install emacs
  32. brew cask install emacs
  33. # Install AdoptOpenJDK 11
  34. echo ; echo '
  35. ----------------------------------------------------------------------------------------------------------------
  36. >>> Manual installation of Java is required
  37. >>> Please install AdoptOpenJDK 11 from https://adoptopenjdk.net/index.html?variant=openjdk11&jvmVariant=hotspot
  38. ----------------------------------------------------------------------------------------------------------------
  39. '
  40. # Install packages
  41. brew install maven
  42. brew install postgresql@10 && brew services start postgresql@10
  43. brew install redis && brew services start redis
  44. brew install jq
  45. brew install python@3.8
  46. brew install npm
  47. brew install webpack
  48. sudo pip3 install setuptools psycopg2-binary
  49. # Add python paths to script rc
  50. export LDFLAGS="-L/usr/local/opt/python@3.8/lib"
  51. export PATH="/usr/local/opt/python@3.8/bin:$PATH"
  52. CURRENT_USER="$(whoami)"
  53. # Create DB user 'postgres' as super admin
  54. if [[ $(db_user_exists 'postgres') == "1" ]] ; then
  55. echo "PostgreSQL user 'postgres' already exists, not creating"
  56. else
  57. echo "Creating PostgreSQL user: postgres"
  58. createuser --createdb --superuser --createrole postgres || die "Error creating postgres DB user"
  59. fi
  60. # Create DB user for current user as super admin
  61. if [[ $(db_user_exists "${CURRENT_USER}") == "1" ]] ; then
  62. echo "PostgreSQL user ${CURRENT_USER} already exists, not creating"
  63. else
  64. echo "Creating PostgreSQL user: ${CURRENT_USER}"
  65. createuser --createdb --superuser --createrole postgres || die "Error creating ${CURRENT_USER} DB user"
  66. fi
  67. # Create DB user 'bubble', with the ability to create databases
  68. if [[ $(db_user_exists 'bubble') == "1" ]] ; then
  69. echo "PostgreSQL user bubble already exists, not creating"
  70. else
  71. echo "Creating PostgreSQL user: bubble"
  72. createuser --createdb bubble || die "Error creating bubble DB user"
  73. fi