Skip to content

Commit

Permalink
fix: persistent storage & OAuth keys
Browse files Browse the repository at this point in the history
  • Loading branch information
blt950 committed Aug 31, 2023
1 parent e1c6564 commit b4e3d6e
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 9 deletions.
26 changes: 18 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,19 @@ To setup your Docker instance simply follow these steps:
1. Pull the `ghcr.io/vatsim-scandinavia/handover:v3` Docker image
2. Setup your MySQL database (not included in Docker image)
3. Configure the environment variables as described in the [CONFIGURE.md](CONFIGURE.md#environment)
4. Start the container in the background.
5. Setup the database.
4. To ensure that users will not need to log in after each time you re-deploy or upgrade the container, you need to create and store an application key in your environment and setup a shared volume.
```sh
docker exec -it handover php artisan key:get
docker volume create handover_storage
```
Copy the key and set it as the `APP_KEY` environment variable in your Docker configuration and bind the volume when creating the container with `handover_storage:/app/storage`.
5. Start the container in the background.
6. Setup the database.
```sh
docker exec -it --user www-data handover php artisan migrate
```
6. Setup a crontab _outside_ the container to run `* * * * * docker exec --user www-data -i handover php artisan schedule:run >/dev/null` every minute. This patches into the container and runs the required cronjobs.
7. Bind the 8080 (HTTP) and/or 8443 (HTTPS) port to your reverse proxy or similar.
7. Setup a crontab _outside_ the container to run `* * * * * docker exec --user www-data -i handover php artisan schedule:run >/dev/null` every minute. This patches into the container and runs the required cronjobs.
8. Bind the 8080 (HTTP) and/or 8443 (HTTPS) port to your reverse proxy or similar.

Refer to the [CONFIGURE.md](CONFIGURE.md#optional-theming) for information about theming text, colors and logos.

Expand All @@ -50,12 +56,16 @@ Skip with ENTER when asked to assign to specific user. Name the client something
## Updating Data Protection Policy
When you update your DPP, you should make all users explicitly accept the new policy again. To do this, follow these steps:

1. Update the date and url to DPP in your environment variables. This should also recreate the container in the process to make sure everyone needs to login again.
1. Update the date and url to DPP in your environment variables.
2. If needed, update the DPP simplified version according to [the configuration manual](CONFIGURE.md#optional-theming)
3. Reset all user's accepted_privacy variable in database with
```sh
docker exec -it --user www-data handover php artisan reset:acceptedprivacy
```
```sh
docker exec -it --user www-data handover php artisan reset:acceptedprivacy
```
4. To make sure everyone needs to login again, delete the sessions:
```sh
docker exec -it --user www-data rm -rf /app/storage/framework/sessions/*
```

## Present automation
The only job the cron has automated today is daily member check and pull freshest data from VATSIM
Expand Down
36 changes: 36 additions & 0 deletions app/Console/Commands/KeyGet.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;

class KeyGet extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'key:get';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Get the current application key';

/**
* Execute the console command.
*
* @return int
*/
public function handle()
{

$this->info('Current application key, copy the whole next line:');
$this->info(config('app.key'));

return Command::SUCCESS;
}
}
6 changes: 5 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ services:
ports:
- 8080:80
- 8443:443
volumes:
- storage:/app/storage
environment:
# Please check the complete configure guide for all variables and their description
# You need to adjust this file to your needs
Expand All @@ -24,4 +26,6 @@ services:
- DB_USERNAME=handover
- DB_PASSWORD=yourPASShere
- VATSIM_OAUTH_CLIENT=yourCLIENThere
- VATSIM_OAUTH_SECRET=yourSECREThere
- VATSIM_OAUTH_SECRET=yourSECREThere
volumes:
storage:

0 comments on commit b4e3d6e

Please sign in to comment.