|
3 | 3 | This is a Laravel, IntertiaJS with Vue based application that works as an OIDC Provider. |
4 | 4 |
|
5 | 5 | ## Installation |
6 | | -This project uses [laravel sail](https://laravel.com/docs/11.x/sail) for local development. |
| 6 | + |
| 7 | +You need to have at least docker and docker-compose installed. |
| 8 | +Podman is also supported, but you need to set up the podman socket and command to be compatible with docker. |
7 | 9 |
|
8 | 10 | 1. Clone the Repo |
9 | | -2. Run `sail up -d` to start the docker containers. |
10 | | -3. Run `sail artisan migrate`. |
11 | | -4. Run `sail artisan db:seed`. |
12 | | -5. Run `sail npm install`. |
13 | | -6. Run `sail npm run dev`. |
14 | | -7. Add `auth.eurofurence.localhost` and `identity.eurofurence.localhost` to your hosts file and forward them to `127.0.0.1`. |
15 | | -8. You can now go to http://identity.eurofurence.localhost. |
16 | | - |
17 | | -### Security |
| 11 | +2. Copy `.env.example` to `.env` and set up the environment variables if needed. |
| 12 | + `cp .env.example .env` |
| 13 | + (you should generate new secret keys, but for simplicity some default ones are provided) |
| 14 | +3. Run `docker compose up -d` to start the docker containers. |
| 15 | + It may take a while to pull and build images for the first time. |
| 16 | +4. Wait when php dependencies are installed and the dev server starts. |
| 17 | + It may also take a while depending on your internet connection and computer performance. |
| 18 | + You can check the logs with `docker compose logs -f laravel.test` |
| 19 | + (`Ctrl+C` here will close logs, but will keep the server running). |
| 20 | +5. Setup alias for sail: |
| 21 | + ```bash |
| 22 | + alias sail='./vendor/bin/sail' |
| 23 | + ``` |
| 24 | + or use docker-compose directly: |
| 25 | + ```bash |
| 26 | + docker compose exec -it -u sail laravel.test <command> |
| 27 | + ``` |
| 28 | + (further commands will have a sail and pure docker-compose version) |
| 29 | +6. Run `sail artisan migrate` or `docker compose exec -it -u sail laravel.test php artisan migrate`. |
| 30 | +7. Run `sail artisan db:seed` or `docker compose exec -it -u sail laravel.test php artisan db:seed`. |
| 31 | +8. Run `sail npm install` or `docker compose exec -it -u sail laravel.test npm install`. |
| 32 | +9. Run `sail npm run dev` or `docker compose exec -it -u sail laravel.test npm run dev`. |
| 33 | + (you can run this command locally. it may speed up HMR and file watching on some systems) |
| 34 | +10. Add `identity.eurofurence.localhost` to your hosts file and forward them to `127.0.0.1`. |
| 35 | +11. You can now go to http://identity.eurofurence.localhost. |
| 36 | + it may take a while to load first time. |
| 37 | + Default credentials are: `identity@eurofurence.localhost`, `admin` (unless you changed them in `.env`). |
| 38 | + |
| 39 | +### Entering laravel container |
| 40 | + |
| 41 | +To enter the laravel container, run `sail shell` or `docker compose exec -it -u sail laravel.test bash`. |
| 42 | + |
| 43 | +### Updating dev environment |
| 44 | + |
| 45 | +To keep your dev environment up to date after merging changes from the main branch or creating a new one, run: |
| 46 | + |
| 47 | +* `sail up -d` or `docker compose up -d` to update container image versions. |
| 48 | +* `sail npm install` or `docker compose exec -it -u sail laravel.test npm install` to update npm packages. |
| 49 | +* `sail composer install` or `docker compose exec -it -u sail laravel.test composer install` to update composer files. |
| 50 | +* `sail restart` or `docker compose restart` to restart the containers. |
| 51 | + |
| 52 | +### Stopping dev environment |
| 53 | + |
| 54 | +To stop the dev environment, run `sail stop` or `docker compose stop`. |
| 55 | + |
| 56 | +This action will stop all containers, free up the ports and keep data in containers and volumes. |
| 57 | + |
| 58 | +To start it again, run `sail up -d` or `docker compose up -d`. |
| 59 | + |
| 60 | +### Removing and cleaning up the dev environment |
| 61 | + |
| 62 | +**WARNING: This action will remove all containers and volumes, including the database and all data in it.** |
| 63 | + |
| 64 | +To remove the dev environment, run `sail down -v` or `docker compose down -v`. |
| 65 | + |
| 66 | +Also, you may want to remove `vendor` and `node_modules` if you want to perform |
| 67 | +a clean installation later `rm -rf vendor node_modules`. |
| 68 | + |
| 69 | +**WARNING: next step will remove all pulled and built images, build caches, volumes, networks and stopped containers.** |
| 70 | + |
| 71 | +For some rare cases, you may want to remove all pulled images and volumes `docker system prune -af`. |
| 72 | + |
| 73 | +## Exposed Ports |
| 74 | + |
| 75 | +* `:80` - HTTP terafic internal router. It routes http request to laravel container (mostly) |
| 76 | + and hydra (`/.well-known`,`/oauth2`,`/health`,`/userinfo`) |
| 77 | +* `:8080` - traefic dashboard (for debugging) |
| 78 | +* `:3306` - MySQL database (can be changed via `FORWARD_DB_PORT` in `.env`) |
| 79 | +* `:4444`, `:4445`, `:5555` - Hydra endpoints (for debugging) |
| 80 | +* `:6379` - Redis (can be changed via `FORWARD_REDIS_PORT` in `.env`) |
| 81 | +* `:6001`, `:9601` - Soketi (local WS pusher implementation) |
| 82 | + (can be changed via `PUSHER_PORT` and `PUSHER_METRICS_PORT` in `.env`) |
| 83 | +* `:7700` - MeiliSearch (can be changed via `FORWARD_MEILISEARCH_PORT` in `.env`) |
| 84 | +* `:1025`, `:8025` - MailPit local SMTP server |
| 85 | + (can be changed via `FORWARD_MAILPIT_PORT`, `FORWARD_MAILPIT_DASHBOARD_PORT` in `.env`) |
| 86 | + |
| 87 | +## Connecting to the MySQL database from the host |
| 88 | + |
| 89 | +After you finish the installation, you can connect to the MySQL database from your host machine. |
| 90 | + |
| 91 | +* Host: `127.0.0.1` |
| 92 | +* Port: `3306` (or the port you set in `.env` for `FORWARD_DB_PORT`) |
| 93 | +* Username: `sail` (or the user you set in `.env` for `DB_USERNAME`) |
| 94 | +* Password: `password` (or the password you set in `.env` for `DB_PASSWORD`) |
| 95 | +* Database: `laravel` (or the database you set in `.env` for `DB_DATABASE`) |
| 96 | + |
| 97 | +## Receiving mail |
| 98 | + |
| 99 | +During development, you should use `identity.eurofurence.localhost` hostname |
| 100 | +(eg `some-user@identity.eurofurence.localhost`) to receive emails. |
| 101 | + |
| 102 | +Use mailpit to check the emails at [http://localhost:8025](http://localhost:8025). |
| 103 | + |
| 104 | +## Security |
18 | 105 |
|
19 | 106 | If you discover any security related issues, please email me@thiritin.com instead of using the issue tracker. |
0 commit comments