Clarify GeoIP update env setup for cached config deployments.
Deploy Ladill Link / deploy (push) Successful in 41s
Deploy Ladill Link / deploy (push) Successful in 41s
Point operators at shared/.env and config:clear when MaxMind credentials are missing. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -69,7 +69,11 @@ MAXMIND_LICENSE_KEY=
|
|||||||
3. Download the database:
|
3. Download the database:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
php artisan config:clear
|
||||||
php artisan link:geoip-update
|
php artisan link:geoip-update
|
||||||
|
php artisan config:cache
|
||||||
```
|
```
|
||||||
|
|
||||||
|
On the server, edit **`/var/www/ladill-link/shared/.env`** (not a release copy). After deploy, `current/.env` symlinks to that file. If you add env vars while config is cached, run `config:clear` before `link:geoip-update` or Laravel will not see the new values.
|
||||||
|
|
||||||
The file is stored at `storage/app/geoip/GeoLite2-Country.mmdb` by default. The command is scheduled weekly via the app scheduler — ensure cron runs `php artisan schedule:run` for link.ladill.com.
|
The file is stored at `storage/app/geoip/GeoLite2-Country.mmdb` by default. The command is scheduled weekly via the app scheduler — ensure cron runs `php artisan schedule:run` for link.ladill.com.
|
||||||
|
|||||||
@@ -15,11 +15,26 @@ class UpdateGeoIpDatabaseCommand extends Command
|
|||||||
|
|
||||||
public function handle(): int
|
public function handle(): int
|
||||||
{
|
{
|
||||||
$accountId = (string) config('link.maxmind_account_id', '');
|
$accountId = trim((string) config('link.maxmind_account_id', ''));
|
||||||
$licenseKey = (string) config('link.maxmind_license_key', '');
|
$licenseKey = trim((string) config('link.maxmind_license_key', ''));
|
||||||
|
|
||||||
if ($accountId === '' || $licenseKey === '') {
|
if ($accountId === '' || $licenseKey === '') {
|
||||||
$this->error('Set MAXMIND_ACCOUNT_ID and MAXMIND_LICENSE_KEY in .env before updating GeoIP data.');
|
$envPath = realpath(base_path('.env')) ?: base_path('.env');
|
||||||
|
$configCached = is_file(base_path('bootstrap/cache/config.php'));
|
||||||
|
|
||||||
|
$this->error('Set MAXMIND_ACCOUNT_ID and MAXMIND_LICENSE_KEY before updating GeoIP data.');
|
||||||
|
$this->line('');
|
||||||
|
$this->line('Production uses the shared env file (current/.env is usually a symlink):');
|
||||||
|
$this->line(' '.$envPath);
|
||||||
|
$this->line('');
|
||||||
|
$this->line('Add both variables there, then refresh config:');
|
||||||
|
$this->line(' php artisan config:clear');
|
||||||
|
$this->line(' php artisan link:geoip-update');
|
||||||
|
$this->line(' php artisan config:cache');
|
||||||
|
|
||||||
|
if ($configCached) {
|
||||||
|
$this->warn('Config is cached — Laravel will ignore new .env values until you run config:clear.');
|
||||||
|
}
|
||||||
|
|
||||||
return self::FAILURE;
|
return self::FAILURE;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -138,7 +138,7 @@ tar -xzf "$RELEASE_ARCHIVE" -C "$NEW_RELEASE"
|
|||||||
chmod -R u+rwX "$NEW_RELEASE" 2>/dev/null || true
|
chmod -R u+rwX "$NEW_RELEASE" 2>/dev/null || true
|
||||||
|
|
||||||
log "Linking shared paths"
|
log "Linking shared paths"
|
||||||
mkdir -p "$SHARED_DIR/storage/"{app/public,app/private,framework/{cache/data,sessions,testing,views},logs}
|
mkdir -p "$SHARED_DIR/storage/"{app/public,app/private,app/geoip,framework/{cache/data,sessions,testing,views},logs}
|
||||||
mkdir -p "$SHARED_DIR/bootstrap-cache"
|
mkdir -p "$SHARED_DIR/bootstrap-cache"
|
||||||
normalize_shared_permissions
|
normalize_shared_permissions
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user