|
| 1 | +--- |
| 2 | +title: Updating |
| 3 | +order: 300 |
| 4 | +--- |
| 5 | +# The Updater |
| 6 | +NativePHP ships with a built-in auto-update tool, which allows your users to update your application without needing to |
| 7 | +manually download and install new releases. |
| 8 | + |
| 9 | +This leaves you to focus on building and releasing new versions of your application, without needing to worry about |
| 10 | +distributing those updates to your users. |
| 11 | + |
| 12 | +**macOS: Automatic updating is only supported for [signed](/docs/publishing/building#signing-and-notarizing) |
| 13 | +applications.** |
| 14 | + |
| 15 | +## How it works |
| 16 | +The updater works by checking a remote URL for a new version of your application. If a new version is found, the updater |
| 17 | +will download the new version and replace the existing application files with the new ones. |
| 18 | + |
| 19 | +This means your application's builds need to be hosted online. NativePHP will automatically upload your application for |
| 20 | +you. After configuring the updater, simply use the [`php artisan native:publish`](/docs/publishing/publishing) command. |
| 21 | + |
| 22 | +The updater supports two providers: |
| 23 | + |
| 24 | +- Amazon S3 (`s3`) |
| 25 | +- DigitalOcean Spaces (`spaces`) |
| 26 | + |
| 27 | +You can configure all settings for the updater in your `config/nativephp.php` file or via your `.env` file. |
| 28 | + |
| 29 | +**The updater will only run when your app is running in production mode.** |
| 30 | + |
| 31 | +## Configuration |
| 32 | +The default updater configuration looks like this: |
| 33 | + |
| 34 | +```php |
| 35 | + 'updater' => [ |
| 36 | + 'enabled' => env('NATIVEPHP_UPDATER_ENABLED', true), |
| 37 | + |
| 38 | + 'default' => env('NATIVEPHP_UPDATER_PROVIDER', 'spaces'), |
| 39 | + |
| 40 | + 'providers' => [ |
| 41 | + 's3' => [ |
| 42 | + 'driver' => 's3', |
| 43 | + 'key' => env('AWS_ACCESS_KEY_ID'), |
| 44 | + 'secret' => env('AWS_SECRET_ACCESS_KEY'), |
| 45 | + 'region' => env('AWS_DEFAULT_REGION'), |
| 46 | + 'bucket' => env('AWS_BUCKET'), |
| 47 | + 'endpoint' => env('AWS_ENDPOINT'), |
| 48 | + 'path' => env('NATIVEPHP_UPDATER_PATH', null), |
| 49 | + ], |
| 50 | + |
| 51 | + 'spaces' => [ |
| 52 | + 'driver' => 'spaces', |
| 53 | + 'key' => env('DO_SPACES_KEY_ID'), |
| 54 | + 'secret' => env('DO_SPACES_SECRET_ACCESS_KEY'), |
| 55 | + 'name' => env('DO_SPACES_NAME'), |
| 56 | + 'region' => env('DO_SPACES_REGION'), |
| 57 | + 'path' => env('NATIVEPHP_UPDATER_PATH', null), |
| 58 | + ], |
| 59 | + ], |
| 60 | + ], |
| 61 | +``` |
| 62 | + |
| 63 | +How to setup your storage and generate the relevant API credentials: |
| 64 | +- [DigitalOcean](https://docs.digitalocean.com/products/spaces/how-to/manage-access/) |
| 65 | +- Amazon S3 - See [this video](https://www.youtube.com/watch?v=FLIp6BLtwjk&ab_channel=CloudCasts) by Chris Fidao or |
| 66 | + this [Step 2](https://www.twilio.com/docs/video/tutorials/storing-aws-s3#step-2) of this article by Twilio |
| 67 | + |
| 68 | +## Disabling the updater |
| 69 | + |
| 70 | +If you don't want your application to check for updates, you can disable the updater by setting the |
| 71 | +`updater.enabled` option to `false` in your `config/nativephp.php` file or via your `.env` file: |
| 72 | + |
| 73 | +```dotenv |
| 74 | +NATIVEPHP_UPDATER_ENABLED=false |
| 75 | +``` |
0 commit comments