install.sh collects env vars

This commit is contained in:
2025-06-08 08:31:04 +01:00
parent 27c87d1df9
commit f4981e961a
5 changed files with 73 additions and 15 deletions

View File

@@ -1,12 +1,73 @@
#!/bin/sh #!/bin/sh
set -eux install_prerequisite_software ()
cd ${LIB_DIR:-/lib} {
sudo git clone https://git.joeac.net/joeac/joeac.net.git if [ -n "$(which git)" ] & [ -n "$(which podman)" ] & [ -n "$(which podman-compose)" ]
cd joeac.net then
sudo chmod +x uninstall.sh update_and_restart.sh restart.sh echo "Git, podman and podman-compose are already installed."
sudo echo << EOF >> ${CRONTABS_DIR:-/etc/cron.d}/joeacnet elif [ -n "$(which apk)" ]
then
apk update
apk add git podman podman-compose
elif [ -n "$(which apt-get)" ]
then
apt-get update
apt-get install git podman podman-compose -y
elif [ -n "$(which dnf)" ]
then
dnf install git podman podman-compose
elif [ -n "$(which yum)" ]
then
yum install git podman podman-compose
elif [ -n "$(which pacman)" ]
then
pacman -S git podman podman-compose
else
echo "Could not install Git: could not identify package manager."
exit 1
fi
}
clone_repository ()
{
cd ${LIB_DIR:-/lib}
git clone https://git.joeac.net/joeac/joeac.net.git
cd joeac.net
chmod +x uninstall.sh update_and_restart.sh restart.sh
}
add_cron_services ()
{
echo <<- EOF > ${CRONTABS_DIR:-/etc/cron.d}/joeacnet
@reboot ${LIB_DIR:-/lib}/joeac.net/restart.sh @reboot ${LIB_DIR:-/lib}/joeac.net/restart.sh
10 * * * * ${LIB_DIR:-/lib}/joeac.net/update_and_restart.sh 10 * * * * ${LIB_DIR:-/lib}/joeac.net/update_and_restart.sh
EOF EOF
}
collect_env_vars ()
{
if ! [ -f /resticprofile.env ]
then
echo "Please provide resticprofile secrets in /resticprofile.env."
exit 1
fi
cp /resticprofile.env "${LIB_DIR:-/lib}/joeac.net/resticprofile/.env"
if ! [ -f /symfony.env ]
then
echo "Please provide symfony secrets in /symfony.env."
exit 1
fi
cp /symfony.env "${LIB_DIR:-/lib}/joeac.net/symfony/.env"
}
# Run me:
# curl https://git.joeac.net/joeac/joeac.net/raw/branch/main/install.sh | sudo -E sh
set -eux
install_prerequisite_software
clone_repository
add_cron_services
set -e +ux
collect_env_vars
./restart.sh ./restart.sh

View File

@@ -9,7 +9,6 @@ version = "1"
[default] [default]
description = "Back up database to BackBlazeB2 S3 Bucket" description = "Back up database to BackBlazeB2 S3 Bucket"
env-file = ".env" env-file = ".env"
password-file = "password.txt"
repository = "s3:s3.eu-central-003.backblazeb2.com/joeac-net-backup/repo" repository = "s3:s3.eu-central-003.backblazeb2.com/joeac-net-backup/repo"
verbose = 2 verbose = 2

View File

@@ -1,4 +1,4 @@
APP_ENV=dev APP_ENV=dev
DATABASE_URL="sqlite:///%kernel.project_dir%/var/app.db" DATABASE_URL="sqlite:///%kernel.project_dir%/var/data_local.db"
#JOEAC_PASSWORD= JOEAC_PASSWORD=\$2y\$13\$lvuwCAj7qPoNYZccrrWsveTwDkZivRTgzMf6husO77y7aA8V3e.zG
MESSENGER_TRANSPORT_DSN=doctrine://default MESSENGER_TRANSPORT_DSN=doctrine://default

6
symfony/.gitignore vendored
View File

@@ -1,8 +1,6 @@
###> symfony/framework-bundle ### ###> symfony/framework-bundle ###
.env.local .env
.env.local.php .env.*
.env.*.local
.env.prod
config/secrets/prod/prod.decrypt.private.php config/secrets/prod/prod.decrypt.private.php
public/bundles/ public/bundles/
var/ var/

View File

@@ -2,7 +2,7 @@ FROM docker.io/bitnami/php-fpm:8.4 AS database
WORKDIR /app WORKDIR /app
COPY ./composer.* ./symfony.* ./ COPY ./composer.* ./symfony.* ./
COPY ./bin ./bin COPY ./bin ./bin
COPY ./.env.prod ./.env COPY ./.env ./.env
COPY ./config ./config COPY ./config ./config
COPY ./migrations ./migrations COPY ./migrations ./migrations
COPY ./src ./src COPY ./src ./src
@@ -21,7 +21,7 @@ FROM apt-install AS composer-install
COPY --from=database /app/var /app/var COPY --from=database /app/var /app/var
WORKDIR /app WORKDIR /app
COPY ./composer.* ./symfony.* ./ COPY ./composer.* ./symfony.* ./
COPY ./.env.prod ./.env COPY ./.env ./.env
RUN composer install \ RUN composer install \
--no-cache \ --no-cache \
--no-dev \ --no-dev \