Skip to content

Commit

Permalink
mark installation as "complete" at the end of script
Browse files Browse the repository at this point in the history
we use an empty file in `~/.homestead-features` to mark a "feature" as installed. we should move to the end of the file, so we know the install has fully completed successfully.

I ran into this issue with the "webdriver" install. because Chrome does not have an ARM version, the install would fail, but the file would already be created, the provision scipt thought it succeeded.
  • Loading branch information
browner12 committed Jan 17, 2024
1 parent 41555c3 commit a93dfdd
Show file tree
Hide file tree
Showing 43 changed files with 125 additions and 129 deletions.
6 changes: 3 additions & 3 deletions scripts/features/blackfire.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ then
exit 0
fi

touch /home/$WSL_USER_NAME/.homestead-features/blackfire
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features

wget -q -O - https://packages.blackfire.io/gpg.key | apt-key add -
echo "deb http://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list

Expand Down Expand Up @@ -57,3 +54,6 @@ service php7.3-fpm restart
service php7.4-fpm restart
service php8.0-fpm restart
service blackfire-agent restart

touch /home/$WSL_USER_NAME/.homestead-features/blackfire
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
6 changes: 3 additions & 3 deletions scripts/features/cassandra.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ then
exit 0
fi

touch /home/$WSL_USER_NAME/.homestead-features/cassandra
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features

# Install Cassandra and driver dependencies
echo "deb http://www.apache.org/dist/cassandra/debian 311x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
wget -q -O - https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add -
Expand Down Expand Up @@ -94,3 +91,6 @@ sudo rm -R /usr/src/php-driver
echo "JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64" | sudo tee -a /etc/default/cassandra
sudo service cassandra stop
sudo service cassandra start

touch /home/$WSL_USER_NAME/.homestead-features/cassandra
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
6 changes: 3 additions & 3 deletions scripts/features/chronograf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ then
exit 0
fi

touch /home/$WSL_USER_NAME/.homestead-features/chronograf
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features

chronourl="https://dl.influxdata.com/chronograf/releases/chronograf_1.5.0.1_amd64.deb"

wget -q -O chronograf.deb $chronourl
Expand All @@ -28,3 +25,6 @@ rm chronograf.deb
systemctl enable chronograf
systemctl daemon-reload
systemctl start chronograf

touch /home/$WSL_USER_NAME/.homestead-features/chronograf
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
6 changes: 3 additions & 3 deletions scripts/features/couchdb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ then
exit 0
fi

touch /home/$WSL_USER_NAME/.homestead-features/couchdb
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features

echo "deb https://apache.bintray.com/couchdb-deb focal main" \
| sudo tee -a /etc/apt/sources.list.d/couchdb.list

Expand Down Expand Up @@ -47,3 +44,6 @@ sudo service php7.2-fpm restart
sudo service php7.3-fpm restart
sudo service php7.4-fpm restart
sudo service php8.0-fpm restart

touch /home/$WSL_USER_NAME/.homestead-features/couchdb
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
6 changes: 3 additions & 3 deletions scripts/features/crystal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ then
exit 0
fi

touch /home/$WSL_USER_NAME/.homestead-features/crystal
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features

# Install Crystal Programming Language Support
curl -sL "https://keybase.io/crystal/pgp_keys.asc" | sudo apt-key add -
echo "deb https://dist.crystal-lang.org/apt crystal main" | sudo tee /etc/apt/sources.list.d/crystal.list
Expand All @@ -36,3 +33,6 @@ mv lucky /usr/local/bin/.
cd /home/vagrant
rm -rf lucky_cli-0.11.0
rm -rf v0.11.0.tar.gz

touch /home/$WSL_USER_NAME/.homestead-features/crystal
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
6 changes: 3 additions & 3 deletions scripts/features/dockstead.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ then
exit 0
fi

touch /home/$WSL_USER_NAME/.homestead-features/dockstead
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features

# Ensure we're in swarm mode
docker swarm init --advertise-addr 192.168.56.56

touch /home/$WSL_USER_NAME/.homestead-features/dockstead
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
2 changes: 1 addition & 1 deletion scripts/features/dragonflydb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ rm -rf dragonflydb.tar.gz

# Mark installation as complete
touch /home/$WSL_USER_NAME/.homestead-features/dragonflydb
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
8 changes: 3 additions & 5 deletions scripts/features/elasticsearch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ then
exit 0
fi

touch /home/$WSL_USER_NAME/.homestead-features/elasticsearch
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features

# Determine version from config

set -- "$1"
Expand All @@ -32,11 +29,9 @@ else
majorVersion="$(echo $version | head -c 1)"
fi


echo "Elasticsearch installVersion: $installVersion"
echo "Elasticsearch majorVersion: $majorVersion"


# Install Java & Elasticsearch

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
Expand All @@ -61,3 +56,6 @@ sudo sed -i "s/#cluster.name: my-application/cluster.name: homestead/" /etc/elas

sudo systemctl enable elasticsearch.service
sudo service elasticsearch start

touch /home/$WSL_USER_NAME/.homestead-features/elasticsearch
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
6 changes: 3 additions & 3 deletions scripts/features/eventstore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ then
exit 0
fi

touch /home/$WSL_USER_NAME/.homestead-features/eventstore
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features

# Determine wanted version from config
set -- "$1"
IFS=".";
Expand Down Expand Up @@ -52,3 +49,6 @@ setcap CAP_NET_BIND_SERVICE=+eip /usr/bin/eventstored
# Enable and Start EventStore
systemctl enable eventstore.service
systemctl start eventstore.service

touch /home/$WSL_USER_NAME/.homestead-features/eventstore
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
6 changes: 3 additions & 3 deletions scripts/features/flyway.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ then
exit 0
fi

touch /home/$WSL_USER_NAME/.homestead-features/flyway
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features

# Install Flyway
wget https://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/4.2.0/flyway-commandline-4.2.0-linux-x64.tar.gz
tar -zxvf flyway-commandline-4.2.0-linux-x64.tar.gz -C /usr/local
chmod +x /usr/local/flyway-4.2.0/flyway
ln -s /usr/local/flyway-4.2.0/flyway /usr/local/bin/flyway
rm -rf flyway-commandline-4.2.0-linux-x64.tar.gz

touch /home/$WSL_USER_NAME/.homestead-features/flyway
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
6 changes: 3 additions & 3 deletions scripts/features/gearman.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ then
exit 0
fi

touch /home/$WSL_USER_NAME/.homestead-features/gearman
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features

# Install Gearman Job Server and PHP Extension
sudo apt-get update
sudo apt-get install gearman-job-server php-gearman -y

# Listen on 0.0.0.0
sudo sed -i 's/localhost/0.0.0.0/g' /etc/default/gearman-job-server
sudo service gearman-job-server restart

touch /home/$WSL_USER_NAME/.homestead-features/gearman
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
6 changes: 3 additions & 3 deletions scripts/features/golang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ then
exit 0
fi

touch /home/$WSL_USER_NAME/.homestead-features/golang
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features

ARCH=$(arch)

# Install Golang
Expand All @@ -33,3 +30,6 @@ fi
tar -C /usr/local -xzf golang.tar.gz go
printf "\nPATH=\"/usr/local/go/bin:\$PATH\"\n" | tee -a /home/vagrant/.profile
rm -rf golang.tar.gz

touch /home/$WSL_USER_NAME/.homestead-features/golang
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
6 changes: 3 additions & 3 deletions scripts/features/grafana.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ then
exit 0
fi

touch /home/$WSL_USER_NAME/.homestead-features/grafana
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features

echo "deb https://packages.grafana.com/oss/deb stable main" > /etc/apt/sources.list.d/grafana.list
curl -s https://packages.grafana.com/gpg.key | apt-key add -

Expand All @@ -28,3 +25,6 @@ apt-get install -y grafana
systemctl enable grafana-server
systemctl daemon-reload
systemctl start grafana-server

touch /home/$WSL_USER_NAME/.homestead-features/grafana
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
6 changes: 3 additions & 3 deletions scripts/features/heroku.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ then
exit 0
fi

touch /home/$WSL_USER_NAME/.homestead-features/heroku
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features

# Install Heroku CLI
curl https://cli-assets.heroku.com/install-ubuntu.sh | sh

touch /home/$WSL_USER_NAME/.homestead-features/heroku
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
6 changes: 3 additions & 3 deletions scripts/features/logstash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ then
exit 0
fi

touch /home/$WSL_USER_NAME/.homestead-features/logstash
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features

# Determine version from config

set -- "$1"
Expand Down Expand Up @@ -52,3 +49,6 @@ sudo apt-get -y install logstash"$installVersion"
# Enable Start Elasticsearch

sudo systemctl enable --now logstash.service

touch /home/$WSL_USER_NAME/.homestead-features/logstash
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
6 changes: 3 additions & 3 deletions scripts/features/mailpit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ then
exit 0
fi

touch /home/$WSL_USER_NAME/.homestead-features/mailpit
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features

curl -sL https://raw.githubusercontent.com/axllent/mailpit/develop/install.sh | sh

chown -f $WSL_USER_NAME:$WSL_USER_GROUP /usr/local/bin/mailpit
Expand All @@ -39,3 +36,6 @@ EOF
systemctl disable --now mailpit

systemctl enable --now mailpit

touch /home/$WSL_USER_NAME/.homestead-features/mailpit
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
6 changes: 3 additions & 3 deletions scripts/features/mariadb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ if [ -f /home/$WSL_USER_NAME/.homestead-features/mariadb ]; then
exit 0
fi

touch /home/$WSL_USER_NAME/.homestead-features/mariadb
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features

# Disable Apparmor
# See https://github.com/laravel/homestead/issues/629#issue-247524528
service apparmor stop
Expand Down Expand Up @@ -80,3 +77,6 @@ mariadb-upgrade --user="root" --verbose --force
service mariadb restart

unset MYSQL_PWD

touch /home/$WSL_USER_NAME/.homestead-features/mariadb
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
6 changes: 3 additions & 3 deletions scripts/features/meilisearch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ then
exit 0
fi

touch /home/$WSL_USER_NAME/.homestead-features/meilisearch
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features

# add the sources for meilisearch
curl -L https://install.meilisearch.com | sh
mv ./meilisearch /usr/bin/
Expand All @@ -43,3 +40,6 @@ systemctl enable meilisearch

# Start the meilisearch service
systemctl start meilisearch

touch /home/$WSL_USER_NAME/.homestead-features/meilisearch
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
7 changes: 3 additions & 4 deletions scripts/features/minio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ fi

ARCH=$(arch)


touch /home/$WSL_USER_NAME/.homestead-features/minio
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features

if [[ "$ARCH" == "aarch64" ]]; then
curl -sO https://dl.minio.io/server/minio/release/linux-arm64/minio
else
Expand Down Expand Up @@ -66,3 +62,6 @@ fi
chmod +x mc
sudo mv mc /usr/local/bin
mc config host add homestead http://127.0.1.1:9600 homestead secretkey

touch /home/$WSL_USER_NAME/.homestead-features/minio
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
6 changes: 3 additions & 3 deletions scripts/features/mongodb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ fi

ARCH=$(arch)

touch /home/$WSL_USER_NAME/.homestead-features/mongodb
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features

if [[ "$ARCH" == "aarch64" ]]; then
echo "deb [ arch=arm64 ] https://repo.mongodb.org/apt/ubuntu $(lsb_release -cs)/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
else
Expand Down Expand Up @@ -163,3 +160,6 @@ sudo ln -s /etc/php/8.2/mods-available/mongo.ini /etc/php/8.2/fpm/conf.d/20-mong
sudo service php8.2-fpm restart

mongosh admin --eval "db.createUser({user:'homestead',pwd:'secret',roles:['root']})"

touch /home/$WSL_USER_NAME/.homestead-features/mongodb
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
6 changes: 3 additions & 3 deletions scripts/features/neo4j.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ then
exit 0
fi

touch /home/$WSL_USER_NAME/.homestead-features/neo4j
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features

wget -O - https://debian.neo4j.org/neotechnology.gpg.key | sudo apt-key add -
echo 'deb https://debian.neo4j.org/repo stable/' | sudo tee -a /etc/apt/sources.list.d/neo4j.list
apt-get update
Expand Down Expand Up @@ -50,3 +47,6 @@ cypher-shell -u neo4j -p secret "CALL dbms.security.createUser('homestead', 'sec

# Delete default Neo4j user
cypher-shell -u homestead -p secret "CALL dbms.security.deleteUser('neo4j');"

touch /home/$WSL_USER_NAME/.homestead-features/neo4j
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
6 changes: 3 additions & 3 deletions scripts/features/ohmyzsh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ then
exit 0
fi

touch /home/$WSL_USER_NAME/.homestead-features/oh-my-zsh
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features

# Install oh-my-zsh
git clone https://github.com/ohmyzsh/ohmyzsh.git /home/vagrant/.oh-my-zsh
cp /home/vagrant/.oh-my-zsh/templates/zshrc.zsh-template /home/vagrant/.zshrc
Expand All @@ -37,3 +34,6 @@ chown -R vagrant:vagrant /home/vagrant/.oh-my-zsh
chown vagrant:vagrant /home/vagrant/.zshrc
chown vagrant:vagrant /home/vagrant/.zprofile
chsh -s /bin/zsh vagrant

touch /home/$WSL_USER_NAME/.homestead-features/oh-my-zsh
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
6 changes: 3 additions & 3 deletions scripts/features/openresty.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ then
exit 0
fi

touch /home/$WSL_USER_NAME/.homestead-features/openresty
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features

# Install Openresty

wget -qO - https://openresty.org/package/pubkey.gpg | sudo apt-key add -
Expand All @@ -33,3 +30,6 @@ sudo sed -i "s/listen\s*80;/listen\ 8888;/g" /etc/openresty/nginx.conf

sudo service openresty restart
sudo service nginx start

touch /home/$WSL_USER_NAME/.homestead-features/openresty
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
6 changes: 3 additions & 3 deletions scripts/features/php5.6.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ then
exit 0
fi

touch /home/$WSL_USER_NAME/.homestead-features/php56
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features

# PHP 5.6
apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --allow-change-held-packages \
php5.6-bcmath php5.6-bz2 php5.6-cgi php5.6-cli php5.6-common php5.6-curl php5.6-dba php5.6-dev php5.6-enchant \
Expand Down Expand Up @@ -72,3 +69,6 @@ sed -i "s/;listen\.mode.*/listen.mode = 0666/" /etc/php/5.6/fpm/pool.d/www.conf

systemctl enable php5.6-fpm
service php5.6-fpm restart

touch /home/$WSL_USER_NAME/.homestead-features/php56
chown -Rf $WSL_USER_NAME:$WSL_USER_GROUP /home/$WSL_USER_NAME/.homestead-features
Loading

0 comments on commit a93dfdd

Please sign in to comment.