commit 534045c8a5e9df733180c45c1e56408afd00789c Author: waffle-lord <76401815+waffle-lord@users.noreply.github.com> Date: Tue Nov 26 16:28:43 2024 -0500 full dev setup diff --git a/Full-Windows-Dev-Env.md b/Full-Windows-Dev-Env.md new file mode 100644 index 0000000..fee33ab --- /dev/null +++ b/Full-Windows-Dev-Env.md @@ -0,0 +1,144 @@ +## Install WSL2 + +Open PowerShell and run the following command to install Ubuntu WSL2: + +```powershell +wsl --install -d Ubuntu +``` + +Full documentation for installing WSL2 can be found here: +https://learn.microsoft.com/en-us/windows/wsl/basic-commands#install + +## Install Docker + +Download and install Docker Desktop: +https://www.docker.com/products/docker-desktop/ + +Open Docker Desktop and browse to `Settings`, `Resources`, `WSL Integration`. Ensure that the `enable integration with my default WSL distro` is enabled. + +>[!NOTE] +> Previous to installing Docker, if you had a WSL2 shell open, you will need to restart it to be able to interact with Docker from WSL2. + +>[!NOTE] +> If you are running hyper-v you may want to check that your dynamic port ranges are set higher than the default. This is because hyper-v will reserve ports when the system boots, and it may include +> the ports needed by our containers. More details about the solution below [can be found here](https://github.com/docker/for-win/issues/3171#issuecomment-1895729704) +> ```powershell +> # check dynamic port ranges for ipv4 and 6 +> netsh int ipv4 show dynamicport tcp +> netsh int ipv4 show dynamicport tcp +> +> # update ranges to reserve 16384 port numbers starting at 49152 +> netsh int ipv4 set dynamic tcp start=49152 num=16384 +> netsh int ipv6 set dynamic tcp start=49152 num=16384 +> ``` + +## Install Git & Git LFS + +Within your Ubuntu WSL2 environment: + +```bash +sudo apt-get update +sudo apt-get -y install git git-lfs +``` + +## Clone Forge + +Pull down a clone of the Forge source locally within your WSL2 environment: + +> [!WARNING] +> Using a windows drive mount such as `/mnt/c/` will greatly reduce performance and may even prevent the project from running correctly. +> Please make sure to clone the repo to a location inside the wsl environment, such as `~/Code/forge` + +```bash +mkdir ~/Code +cd ~/Code +git clone https://github.com/sp-tarkov/forge.git forge +cd ~/Code/forge +git checkout develop +git lfs pull +``` + +## Install Laravel Sail + +Within your Ubuntu WSL2 environment: + +```bash +# Copy the example full environment file over into the active environment file: +cp .env.full .env + +# Pull down a docker container that will install the project's composer dependencies: +docker run --rm -u "$(id -u):$(id -g)" -v "$(pwd):/var/www/html" -w /var/www/html laravelsail/php83-composer:latest composer install --ignore-platform-reqs +``` + +You should now have the `sail` script installed. + +For simplicity, anything below that refers to running a `sail` command is actually referring to the script located here: `./vendor/bin/sail`. For example, `sail up -d` actually refers to running `./vendor/bin/sail up -d`. It's *highly* recommended to configure an alias to make running `sail` commands easier: + +```bash +echo "alias sail='sh \$([ -f sail ] && echo sail || echo vendor/bin/sail)'" >> ~/.bashrc +source ~/.bashrc +``` + +## Run Forge + +Within your Ubuntu WSL2 environment: + +### Install Laravel Octane +```bash +# Start the containers in detached mode: +sail up -d + +# Install NPM dependencies (includes file watcher for Octane) +sail npm install + +# Install composer dependencies +sail composer install + +# Generate a new application key: +sail artisan key:generate + +# Test that octane workers can be reloaded +sail artisan octane:reload + +# If you get an error reloading the workers, start octane to install FrankenPHP. If prompted, select 'yes' to install. +# sail artisan octane:start + +# Restart containers +sail down +sail up -d +``` + +### Create & Populate Database Tables + +Run the following command to create each of the database tables and seed them with fake testing data. + +```bash +sail artisan migrate:fresh --seed +``` + +### Populate Meilisearch Indexes + +In order to populate the Meilisearch search indexes you must have a queue worker running. We use Horizon for this. + +> [!TIP] +> You will need to open another console to run horizon, as it will block that console from running any more commands + +```bash +# Start the queue workers (run this command in a new console): +sail artisan horizon +``` + +### Vite Development Server + +There is a front-end development server that manages hot-injecting files as they're updated so that you rarely have to refresh the page after a file is updated to see your changes. Start it with the following command: + +```bash +sail npm run dev +``` + +## Finished! + +You should now be able to access the Forge: +http://localhost + +<3 \ No newline at end of file