Start script builder as root, compile BS

This commit is contained in:
Arsenii Petrovich 2019-06-07 23:20:15 +03:00
parent aaf83a4044
commit 896fc932a8
2 changed files with 13 additions and 8 deletions

View File

@ -37,6 +37,7 @@
"type": "shell"
},
{
"execute_command": "echo 'packer' | sudo -S env {{ .Vars }} {{ .Path }}"
"scripts": [
"./base/tasks/update.sh"
],

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
#ELIXIR_VERSION and BS_RELEASE should be defined as environment variables
set -e
set -e -x
LOG=/var/log/user_data.log
@ -66,13 +66,6 @@ if ! which git >/dev/null; then
yum install -y git >"$LOG"
fi
mkdir /opt > /dev/null
git clone https://github.com/poanetwork/blockscout -b ${BS_RELEASE} /opt/app
mkdir -p /opt/app
chown -R ec2-user /opt/app
log "Creating explorer systemd service.."
cat <<EOF > /lib/systemd/system/explorer.service
@ -128,4 +121,15 @@ log "Preinstalled software is ready!"
log "Starting CodeDeploy agent.."
service codedeploy-agent start >"$LOG"
mkdir /opt > /dev/null
git clone https://github.com/poanetwork/blockscout -b ${BS_RELEASE} /opt/app
/opt/app/bin/deployment/stop
/opt/app/bin/deployment/build
/opt/app/bin/deployment/migrate
mkdir -p /opt/app
chown -R ec2-user /opt/app
exit 0