Last active
April 18, 2024 20:26
-
-
Save nickopris/de1607170be42678565e7ee35bed12da to your computer and use it in GitHub Desktop.
Development setup
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
# Prerequisites | |
# place this script in a directory called tools to sit at he same level as your project directory | |
# an .env file with credentials inside tools | |
# get the solr archive from prod or me. should be extracted into tools with the name solr_8.x_config | |
# Be aware that git pull and docker image pull are subjected to quota limits and may need to authenticate. | |
# script vars | |
PROJECT_DIRECTORY="your-project-new-folder" | |
MY_FORKED_REPO='https://github.com/...' | |
# git clone repo fork | |
git clone $MY_FORKED_REPO "../$PROJECT_DIRECTORY" | |
# switch to directory | |
cd "../$PROJECT_DIRECTORY" || exit | |
# run composer install | |
composer install | |
# run npm install | |
npm install | |
# make override file docker-compose.yml | |
cp docker-compose.yml docker-compose.override.yml | |
# add nextcloud credentials in the above file | |
sed -i '' -e '/ASDA CREDENTIALS/a\ | |
NEXTCLOUD_USER: ${NEXTCLOUD_USER}\ | |
NEXTCLOUD_PASS: ${NEXTCLOUD_PASS}\ | |
QA_API_AUTH_TOKEN: ${QA_API_AUTH_TOKEN}' "$(pwd)/docker-compose.override.yml" | |
# add mysql container name | |
sed -i '' -e '/image: percona\/percona-server:8.0/a\ | |
container_name: the-mysql' "$(pwd)/docker-compose.override.yml" | |
# map solr config locally so we can replace config files | |
sed -i '' -e '/image: wodby\/solr:8-4.18.0/a\ | |
volumes:\ | |
- ./solr:/opt/solr/custom' "$(pwd)/docker-compose.override.yml" | |
# add env vars for both files in docker-compose.override.yml | |
sed -i '' -e '/web:/a\ | |
env_file:\ | |
- .env\ | |
- .env.dist' "$(pwd)/docker-compose.override.yml" | |
# add .env in the .gitignore file | |
sed -i '' -e '/.env.dev/a\ | |
.env' "$(pwd)/.gitignore" | |
# copy .env file with credentials | |
cp ../tools/.env .env | |
# start containers | |
ahoy up | |
# wait for the containers to be up | |
until [ "`docker inspect -f {{.State.Running}} the-mysql`"=="true" ]; do | |
sleep 0.1; | |
done; | |
# get database from dump source | |
ahoy dump | |
ahoy clone | |
ahoy drush c4d_user:sanitize-reduce-user-length | |
# setup the solr core | |
docker-compose exec solr /opt/solr/bin/solr create -c c4dev -n search_api_solr_4.3.3 | |
wait 5 | |
cp -r ../tools/solr_8.x_config solr | |
docker-compose exec -u root solr rm -rf /opt/solr/server/c4dev/conf | |
docker-compose exec -u root solr cp -r /opt/solr/custom /opt/solr/server/c4dev/conf | |
docker-compose exec -u root solr chown -R solr:solr /opt/solr/server/c4dev/conf | |
ahoy reboot | |
# wait for the containers to be up | |
until [ "`docker inspect -f {{.State.Running}} intpa-c4dev-mysql`"=="true" ]; do | |
sleep 0.1; | |
done; | |
# use remote images | |
ahoy drush en stage_file_proxy -y | |
ahoy drush config-set stage_file_proxy.settings origin "https://capacity4dev.europa.eu" | |
# clear all image styles | |
ahoy drush if --all |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment