<commit_before>#! /usr/bin/env bash

# start services
service mysql start
service apache2 start

# set configuration variables & volumes
cd /var/www/htdocs
/root/bin/modman repair --force algoliasearch-magento
n98-magerun --root-dir=/var/www/htdocs config:set algoliasearch/credentials/application_id $APPLICATION_ID
n98-magerun --root-dir=/var/www/htdocs config:set algoliasearch/credentials/search_only_api_key $SEARCH_ONLY_API_KEY
n98-magerun --root-dir=/var/www/htdocs config:set algoliasearch/credentials/api_key $API_KEY
n98-magerun --root-dir=/var/www/htdocs config:set algoliasearch/credentials/index_prefix $INDEX_PREFIX
n98-magerun --root-dir=/var/www/htdocs config:set web/unsecure/base_url $BASE_URL
n98-magerun --root-dir=/var/www/htdocs config:set web/secure/base_url $BASE_URL

# GET / to initialize the algolia_search_indexer (Open to another cleaner way to do it :) )
wget $BASE_URL

chmod -R 777 /var/www/htdocs/media
chown -R www-data:www-data /var/www/htdocs/media

# reindex whole index
n98-magerun --root-dir=/var/www/htdocs index:reindex algolia_search_indexer
n98-magerun --root-dir=/var/www/htdocs index:reindex algolia_search_indexer_cat
n98-magerun --root-dir=/var/www/htdocs index:reindex algolia_search_indexer_pages
n98-magerun --root-dir=/var/www/htdocs index:reindex search_indexer_suggest

# do it after indexing so that var/log doesn't get created as root
n98-magerun --root-dir=/var/www/htdocs config:set dev/log/active 1

service apache2 stop
exec /usr/sbin/apache2ctl -D FOREGROUND<commit_msg>Fix rights for dockerfile<commit_after>#! /usr/bin/env bash

# start services
service mysql start
service apache2 start

# set configuration variables & volumes
cd /var/www/htdocs
/root/bin/modman repair --force algoliasearch-magento
n98-magerun --root-dir=/var/www/htdocs config:set algoliasearch/credentials/application_id $APPLICATION_ID
n98-magerun --root-dir=/var/www/htdocs config:set algoliasearch/credentials/search_only_api_key $SEARCH_ONLY_API_KEY
n98-magerun --root-dir=/var/www/htdocs config:set algoliasearch/credentials/api_key $API_KEY
n98-magerun --root-dir=/var/www/htdocs config:set algoliasearch/credentials/index_prefix $INDEX_PREFIX
n98-magerun --root-dir=/var/www/htdocs config:set web/unsecure/base_url $BASE_URL
n98-magerun --root-dir=/var/www/htdocs config:set web/secure/base_url $BASE_URL

# GET / to initialize the algolia_search_indexer (Open to another cleaner way to do it :) )
wget $BASE_URL

chmod -R 777 /var/www/htdocs/media
chown -R www-data:www-data /var/www/htdocs/media

# reindex whole index
n98-magerun --root-dir=/var/www/htdocs index:reindex algolia_search_indexer
n98-magerun --root-dir=/var/www/htdocs index:reindex algolia_search_indexer_cat
n98-magerun --root-dir=/var/www/htdocs index:reindex algolia_search_indexer_pages
n98-magerun --root-dir=/var/www/htdocs index:reindex search_indexer_suggest

# Again in case root created some folder with root:root
chmod -R 777 /var/www/htdocs/media
chown -R www-data:www-data /var/www/htdocs/media

# do it after indexing so that var/log doesn't get created as root
n98-magerun --root-dir=/var/www/htdocs config:set dev/log/active 1

service apache2 stop
exec /usr/sbin/apache2ctl -D FOREGROUND
{'fraction_non_alphanumeric': 0.10862122626828509, 'fraction_numerical': 0.018985371926548398, 'mean_word_length': 4.9408502772643255, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 36, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5956143', 'n_tokens_mistral': 1225, 'n_tokens_neox': 1152, 'n_words': 253}