Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with configure-instance.sh script on mac #51

Open
SamEdwardes opened this issue Jan 5, 2025 · 0 comments
Open

Issue with configure-instance.sh script on mac #51

SamEdwardes opened this issue Jan 5, 2025 · 0 comments

Comments

@SamEdwardes
Copy link

I am following the guide here:

I ran the following commands:

$ git clone https://github.com/TeamPiped/Piped-Docker

$ cd Piped-Docker

$ ./configure-instance.sh 
Enter a hostname for the Frontend (eg: piped.kavin.rocks):
piped.example.xyz
Enter a hostname for the Backend (eg: pipedapi.kavin.rocks):
piped-api.example.xyz
Enter a hostname for the Proxy (eg: pipedproxy.kavin.rocks):
piped-proxy.example.xyz
Enter the reverse proxy you would like to use (either caddy or nginx):
caddy
sed: 1: "config//pipedfrontend.conf": command c expects \ followed by text
sed: 1: "config//pipedfrontend.conf": command c expects \ followed by text
sed: 1: "config//pipedfrontend.conf": command c expects \ followed by text
sed: 1: "config/docker-compose.c ...": command c expects \ followed by text

I was able to fix it by modifying the configure-instance.sh script:

#!/bin/sh
echo "Enter a hostname for the Frontend (eg: piped.kavin.rocks):" && read -r frontend
echo "Enter a hostname for the Backend (eg: pipedapi.kavin.rocks):" && read -r backend
echo "Enter a hostname for the Proxy (eg: pipedproxy.kavin.rocks):" && read -r proxy
echo "Enter the reverse proxy you would like to use (either caddy or nginx):" && read -r reverseproxy

rm -rf config/
rm -f docker-compose.yml

cp -r template/ config/

conffiles=$(find config -type f ! -name '*.yml')
sed -i '' "s/FRONTEND_HOSTNAME/$frontend/g" $conffiles
sed -i '' "s/BACKEND_HOSTNAME/$backend/g" $conffiles
sed -i '' "s/PROXY_HOSTNAME/$proxy/g" $conffiles

sed -i '' "s/BACKEND_HOSTNAME_PLACEHOLDER/$backend/g" config/*.yml

mv config/docker-compose.$reverseproxy.yml docker-compose.yml

Why was it not working? Per Chat GPT:

Use Portable sed Syntax: The -i option in sed can behave differently on different systems (e.g., macOS vs Linux). To make it more portable, especially on macOS, you might need to provide an empty string for the backup extension:

sed -i '' "s/FRONTEND_HOSTNAME/$frontend/g" $conffiles
sed -i '' "s/BACKEND_HOSTNAME/$backend/g" $conffiles
sed -i '' "s/PROXY_HOSTNAME/$proxy/g" $conffiles
sed -i '' "s/BACKEND_HOSTNAME_PLACEHOLDER/$backend/g" config/*.yml
On Linux, the -i option can be used without a backup extension:

sed -i "s/FRONTEND_HOSTNAME/$frontend/g" $conffiles
sed -i "s/BACKEND_HOSTNAME/$backend/g" $conffiles
sed -i "s/PROXY_HOSTNAME/$proxy/g" $conffiles
sed -i "s/BACKEND_HOSTNAME_PLACEHOLDER/$backend/g" config/*.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant