diff --git a/Dockerfile b/Dockerfile index cc24add..334c347 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,6 @@ WORKDIR /app COPY run.sh ./ - RUN chmod +x ./run.sh ENTRYPOINT ["./run.sh"] diff --git a/app_url.txt b/app_url.txt index ce1fb77..ac4ee56 100644 --- a/app_url.txt +++ b/app_url.txt @@ -1 +1 @@ -https://s464951-gitea-451bd4d0ed7a.herokuapp.com/ +https://s464951-gitea-530091612f47.herokuapp.com/ diff --git a/deploy.sh b/deploy.sh index cb26757..475d7b9 100755 --- a/deploy.sh +++ b/deploy.sh @@ -13,6 +13,9 @@ heroku addons:create heroku-postgresql:essential-0 --app $APP_NAME echo "Waiting for Heroku Postgres to be fully provisioned..." heroku pg:wait --app $APP_NAME +echo DATABASE_URL +echo $DATABASE_URL + # Push to Heroku heroku git:remote --app $APP_NAME git add . @@ -20,4 +23,4 @@ git commit -m "Deploy to Heroku" git push heroku main # Open the app in the browser -heroku open --app $APP_NAME \ No newline at end of file +# heroku open --app $APP_NAME \ No newline at end of file diff --git a/run.sh b/run.sh index 5cce56d..5ef478a 100644 --- a/run.sh +++ b/run.sh @@ -1,9 +1,9 @@ #!/bin/bash -echo APP_URL: -echo $APP_URL -echo DATABASE_URL: -echo $DATABASE_URL + +FILE=/app/app_url.txt +ROOT_URL=$(cat $FILE) + HOST=`echo $DATABASE_URL | grep -o "@.*/" | sed 's/.$//' | cut -c 2-` NAME=`echo $DATABASE_URL | grep -o "/[[:alnum:]]*$" | cut -c 2-` @@ -13,7 +13,7 @@ PASSWD=`echo $DATABASE_URL | grep -o ":[[:alnum:]]*@" | grep -o "[[:alnum:]]*"` mkdir -p /var/lib/gitea/custom/conf echo "[server]" > /var/lib/gitea/custom/conf/app.ini -echo "ROOT_URL = $APP_URL" >> /var/lib/gitea/custom/conf/app.ini +echo "ROOT_URL = $ROOT_URL >> /var/lib/gitea/custom/conf/app.ini echo "[database]" >> /var/lib/gitea/custom/conf/app.ini echo "DB_TYPE = postgres" >> /var/lib/gitea/custom/conf/app.ini @@ -23,5 +23,4 @@ echo "USER = $USER" >> /var/lib/gitea/custom/conf/app.ini echo "PASSWD = $PASSWD" >> /var/lib/gitea/custom/conf/app.ini echo "SSL_MODE = require" >> /var/lib/gitea/custom/conf/app.ini -cat /var/lib/gitea/custom/conf/app.ini /usr/local/bin/gitea web --port $PORT \ No newline at end of file