-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from afup/config_clever_cloud
configuration pour déploiement sur clever cloud
- Loading branch information
Showing
8 changed files
with
110 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
if [[ -v HTPASSWD_USER && -v HTPASSWD_PASSWORD && -v HTACCESS_PATH ]]; then | ||
HTPASSWD_PATH=${APP_HOME}/.htpasswd | ||
cat <<EOT >> ${APP_HOME}/${HTACCESS_PATH} | ||
<IfFile ${HTPASSWD_PATH}> | ||
AuthType Basic | ||
AuthName "internal" | ||
AuthUserFile ${HTPASSWD_PATH} | ||
Require valid-user | ||
</IfFile> | ||
EOT | ||
|
||
htpasswd -s -b -c ${HTPASSWD_PATH} ${HTPASSWD_USER} ${HTPASSWD_PASSWORD} | ||
|
||
fi | ||
|
||
|
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,27 @@ | ||
#!/bin/bash -ex | ||
|
||
if ! [[ -v FSBUCKET_PROD_HOST && -v FSBUCKET_PROD_USER && -v FSBUCKET_PROD_PASSWORD ]]; then | ||
echo "Missing FSBUCKET env vars" | ||
exit 2 | ||
fi | ||
|
||
if ! [[ -v DB_PROD_HOST && -v DB_PROD_NAME && -v DB_PROD_USER && -v DB_PROD_PASSWORD && -v DB_PROD_PASSWORD ]]; then | ||
echo "Missing DB env vars" | ||
exit 2 | ||
fi | ||
|
||
|
||
# On charge la base depuis celle de prod | ||
mysqldump --column-statistics=0 --no-tablespaces --single-transaction -h $DB_PROD_HOST -P $DB_PROD_PORT -u $DB_PROD_USER -p$DB_PROD_PASSWORD $DB_PROD_NAME | mysql -h $MYSQL_ADDON_HOST -P $MYSQL_ADDON_PORT -u $MYSQL_ADDON_USER -p$MYSQL_ADDON_PASSWORD $MYSQL_ADDON_DB | ||
|
||
# On modifie les urls pour les adapter à la préprod | ||
mysql -h $MYSQL_ADDON_HOST -P $MYSQL_ADDON_PORT -u $MYSQL_ADDON_USER -p$MYSQL_ADDON_PASSWORD $MYSQL_ADDON_DB -e "UPDATE wp_2021_options SET option_value = replace(option_value, 'https://event.afup.org', 'https://event-preprod.afup.org') WHERE option_name = 'home' OR option_name = 'siteurl';" | ||
|
||
mysql -h $MYSQL_ADDON_HOST -P $MYSQL_ADDON_PORT -u $MYSQL_ADDON_USER -p$MYSQL_ADDON_PASSWORD $MYSQL_ADDON_DB -e "UPDATE wp_2021_posts SET guid = REPLACE (guid, 'https://event.afup.org', 'https://event-preprod.afup.org');" | ||
mysql -h $MYSQL_ADDON_HOST -P $MYSQL_ADDON_PORT -u $MYSQL_ADDON_USER -p$MYSQL_ADDON_PASSWORD $MYSQL_ADDON_DB -e "UPDATE wp_2021_posts SET guid = REPLACE (guid, 'http://event.afup.org', 'https://event-preprod.afup.org');" | ||
|
||
mysql -h $MYSQL_ADDON_HOST -P $MYSQL_ADDON_PORT -u $MYSQL_ADDON_USER -p$MYSQL_ADDON_PASSWORD $MYSQL_ADDON_DB -e "UPDATE wp_2021_postmeta SET meta_value = REPLACE (meta_value, 'https://event.afup.org', 'https://event-preprod.afup.org') WHERE meta_key = '_menu_item_url' ;" | ||
|
||
# On copie le bucket de prod vers le dossier de prod | ||
lftp ftp://$FSBUCKET_PROD_USER:$FSBUCKET_PROD_PASSWORD@$FSBUCKET_PROD_HOST -e "mirror / $APP_HOME/resources/uploads/ ; quit" | ||
# |
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 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 |
---|---|---|
|
@@ -19,3 +19,5 @@ RewriteRule . /index.php [L] | |
</IfModule> | ||
|
||
# END WordPress | ||
|
||
|
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