Intial setup script done

This commit is contained in:
BillyOutlast
2025-08-30 02:32:11 -04:00
parent fad1310d92
commit 5d57f1ed2d
4 changed files with 81 additions and 17 deletions
+2 -1
View File
@@ -2,4 +2,5 @@ mariadb/
UNIT3D/
redis/
nginx/
meili_data/
meili_data/
home/
+50 -12
View File
@@ -73,6 +73,19 @@ After cloning the repository, copy the example environment file:
cp .env.example .env
```
## 11.1. Configure Environment Variables
Edit the `.env` file to set the following values for Meilisearch, MariaDB, and Redis:
```env
MEILISEARCH_HOST=http://meilisearch:7700
DB_CONNECTION=mariadb
DB_HOST=mariadb
REDIS_HOST=redis
```
You can use your preferred text editor to update these lines in the `.env` file.
## 12. Install Dependencies with Composer
Run the following commands inside the UNIT3D directory to install and update PHP dependencies:
@@ -92,16 +105,9 @@ php artisan key:generate
This command sets the `APP_KEY` value in your `.env` file, which is required for application security.
## 14. Run Database Migrations and Seed Data
To set up the database schema and seed initial data, run:
```sh
php artisan migrate:fresh --seed
```
## 15. Install Bun
## 14. Install Bun
If you want to use Bun for managing Node.js dependencies and building assets outside the Docker environment, install Bun globally:
@@ -111,7 +117,7 @@ curl -fsSL https://bun.sh/install | bash
After installation, restart your terminal or add Bun to your PATH as instructed by the installer.
p
## 16. Manage Node.js Dependencies and Compile Assets
## 15. Manage Node.js Dependencies and Compile Assets
To install Node.js dependencies and build frontend assets within the Docker environment, run:
@@ -130,7 +136,7 @@ rm -rf node_modules && bun pm cache rm && bun install && bun run build
```
## 17 Configure Unprivileged Ports
## 16 Configure Unprivileged Ports
To allow non-root processes to bind to ports 80 and 443, add the following lines to `/etc/sysctl.conf`:
@@ -144,11 +150,43 @@ Apply the changes with:
sudo sysctl -p
```
## 178 Start the Application with Podman Compose
## 17. Start the Application with Podman Compose
Navigate to the parent directory and start the containers using your environment file:
```sh
cd ..
podman-compose --env-file UNIT3D/.env up -d
```
```
## 18. Run Database Migrations and Seed Data
To set up the database schema and seed initial data, run:
podman exec -it unit3d-podman_unit3d_1 bash
cd /var/www/html
php artisan migrate:fresh --seed
```
## 18.1. Restart Containers with Force
If you need to recreate containers and start them in detached mode, use:
```sh
podman compose up -d --force
```
This command will force recreation of containers, ensuring any changes to your configuration or images are applied.
## 19. Clear Laravel Configuration Cache
If you encounter SQL errors due to missing or incorrect database credentials, clear the Laravel configuration cache:
```sh
php artisan config:clear
```
This command reloads the configuration from your `.env` file and can resolve issues related to environment variables.
+3
View File
@@ -34,6 +34,7 @@ services:
volumes:
- './UNIT3D:/var/www/html'
- ./entrypoint.sh:/entrypoint.sh
- ./home:/home/unit3d/
entrypoint: /entrypoint.sh
networks:
- unit3d
@@ -99,6 +100,8 @@ services:
image: 'getmeili/meilisearch:latest'
ports:
- '${FORWARD_MEILISEARCH_PORT:-7700}:7700'
expose:
- "7700"
environment:
MEILI_NO_ANALYTICS: '${MEILISEARCH_NO_ANALYTICS:-false}'
volumes:
+26 -4
View File
@@ -1,6 +1,28 @@
#!/bin/bash
chown -R unit3d:unit3d /var/www/html
echo "Updating DNF packages..."
sudo dnf -y update
echo "Setting up UNIT3D..."
sudo chown -R unit3d:unit3d /var/www/html /home/unit3d/
su -s /bin/bash unit3d -c "
cd /var/www/html
npm install
npm run build
su -s /bin/bash unit3d -c "/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=8080"
composer install --no-interaction --prefer-dist
mkdir -p \$HOME/.npm-packages
export NPM_PACKAGES=\"\$HOME/.npm-packages\"
export PATH=\"\$NPM_PACKAGES/bin:\$PATH\"
curl -fsSL https://bun.sh/install | bash
export BUN_INSTALL=\"\$HOME/.bun\"
export PATH=\"\$BUN_INSTALL/bin:\$PATH\"
bun install
bun pm untrusted
bun pm trust --all
bun install
bun run build
php artisan set:all_cache
php artisan queue:restart
php artisan scout:sync-index-settings
php artisan auto:sync_torrents_to_meilisearch --wipe && php artisan auto:sync_people_to_meilisearch
php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=8080
"