Skip to content

Commit

Permalink
Configure SQLite for persistent data updates (Ref #2)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaydrogers committed May 16, 2024
1 parent 8a07b51 commit 9d89112
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ fi
new(){
docker run --rm -v "$(pwd):/var/www/html" --user "${SPIN_USER_ID}:${SPIN_GROUP_ID}" -e COMPOSER_CACHE_DIR=/dev/null -e "SHOW_WELCOME_MESSAGE=false" $docker_image composer --no-cache create-project laravel/laravel "${framework_args[@]}"

# Create the SQLite database folder
mkdir -p "$(pwd)/$SPIN_PROJECT_DIRECTORY/.infrastructure/volumes/sqlite"

# Create the SQLite database file
touch "$(pwd)/$SPIN_PROJECT_DIRECTORY/.infrastructure/volumes/sqlite/database.sqlite"

# Ensure the .env file has a proper path
sed -i '/^DB_CONNECTION=sqlite$/a DB_DATABASE=/var/www/html/.infrastructure/volumes/sqlite/database.sqlite' .env

# Initialize new projects too
init
}
Expand Down
2 changes: 2 additions & 0 deletions template/docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ services:
- "storage_public:/var/www/html/storage/app/public/"
- "storage_sessions:/var/www/html/storage/framework/sessions"
- "storage_logs:/var/www/html/storage/logs"
- "database_sqlite:/var/www/html/.infrastructure/volumes/sqlite/"
deploy:
replicas: 1
update_config:
Expand Down Expand Up @@ -79,6 +80,7 @@ volumes:
storage_public:
storage_sessions:
storage_logs:
database_sqlite:

networks:
web-public:

0 comments on commit 9d89112

Please sign in to comment.