Deploy to Heroku

This commit is contained in:
asmigiel 2025-01-07 21:44:23 +01:00
parent 62b07630b7
commit 7d8b7b6005
4 changed files with 10 additions and 9 deletions

View File

@ -4,7 +4,6 @@ WORKDIR /app
COPY run.sh ./
RUN chmod +x ./run.sh
ENTRYPOINT ["./run.sh"]

View File

@ -1 +1 @@
https://s464951-gitea-451bd4d0ed7a.herokuapp.com/
https://s464951-gitea-530091612f47.herokuapp.com/

View File

@ -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
# heroku open --app $APP_NAME

11
run.sh
View File

@ -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