-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- No load balancers - No autoscaling - Output set to single node IP address fixed issue with singlenode instance being provisioned in clustered mode Single-node network interface attachment to ensure connectivity without load balancer updated gitignore Kibana image
- Loading branch information
1 parent
53691d2
commit 2204189
Showing
16 changed files
with
192 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Required variables | ||
# - aws_region | ||
# - es_cluster | ||
# - elasticsearch_data_dir | ||
|
||
AV_ZONE="$(ec2metadata --availability-zone)" | ||
INSTANCE_ROLE="$(aws ec2 describe-tags --region $aws_region --filters Name=resource-id,Values=$(ec2metadata --instance-id) | jq -r '.Tags[] | select(.Key == "Role") | .Value')" | ||
echo "AV_ZONE: $AV_ZONE" | ||
echo "INSTANCE_ROLE: $INSTANCE_ROLE" | ||
|
||
while true; do | ||
echo "UNATTACHED_ENI_ID: $eni_id" | ||
|
||
aws ec2 attach-network-interface --instance-id=$(ec2metadata --instance-id) --device-index 1 --network-interface-id ${eni_id} --region "$aws_region" | ||
if [ "$?" != "0" ]; then | ||
sleep 10 | ||
continue | ||
fi | ||
|
||
ATTACHMENTS_COUNT="$(aws ec2 describe-network-interfaces --region $aws_region --filters Name=network-interface-id,Values=${eni_id} | jq -r '.NetworkInterfaces[0].Attachment | length')" | ||
if [ "$ATTACHMENTS_COUNT" != "0" ]; then break; fi | ||
done | ||
|
||
echo "Updating network configuration" | ||
|
||
cat <<EOF >/etc/netplan/51-ens6.yaml | ||
network: | ||
version: 2 | ||
renderer: networkd | ||
ethernets: | ||
ens6: | ||
addresses: | ||
- ${eni_ipv4}/20 | ||
dhcp4: no | ||
routes: | ||
- to: 0.0.0.0/0 | ||
via: 172.31.16.1 # Default gateway | ||
table: 1000 | ||
- to: ${eni_ipv4} | ||
via: 0.0.0.0 | ||
scope: link | ||
table: 1000 | ||
routing-policy: | ||
- from: ${eni_ipv4} | ||
table: 1000 | ||
EOF | ||
|
||
sleep 5 | ||
|
||
netplan apply | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,76 @@ | ||
#!/bin/bash | ||
set +e | ||
|
||
echo "Testing AMI Builder if it works properly" | ||
|
||
|
||
echo "Running common env script" | ||
. /opt/cloud-deploy-scripts/common/env.sh | ||
. /opt/cloud-deploy-scripts/$cloud_provider/env.sh | ||
|
||
if [ -e /opt/cloud-deploy-scripts/$cloud_provider/env.sh ]; then | ||
echo "Running ${cloud_provider} env script" | ||
. /opt/cloud-deploy-scripts/$cloud_provider/env.sh | ||
fi | ||
|
||
# It is required to bind to all interfaces for load balancer on GCP to work | ||
if [ "$cloud_provider" == "gcp" ]; then | ||
export BIND_TO_ALL="true" | ||
fi | ||
|
||
echo "Running EBS volume autoattach script" | ||
/opt/cloud-deploy-scripts/$cloud_provider/autoattach-disk.sh | ||
|
||
echo "Running ENI autoattach script" | ||
/opt/cloud-deploy-scripts/$cloud_provider/autoattach-network.sh | ||
|
||
echo "Running config-es script" | ||
/opt/cloud-deploy-scripts/common/config-es.sh | ||
|
||
echo "Running config-beats script" | ||
/opt/cloud-deploy-scripts/common/config-beats.sh | ||
|
||
echo "Running ${cloud_provider}/config-es script" | ||
/opt/cloud-deploy-scripts/$cloud_provider/config-es.sh | ||
|
||
echo "Running ${cloud_provider}/config-es-discovery script" | ||
/opt/cloud-deploy-scripts/$cloud_provider/config-es-discovery.sh | ||
|
||
echo "Creating elasticsearch.yml file" | ||
cat <<'EOF' >>/etc/elasticsearch/elasticsearch.yml | ||
node.master: true | ||
node.data: true | ||
node.ingest: true | ||
discovery.type: single-node | ||
EOF | ||
|
||
echo "Running config/clients script" | ||
|
||
/opt/cloud-deploy-scripts/common/config-clients.sh | ||
|
||
# add bootstrap.password to the keystore, so that config-cluster scripts can run | ||
# only done on bootstrap and singlenode nodes, before starting ES | ||
if [ "${security_enabled}" == "true" ]; then | ||
echo "Configuring elasticsearch keystore" | ||
echo "${client_pwd}" | /usr/share/elasticsearch/bin/elasticsearch-keystore add --stdin bootstrap.password | ||
fi | ||
|
||
#Fix IP Address | ||
echo "Rewriting ENI IP Address in elasticsearch.yml" | ||
sed -i -re "s/_ec2:privateIpv4_/${eni_ipv4}/ig" /etc/elasticsearch/elasticsearch.yml | ||
|
||
# Start Elasticsearch | ||
echo "Starting elasticsearch service" | ||
|
||
systemctl daemon-reload | ||
systemctl enable elasticsearch.service | ||
systemctl start elasticsearch.service | ||
|
||
echo "Running config-cluster script" | ||
/opt/cloud-deploy-scripts/common/config-cluster.sh | ||
/opt/cloud-deploy-scripts/$cloud_provider/config-cluster.sh | ||
|
||
|
||
echo "Running ${cloud_provider}/config-cluster script" | ||
/opt/cloud-deploy-scripts/$cloud_provider/config-cluster.sh | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.