Introduce packer support (#18)
cleanups and fixes, packer is ready to roll
add errorApi endpoint
initialize mitmproxy dependencies
packer deployments finally working
fix virtualenv call for ubuntu 20.04
WIP. update to ubuntu 20.04. fixing algo installation
WIP. packer fixes
remove unused constant
WIP. packer basics working for ec2
Merge branch 'master' of git.bubblev.org:bubblev/bubble into cobbzilla/introduce_packer
remove automation dir, all moved to resources
log pg autovacuum if longer than 250ms
touch install marker for algo
set mitmproxy as owner of all mitmproxy files
add hostname to packer image name
avoid closing progress meter prematurely
WIP. parallelize node startup, fix packer bugs
clarify docs
add missing vars, algo tweaks
add missing vars, update algo hash
WIP. improving algo/mitmproxy packer stuff
install packer for sage, call packer from proper location
Use compute driver to get regions
improve comments
wait longer before polling new vultr server, avoid spurious ok status
unquote simple filenames
WIP. Use packer key, no more instance ssh key. Change API installation. Simplify packer/ansible.
rename bubble_finalizer to just finalizer, remove default_roles
filter servers/images based on installType
for now, consider packer image OK if bubble version matches
add algo/mitm roles to packer. add installType to BubbleNode
fix NODE_ROLES file
templatize packer file and playbook, use same template for sage and node
WIP: refactor addAllRegions
WIP: do not re-create identical images
WIP: packer build for vultr now working
Merge branch 'master' of git.bubblev.org:bubblev/bubble into cobbzilla/introduce_packer
WIP. working on vultr packer builds
WIP: packer image creation working for digitalocean
WIP: packer basics working for digitalocean
add packer endpoints, introduce packer support to cloud compute drivers
remove roles endpoints
AnsibleRole is no longer an model entity. Introduce Packer.
Merge branch 'sfedoriv/APIAddSupportForAmazonEC2ComputeCloudService' of git.bubblev.org:bubblev/bubble into sfedoriv/APIAddSupportForAmazonEC2ComputeCloudService
Merge branch 'master' of git.bubblev.org:bubblev/bubble into sfedoriv/APIAddSupportForAmazonEC2ComputeCloudService
Merge branch 'master' into sfedoriv/APIAddSupportForAmazonEC2ComputeCloudService
Merge branch 'master' into sfedoriv/APIAddSupportForAmazonEC2ComputeCloudService
Merge branch 'master' into sfedoriv/APIAddSupportForAmazonEC2ComputeCloudService
Merge branch 'master' into sfedoriv/APIAddSupportForAmazonEC2ComputeCloudService
Add instance count to script
Co-authored-by: Jonathan Cobb <jonathan@kyuss.org>
Co-authored-by: Svitlana <sfedoriv@itekako.com>
Reviewed-on: https://git.bubblev.org/bubblev/bubble/pulls/18
4 anni fa |
12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- #!/bin/bash
- #
- # Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/
- #
- function die {
- echo 1>&2 "${1}"
- exit 1
- }
-
- function db_user_exists {
- username="${1}"
- num_users="$(echo "select count(*) from pg_user where usename='${username}'" | su - postgres psql -qt | egrep -v '^$')"
- if [[ -z "${num_users}" || ${num_users} -eq 0 ]] ; then
- echo "0"
- else
- echo "1"
- fi
- }
-
- # Ensure system is current
- sudo apt update -y || die "Error running apt update"
- sudo apt upgrade -y || die "Error running apt upgrade"
-
- # Install packages
- sudo apt install openjdk-11-jdk maven postgresql redis-server jq python3 python3-pip npm webpack curl unzip -y || die "Error installing apt packages"
- sudo pip3 install setuptools psycopg2-binary || die "Error installing pip packages"
-
- # Install packer
- BUBBLE_BIN="$(cd "$(dirname "${0}")" && pwd)"
- "${BUBBLE_BIN}/install_packer.sh" || die "Error installing packer"
-
- # Create DB user for current user, as superuser
- CURRENT_USER="$(whoami)"
- if [[ $(db_user_exists ${CURRENT_USER}) ]] ; then
- echo "PostgreSQL user ${CURRENT_USER} already exists, not creating"
- else
- sudo su - postgres bash -c 'createuser -U postgres --createdb --createrole --superuser '"${CURRENT_USER}"'' || die "Error creating ${CURRENT_USER} DB user"
- fi
-
- PG_HBA=$(find /etc/postgresql -mindepth 1 -maxdepth 1 -type d | sort | tail -1)/main/pg_hba.conf
- sudo cat ${PG_HBA} | sed -e 's/ peer/ trust/g' | sed -e 's/ md5/ trust/g' > /tmp/pg_hba.conf || die "Error filtering ${PG_HBA}"
- sudo bash -c "cat /tmp/pg_hba.conf > ${PG_HBA}" || die "Error rewriting ${PG_HBA}"
- sudo service postgresql restart || die "Error restarting pgsql"
-
- # Create DB user 'bubble', with the ability to create databases
- createuser --createdb bubble || die "Error creating bubble DB user"
|