Skip to content

Commit a7c473b

Browse files
committed
Update README.md for clarity and add fix_urls.sh script for URL updates
1 parent cf0989c commit a7c473b

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

docker_all/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ This directory contains the Docker configuration for running the WebMall e-comme
1515
Create a `.env` file in the parent directory (one level up from this `docker_all` folder):
1616

1717
```bash
18-
# Copy the example file
18+
# Copy the example env file from the docker_all dir
1919
cp ../.env.example ../.env
20+
# Copy the example env file from the root dir
21+
cp .env.example .env
2022
```
2123
Set the SHOP_PORT variable as desired.
2224

@@ -26,7 +28,7 @@ Set the SHOP_PORT variable as desired.
2628

2729
```bash
2830
cd docker_all
29-
./restore_all_and_deploy_local.sh
31+
bash ./restore_all_and_deploy_local.sh
3032
```
3133

3234
This script will:

docker_all/fix_urls.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
# Check if the port is provided as an argument
4+
if [ -z "$1" ]; then
5+
echo "Error: No port provided. Please specify the port as the first argument."
6+
exit 1
7+
fi
8+
9+
# Assign the port passed as an argument to the PORT variable
10+
PORT=$1
11+
12+
# Perform search-replace on the URLs
13+
# WARNING!: This search is not looking for exactly this string, so http://localhost:XXXX gets turned to http://localhost:XXXX:XXXX
14+
wp search-replace 'http://localhost' "http://localhost:${PORT}" --all-tables --path=/opt/bitnami/wordpress
15+
16+
# Clear the cache
17+
wp cache flush --path=/opt/bitnami/wordpress
18+
19+
echo "URLs updated to port ${PORT}"
20+

0 commit comments

Comments
 (0)