Skip to content

Instantly share code, notes, and snippets.

@andresjesse
Last active February 2, 2024 09:11
Show Gist options
  • Save andresjesse/ff25cbb064610efc06295eac1ef8431f to your computer and use it in GitHub Desktop.
Save andresjesse/ff25cbb064610efc06295eac1ef8431f to your computer and use it in GitHub Desktop.
Laravel Random Stuff

Installing sail for a downloaded git project

When you download a laravel project from github it comes without the vendor folder, so it's needed to install it with a temporary container.

Docker and docker compose must be previously installed. If you don't have it, follow those guides:

When your docker and compose are ready, you can configure laravel:

  1. Clone your laravel project from github.
2. Update folder permissions (run in project folder only!!):

chmod -R a+rw .

  1. Run a temporary container to install composer dependencies:
docker run --rm \
    -u "$(id -u):$(id -g)" \
    -v "$(pwd):/var/www/html" \
    -w /var/www/html \
    laravelsail/php82-composer:latest \
    composer install --ignore-platform-reqs

Reference: https://laravel.com/docs/10.x/sail#installing-composer-dependencies-for-existing-projects

  1. Make sure sail shell alias is set (zshrc or bashrc):

Reference: https://laravel.com/docs/10.x/sail#configuring-a-shell-alias

  1. Make sure to fill .env (usually you should have a .env.example in project's root).

Fix for storage permissions:

sudo chown -R $USER:docker storage/framework

Fix for MySQL error: Unable to setup unix socket lock file.

Check if your .env hosts are pointing to container names instead of localhost/127.0.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment