Compare commits

...

23 Commits

Author SHA1 Message Date
Michael d9aed7e2a3 Merge remote-tracking branch 'origin/main' 2025-03-10 15:33:32 +01:00
Michael 31d152831f fix(nginx): client body size and timeout 2025-03-10 15:33:21 +01:00
maria a60b06c1be Update README.md 2025-02-17 11:33:05 +01:00
Michael 6aef2b0aaf Merge remote-tracking branch 'origin/main' 2025-02-13 13:48:29 +01:00
Michael 75c9367c2e feat: added template nginx conf for sintonia_webapp 2025-02-13 13:47:54 +01:00
Michael 5b33dc0a90 feat(docker-compose.override): sintonia_webapp added volume for storage, exposed php-fpm ports, set env var for xdebug 2025-02-13 12:53:29 +01:00
Michael 6745416d94 feat(docker-compose): added volume for sintonia_webapp assets, nginx opened ports for sintonia_webapp, changed general public url for analyzer 2025-02-13 12:51:49 +01:00
Michael d7574e2ada feat(docker): add php-fpm and relative log files 2025-02-13 12:50:01 +01:00
maria 6218f1e34a Update README.md 2025-02-13 12:46:15 +01:00
maria 82f4b18763 Update README.md 2025-02-13 12:45:39 +01:00
Michael 703b69c4a8 feat(dockerfile): seeds db in dev with user permissions 2025-02-11 16:32:47 +01:00
Michael 0ada5cf38f feat(docker): php sockets 2025-02-07 16:13:01 +01:00
Michael d72fb3fe6b fix: changed localhost to 127.0.0.1 2025-02-07 16:12:22 +01:00
Michael 8d94b43d76 feat: added php.ini for dev and prod in dockerfile 2025-02-07 13:39:36 +01:00
Michael d2fc5b0efa fix(docker): added laravel migration in container 2025-02-06 18:26:27 +01:00
Michael d48200af4e feat(xdebug): added support for xdebug in container 2025-02-06 18:22:48 +01:00
Michael 92631dc015 feat(laravel env dev): added telescope and hash verify 2025-02-06 14:00:21 +01:00
Michael 013659e034 feat(docker): added xdebug support, run laravel job once 2025-02-06 13:59:44 +01:00
Michael 18ad58fd68 sintonia docker fix: dev container startup 2025-02-03 15:48:35 +01:00
Michael f17ee781a2 .gitignore add: avoid double repo commits sintonia_webapp 2025-01-23 13:52:39 +01:00
Michael e1df1ee10c Docker add: .env vars sintonia_webapp 2025-01-23 13:51:15 +01:00
Michael 35043d436f Dockerfile + docker-compose add: add dev sintonia_webapp container 2025-01-23 13:49:55 +01:00
Michael ca3a179529 Docker files add: basic laravel conf 2025-01-23 13:49:03 +01:00
14 changed files with 4412 additions and 58 deletions

View File

@ -1,3 +1,12 @@
LIBRETIME_VERSION=main LIBRETIME_VERSION=main
LIBRETIME_CONFIG_FILEPATH=./dev/config.yml LIBRETIME_CONFIG_FILEPATH=./dev/config.yml
NGINX_CONFIG_FILEPATH=./docker/nginx.conf NGINX_CONFIG_FILEPATH=./docker/nginx.conf
#Sintonia
SINTONIA_PRODUCTION=false
SINTONIA_LARAVEL_PORT=9876
SINTONIA_VITE_PORT=9877
SINTONIA_USER=sintonia
SINTONIA_UID=1000
SINTONIA_NODE_VERSION=22.13.0
SINTONIA_CONFIG_FILEPATH=./dev/sintonia-webapp/laravel/.env.dev.example

2
.gitignore vendored
View File

@ -15,6 +15,8 @@ VERSION
!.gitkeep !.gitkeep
/sintonia_webapp/
## Github Python .gitignore ## Github Python .gitignore
## See https://github.com/github/gitignore/blob/master/Python.gitignore ## See https://github.com/github/gitignore/blob/master/Python.gitignore
################################################################################ ################################################################################

View File

@ -278,3 +278,142 @@ USER ${UID}:${GID}
ARG LIBRETIME_VERSION ARG LIBRETIME_VERSION
ENV LIBRETIME_VERSION=$LIBRETIME_VERSION ENV LIBRETIME_VERSION=$LIBRETIME_VERSION
#======================================================================================#
# Sintonia #
#======================================================================================#
# Use PHP as the base
FROM php:8.2-fpm AS sintonia-webapp-base
# Arguments defined in docker-compose-dev.yml
ARG sintonia_user=$SINTONIA_USER
ARG sintonia_uid=$SINTONIA_UID
ARG sintonia_node_version=$SINTONIA_NODE_VERSION
ARG sintonia_production=$SINTONIA_PRODUCTION
ENV DEBIAN_FRONTEND=noninteractive
# Install Additional System Dependencies and PHP Extensions
RUN set -eux && \
apt-get update -y && \
apt-get install -y --no-install-recommends \
libjpeg62-turbo-dev \
libfreetype6-dev \
libmcrypt-dev \
zlib1g-dev \
zip \
unzip \
libzip-dev \
libpng-dev \
git \
libonig-dev \
libpq-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-configure zip && \
docker-php-ext-configure gd --with-freetype --with-jpeg
RUN docker-php-ext-install gd exif pcntl bcmath mysqli pdo_mysql mbstring && \
docker-php-ext-install pdo_pgsql pgsql sockets
# Create system user to run Composer and Artisan Commands
RUN set -eux && useradd -G www-data -u $sintonia_uid -d /home/$sintonia_user $sintonia_user && \
mkdir -p /home/$sintonia_user/.composer && \
mkdir -p /var/www/sintonia_webapp && \
chown -R $sintonia_user:$sintonia_user /home/$sintonia_user && \
chown -R $sintonia_user:$sintonia_user /var/www/sintonia_webapp
USER "$sintonia_user"
WORKDIR /home/$sintonia_user
# Install composer
RUN set -eux && curl -sS https://getcomposer.org/installer | php -- --filename=composer
# node and composer installation
# Download and install nvm:
RUN curl -fsSL https://nodejs.org/dist/v$sintonia_node_version/node-v$sintonia_node_version-linux-x64.tar.gz -o node.tar.gz && \
tar -xzvf node.tar.gz && \
rm node.tar.gz
ENV PATH="/home/$sintonia_user/node-v$sintonia_node_version-linux-x64/bin:/home/$sintonia_user/composer:${PATH}"
#Build
FROM sintonia-webapp-base AS sintonia-webapp-build-common
ARG sintonia_config_filepath=$SINTONIA_CONFIG_FILEPATH
ARG libretime_config_filepath=$LIBRETIME_CONFIG_FILEPATH
USER root
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install yq -y
RUN sed -i 's/listen = 127.0.0.1:9000/listen = nginx:9000/g' /usr/local/etc/php-fpm.d/www.conf
USER "$sintonia_user"
WORKDIR $HOME
COPY --chown=$sintonia_user:$sintonia_user ./tools/populate-laravel-env-file.sh /home/$sintonia_user/
COPY --chown=$sintonia_user:$sintonia_user $sintonia_config_filepath /home/$sintonia_user/
COPY --chown=$sintonia_user:$sintonia_user $libretime_config_filepath /home/$sintonia_user/
RUN chmod +x ./populate-laravel-env-file.sh && \
./populate-laravel-env-file.sh /home/$sintonia_user/config.yml /home/$sintonia_user/.env
# DEV
FROM sintonia-webapp-build-common AS sintonia-webapp-dev
ARG sintonia_laravel_port
ARG sintonia_vite_port
ENV sintonia_laravel_port=${sintonia_laravel_port}
ENV sintonia_vite_port=${sintonia_vite_port}
USER root
RUN pecl install xdebug && \
docker-php-ext-enable xdebug && \
echo 'xdebug.mode = develop,debug\nxdebug.client_host=host.docker.internal\nxdebug.start_with_request=yes\nxdebug.discover_client_host=1' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
echo 'error_reporting=E_ALL' > /usr/local/etc/php/conf.d/error_reporting.ini
RUN touch /usr/local/var/log/fpm-php.access.log /usr/local/var/log/fpm-php.error.log && \
chown $sintonia_user:$sintonia_user /usr/local/var/log/fpm-php.access.log /usr/local/var/log/fpm-php.error.log && \
chmod 660 /usr/local/var/log/fpm-php.access.log /usr/local/var/log/fpm-php.error.log && \
sed -i 's/access.log = \/proc\/self\/fd\/2/access.log = \/usr\/local\/var\/log\/fpm-php.access.log/g' /usr/local/etc/php-fpm.d/docker.conf && \
sed -i 's/error_log = \/proc\/self\/fd\/2/error_log = \/usr\/local\/var\/log\/fpm-php.error.log/g' /usr/local/etc/php-fpm.d/docker.conf
COPY ./dev/sintonia-webapp/php/php-ini-development /usr/local/etc/php/php.ini
USER $sintonia_user
WORKDIR /var/www/sintonia_webapp
#RUN php artisan ziggy:generate && mv ziggy.js resources/utils/ziggy.js
#RUN cp $HOME/.env ./
ENV sintonia_user=${sintonia_user}
### Start server
CMD git config --global --add safe.directory /var/www/sintonia_webapp && \
/home/$sintonia_user/composer install --no-progress --no-interaction --no-autoloader && \
/home/$sintonia_user/composer --no-cache dump-autoload --no-interaction && \
php artisan migrate && \
php artisan key:generate && \
php artisan db:seed RolesAndPermissionsSeeder && \
php artisan schedule:run >> /dev/null 2>&1 && \
set -eux && \
npm i && \
php-fpm -D && \
npx vite --port $sintonia_vite_port --host & \
sleep infinity
FROM sintonia-webapp-build-common AS sintonia-webapp-production
COPY ./docker/sintonia-webapp/php/php-ini-production /usr/local/etc/php/php.ini
RUN git clone https://git.congegni.net/sintonia_webapp && \
cd sintonia_webapp && \
php artisan ziggy:generate && \
php artisan key:generate && \
mv ziggy.js resources/utils/ziggy.js && \
npx vite build && \
cp -r dist/build/* /var/www/html/ && \
rm -rf /var/www/sintonia_webapp/node_modules /var/www/sintonia_webapp/.npm /var/www/sintonia_webapp/.composer /var/www/sintonia_webapp/.git && \
rm -rf /home/$sintonia_user/node* /home/$sintonia_user/composer

View File

@ -1,72 +1,38 @@
# [![LibreTime](https://github.com/libretime/website/blob/main/static/img/logo-512px.png)](https://github.com/libretime/libretime) # Sintonia
[![Financial Contributors on Open Collective](https://opencollective.com/libretime/all/badge.svg?label=financial+contributors)](https://opencollective.com/libretime) The project involves the development of an application (to be released as open-source) that will handle all aspects of managing a radio station, whether it operates purely online or uses radio wave transmitters.
The application will therefore need to allow for:
LibreTime makes it easy to run your own online or terrestrial radio station. It - Managing multiple users with three different types of permissions (administrator, editor, and DJ);
is a community managed fork of the AirTime project. - Managing the audio file archive (adding, deleting), allowing uploads from remote sources such as individual audio files on other servers or RSS feeds;
- Adding, modifying, and deleting broadcasts within the schedule, and scheduling (both in advance and in real-time) the playlists within individual episodes of a broadcast;
- Creating both static and dynamic playlists that can be used within one or more episodes of one or more broadcasts;
- Managing and scheduling advertisements, both private and governmental;
- Exporting the history of songs played within a specific time frame;
It is managed by a friendly inclusive community of stations from around the Development is expected to start from the free and open-source software [LibreTime](https://libretime.org), which will be forked while retaining all playout and backend functionalities.
globe that use, document and improve LibreTime. Join us in fixing bugs and in This will be complemented by a new web application (hereafter referred to as "Sintonia") to replace the original application (hereafter referred to as "Legacy").
defining how we manage the codebase going forward.
Check out the [documentation](https://libretime.org/docs/) for more information and This application will replicate the functions of the previous one while integrating new features, providing a more intuitive and simple user experience thanks to a new graphic design agreed upon.
start broadcasting!
Please note that LibreTime is released with a [Contributor Code
of Conduct](https://github.com/libretime/organization/blob/main/CODE_OF_CONDUCT.md).
By participating in this project you agree to abide by its terms.
You can find details about our development process in the
[contributing](./CONTRIBUTING.md) guide.
## Support ## Support
To get support for any questions or problems you might have using the software Coming soon
we have a forum at [discourse.libretime.org](https://discourse.libretime.org).
We are moving towards using the forum to provide community support and reserving
the github issue queue for confirmed bugs and well-formed feature requests.
You can also contact us through [Matrix
(#libretime:matrix.org)](https://matrix.to/#/#libretime:matrix.org)
where you can talk with other users and developers.
## Contributors ## Contributors
### Code Contributors ### Code Contributors
This project exists thanks to all the people who [contribute](CONTRIBUTING.md). Sintonia is being developed by [Congegni](https://congegni.net)
### Financial Contributors ### Financial Contributors
Become a financial contributor and help us sustain our community on ![logo Arci Firenze](https://www.arcifirenze.it/wp-content/uploads/logo-arci-firenze.png) [Arci Firenze Aps](https://www.arcifirenze.it/)
[OpenCollective](https://opencollective.com/libretime/contribute).
#### Individuals
<a href="https://opencollective.com/libretime">
<img src="https://opencollective.com/libretime/individuals.svg?width=890">
</a>
#### Organizations
[Support](https://opencollective.com/libretime/contribute) this project with
your organization. Your logo will show up here with a link to your website.
<a href="https://opencollective.com/libretime">
<img src="https://opencollective.com/libretime/organizations.svg?width=890">
</a>
## License ## License
LibreTime is free software: you can redistribute it and/or Coming soon
modify it under the terms of the GNU Affero General Public
License as published by the Free Software Foundation,
version 3 of the License.
## Copyright ## Copyright
Copyright (c) 2011-2017 Sourcefabric z.ú. Coming soon
Copyright (c) 2017-2023 LibreTime Community
Please refer to the [LEGACY](./LEGACY.md) file for more information.

View File

@ -1,5 +1,5 @@
general: general:
public_url: http://localhost:8080 public_url: http://127.0.0.1:8080
api_key: some_secret_api_key api_key: some_secret_api_key
secret_key: some_secret_key secret_key: some_secret_key
@ -25,7 +25,7 @@ liquidsoap:
stream: stream:
inputs: inputs:
main: main:
public_url: https://localhost:8001/main public_url: https://127.0.0.1:8001/main
mount: main mount: main
port: 8001 port: 8001
secure: true secure: true
@ -45,7 +45,7 @@ stream:
- <<: *default_icecast_output - <<: *default_icecast_output
enabled: true enabled: true
mount: main.ogg mount: main.ogg
public_url: https://localhost:8443/main.ogg public_url: https://127.0.0.1:8443/main.ogg
audio: audio:
format: ogg format: ogg
bitrate: 256 bitrate: 256
@ -53,7 +53,7 @@ stream:
- <<: *default_icecast_output - <<: *default_icecast_output
enabled: true enabled: true
mount: main.opus mount: main.opus
public_url: https://localhost:8443/main.opus public_url: https://127.0.0.1:8443/main.opus
audio: audio:
format: opus format: opus
bitrate: 256 bitrate: 256
@ -61,7 +61,7 @@ stream:
- <<: *default_icecast_output - <<: *default_icecast_output
enabled: true enabled: true
mount: main.mp3 mount: main.mp3
public_url: https://localhost:8443/main.mp3 public_url: https://127.0.0.1:8443/main.mp3
audio: audio:
format: mp3 format: mp3
bitrate: 256 bitrate: 256

View File

@ -0,0 +1,68 @@
APP_NAME=Sintonia
APP_ENV=local
APP_KEY=base64:vxFbOz6qPvNW2RpEFw/XOWdZ9+X5oXwqnUgjHETJHQM=
APP_DEBUG=true
APP_TIMEZONE=UTC
APP_URL=http://127.0.0.1
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database
HASH_VERIFY=false
TELESCOPE_ENABLED=true
PHP_CLI_SERVER_WORKERS=4
BCRYPT_ROUNDS=12
LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=pgsql
DB_HOST=postgres
DB_PORT=5432
DB_DATABASE=libretime
DB_USERNAME=libretime
DB_PASSWORD=libretime
SESSION_DRIVER=cookie
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=127.0.0.1
BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database
CACHE_STORE=database
CACHE_PREFIX=
MEMCACHED_HOST=127.0.0.1
REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=log
MAIL_SCHEME=null
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
VITE_APP_NAME="${APP_NAME}"

File diff suppressed because it is too large Load Diff

View File

@ -66,9 +66,32 @@ services:
volumes: volumes:
- ./legacy:/var/www/html - ./legacy:/var/www/html
sintonia-webapp:
build:
context: .
target: sintonia-webapp-dev
args:
- sintonia_laravel_port=${SINTONIA_LARAVEL_PORT}
- sintonia_vite_port=${SINTONIA_VITE_PORT}
image: sintonia-webapp-dev
container_name: sintonia-webapp-dev
working_dir: /var/www/sintonia_webapp
volumes:
- ./sintonia_webapp:/var/www/sintonia_webapp
- libretime_storage:/srv/libretime
ports:
- 9000:9000
# - ${SINTONIA_LARAVEL_PORT}:${SINTONIA_LARAVEL_PORT}
- ${SINTONIA_VITE_PORT}:${SINTONIA_VITE_PORT}
environment:
- sintonia_laravel_port=${SINTONIA_LARAVEL_PORT}
- sintonia_vite_port=${SINTONIA_VITE_PORT}
- PHP_IDE_CONFIG=serverName=sintonia
nginx: nginx:
volumes: volumes:
- ./legacy:/var/www/html - ./legacy:/var/www/html
- ./sintonia_webapp:/var/www/sintonia_webapp
icecast: icecast:
ports: ports:

View File

@ -59,7 +59,7 @@ services:
- ${LIBRETIME_CONFIG_FILEPATH:-./config.yml}:/etc/libretime/config.yml:ro - ${LIBRETIME_CONFIG_FILEPATH:-./config.yml}:/etc/libretime/config.yml:ro
- libretime_storage:/srv/libretime - libretime_storage:/srv/libretime
environment: environment:
LIBRETIME_GENERAL_PUBLIC_URL: http://nginx:8080 LIBRETIME_GENERAL_PUBLIC_URL: http://nginx:9876
worker: worker:
image: ghcr.io/libretime/libretime-worker:${LIBRETIME_VERSION:-latest} image: ghcr.io/libretime/libretime-worker:${LIBRETIME_VERSION:-latest}
@ -98,16 +98,45 @@ services:
- libretime_assets:/var/www/html - libretime_assets:/var/www/html
- libretime_storage:/srv/libretime - libretime_storage:/srv/libretime
sintonia-webapp:
build:
context: ./sintonia_webapp
target: sintonia-webapp-production
args:
- sintonia_user=${SINTONIA_USER}
- sintonia_uid=${SINTONIA_UID}
- sintonia_node_version=${SINTONIA_NODE_VERSION}
- sintonia_config_filepath=${SINTONIA_CONFIG_FILEPATH}
- libretime_config_filepath=${LIBRETIME_CONFIG_FILEPATH}
image: sintonia-webapp-prod
container_name: sintonia-webapp-prod
depends_on:
- postgres
- rabbitmq
init: true
working_dir: /var/www/sintonia_webapp
volumes:
- ${LIBRETIME_CONFIG_FILEPATH:-./config.yml}:/etc/libretime/config.yml:ro
- libretime_storage:/srv/libretime
- libretime_assets:/var/www/html
- sintonia_assets:/var/www/sintonia_webapp
nginx: nginx:
image: nginx image: nginx
ports: ports:
- 8080:8080 - 8080:8080
- ${SINTONIA_LARAVEL_PORT}:${SINTONIA_LARAVEL_PORT}
depends_on: depends_on:
- legacy - legacy
- sintonia-webapp
environment:
- SINTONIA_LARAVEL_PORT=${SINTONIA_LARAVEL_PORT}
volumes: volumes:
- libretime_assets:/var/www/html:ro - libretime_assets:/var/www/html:ro
- libretime_storage:/srv/libretime:ro - libretime_storage:/srv/libretime:ro
- ${SINTONIA_NGINX_CONFIG_FILEPATH:-./nginx-sintonia.conf.template}:/etc/nginx/templates/sintonia.conf.template:ro
- ${NGINX_CONFIG_FILEPATH:-./nginx.conf}:/etc/nginx/conf.d/default.conf:ro - ${NGINX_CONFIG_FILEPATH:-./nginx.conf}:/etc/nginx/conf.d/default.conf:ro
- sintonia_assets:/var/www/sintonia_webapp
icecast: icecast:
image: ghcr.io/libretime/icecast:2.4.4 image: ghcr.io/libretime/icecast:2.4.4
@ -123,3 +152,4 @@ volumes:
libretime_storage: {} libretime_storage: {}
libretime_assets: {} libretime_assets: {}
libretime_playout: {} libretime_playout: {}
sintonia_assets: {}

View File

@ -0,0 +1,54 @@
server {
listen ${SINTONIA_LARAVEL_PORT};
root /var/www/sintonia_webapp/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
index index.php;
charset utf-8;
client_max_body_size 512M;
client_body_timeout 300s;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_pass sintonia-webapp:9000;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param SERVER_NAME sitonia;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
# Internal path for serving media files from the API.
location /api/_media {
internal;
# This alias path must match the 'storage.path' configuration field.
alias /srv/libretime;
}
location ~ ^/api/(v2|browser) {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
proxy_pass http://api:9001;
}
}

View File

@ -47,4 +47,4 @@ server {
# This alias path must match the 'storage.path' configuration field. # This alias path must match the 'storage.path' configuration field.
alias /srv/libretime; alias /srv/libretime;
} }
} }

View File

@ -0,0 +1,59 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
MEMCACHED_HOST=127.0.0.1
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_HOST=
PUSHER_PORT=443
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=mt1
VITE_APP_NAME="${APP_NAME}"
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,58 @@
#!/bin/sh
# Check if yq is installed
if ! command -v yq >/dev/null 2>&1; then
echo "yq is not installed. Install it first (e.g., sudo apt-get install yq)."
exit 1
fi
# Input YAML file
YAML_FILE="$1"
# Output .env file
ENV_FILE="$2"
# Extract values from YAML using yq
DB_HOST=$(yq '.database.host // "postgres"' "$YAML_FILE")
DB_PORT=$(yq '.database.port // "5432"' "$YAML_FILE")
DB_USER=$(yq '.database.user // "libretime"' "$YAML_FILE")
DB_PASSWORD=$(yq '.database.password // "libretime"' "$YAML_FILE")
DB_DATABASE=$(yq '.database.database // "libretime"' "$YAML_FILE")
MAIL_HOST=$(yq '.email.host // "localhost"' "$YAML_FILE")
MAIL_PORT=$(yq '.email.port // "25"' "$YAML_FILE")
MAIL_USERNAME=$(yq '.email.user // ""' "$YAML_FILE")
MAIL_PASSWORD=$(yq '.email.password // ""' "$YAML_FILE")
MAIL_ENCRYPTION=$(yq '.email.encryption // ""' "$YAML_FILE")
# Function to update or add a variable in the .env file
update_env_var() {
local key="$1"
local value="$2"
if grep -q "^$key=" "$ENV_FILE"; then
# Update existing variable
sed -i.bak "s|^$key=.*|$key=$value|" "$ENV_FILE"
else
# Add new variable
echo "$key=$value" >> "$ENV_FILE"
fi
}
# Create or update the .env file with extracted values
update_env_var "DB_CONNECTION" "postgres"
update_env_var "DB_HOST" "$DB_HOST"
update_env_var "DB_PORT" "$DB_PORT"
update_env_var "DB_DATABASE" "$DB_DATABASE"
update_env_var "DB_USERNAME" "$DB_USER"
update_env_var "DB_PASSWORD" "$DB_PASSWORD"
update_env_var "MAIL_MAILER" "smtp"
update_env_var "MAIL_HOST" "$MAIL_HOST"
update_env_var "MAIL_PORT" "$MAIL_PORT"
update_env_var "MAIL_USERNAME" "$MAIL_USERNAME"
update_env_var "MAIL_PASSWORD" "$MAIL_PASSWORD"
update_env_var "MAIL_ENCRYPTION" "$MAIL_ENCRYPTION"
update_env_var "MAIL_FROM_ADDRESS" "\"hello@example.com\""
update_env_var "MAIL_FROM_NAME" "${APP_NAME}"
echo ".env file has been created/updated successfully."