Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.x] Updates manifest validation #243

Merged
merged 2 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions src/BuildProcess/ValidateManifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,12 @@ protected function warnAboutDeprecations()
if (in_array(Manifest::runtime($this->environment), [
'php-7.3',
'php-7.4',
'php-8.0',
])) {
Helpers::warn(
'The runtimes "php-7.3", "php-7.4", and "php-8.0" are deprecated and support will be fully removed from Vapor on December 31st, 2023.'
.' Those runtimes are based on Amazon Linux 1, for which AWS standard support has ended.'
.' Amazon Linux 1 is only receiving critical and important security updates and it may not work with new Vapor/AWS features.'
.' Please use Amazon Linux 2 with "php-7.4:al2" or "php-8.0:al2" instead.'
);
}

if (in_array(Manifest::runtime($this->environment), [
'php-7.4:al2',
'php-7.4:imagick',
'php-8.0',
])) {
Helpers::warn(
'The runtimes "php-7.4:al2", and "php-7.4:imagick" are deprecated and support will be fully removed from Vapor on December 31st, 2023.'
.' PHP 7.4 is no longer being maintained or receiving security updates.'
'The runtimes "php-7.3", "php-7.4", "php-7.4:al2", "php-7.4:imagick", and "php-8.0" are deprecated and will no longer be supported or receiving any updates.'
.' For a full list of supported runtimes, please see: https://docs.vapor.build/1.0/projects/environments.html#runtime'
);
}
Expand Down
22 changes: 11 additions & 11 deletions src/CacheInstanceClasses.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ class CacheInstanceClasses
public static function general()
{
return [
'cache.t3.micro' => 'cache.t3.micro - (2 VCPU, 0.5Gib RAM) - Free Tier Eligible ~$13 / month',
'cache.t3.small' => 'cache.t3.small - (2 VCPU, 1.37Gib RAM) - ~$25 / month',
'cache.t3.medium' => 'cache.t3.medium - (2 VCPU, 3.09Gib RAM) - ~$50 / month',
'cache.m5.large' => 'cache.m5.large - (2 VCPU, 6.38Gib RAM) - ~$112 / month',
'cache.m5.xlarge' => 'cache.m5.xlarge - (4 VCPU, 12.93Gib RAM) - ~$224 / month',
'cache.m5.2xlarge' => 'cache.m5.2xlarge - (8 VCPU, 26.04Gib RAM) - ~$449 / month',
'cache.m5.4xlarge' => 'cache.m5.4xlarge - (16 VCPU, 52.26Gib RAM) - ~$897 / month',
'cache.t3.micro' => 'cache.t3.micro - (2 VCPU, 0.5Gib RAM) - Free Tier Eligible ~$13 / month',
'cache.t3.small' => 'cache.t3.small - (2 VCPU, 1.37Gib RAM) - ~$25 / month',
'cache.t3.medium' => 'cache.t3.medium - (2 VCPU, 3.09Gib RAM) - ~$50 / month',
'cache.m5.large' => 'cache.m5.large - (2 VCPU, 6.38Gib RAM) - ~$112 / month',
'cache.m5.xlarge' => 'cache.m5.xlarge - (4 VCPU, 12.93Gib RAM) - ~$224 / month',
'cache.m5.2xlarge' => 'cache.m5.2xlarge - (8 VCPU, 26.04Gib RAM) - ~$449 / month',
'cache.m5.4xlarge' => 'cache.m5.4xlarge - (16 VCPU, 52.26Gib RAM) - ~$897 / month',
'cache.m5.12xlarge' => 'cache.m5.12xlarge - (48 VCPU, 157.12Gib RAM) - ~$2696 / month',
'cache.m5.24xlarge' => 'cache.m5.24xlarge - (96 VCPU, 314.32Gib RAM) - ~$5392 / month',
];
Expand All @@ -32,10 +32,10 @@ public static function general()
public static function memory()
{
return [
'cache.r5.large' => 'cache.r5.large - (2 VCPU, 13.07Gib RAM) - ~$156 / month',
'cache.r5.xlarge' => 'cache.r5.xlarge - (4 VCPU, 26.32GiB RAM) - ~$310 / month',
'cache.r5.2xlarge' => 'cache.r5.2xlarge - (8 VCPU, 52.82GiB RAM) - ~$621 / month',
'cache.r5.4xlarge' => 'cache.r5.4xlarge - (16 VCPU, 105.81GiB RAM) - ~$1241 / month',
'cache.r5.large' => 'cache.r5.large - (2 VCPU, 13.07Gib RAM) - ~$156 / month',
'cache.r5.xlarge' => 'cache.r5.xlarge - (4 VCPU, 26.32GiB RAM) - ~$310 / month',
'cache.r5.2xlarge' => 'cache.r5.2xlarge - (8 VCPU, 52.82GiB RAM) - ~$621 / month',
'cache.r5.4xlarge' => 'cache.r5.4xlarge - (16 VCPU, 105.81GiB RAM) - ~$1241 / month',
'cache.r5.12xlarge' => 'cache.r5.12xlarge - (48 VCPU, 317.77GiB RAM) - ~$3732 / month',
'cache.r5.24xlarge' => 'cache.r5.24xlarge - (96 VCPU, 635.61GiB RAM) - ~$7465 / month',
];
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/DatabaseScaleCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected function determineRdsInstanceClass()
{
$type = $this->menu('Which type of database instance would you like to scale to?', [
'general' => 'General Purpose',
'memory' => 'Memory Optimized',
'memory' => 'Memory Optimized',
]);

if ($type == 'general') {
Expand Down
6 changes: 3 additions & 3 deletions src/Commands/EnvCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ public function handle()
);

Manifest::addEnvironment($environment, [
'memory' => 1024,
'memory' => 1024,
'cli-memory' => 512,
'runtime' => $this->option('docker') ? 'docker' : 'php-8.2:al2',
'build' => [
'runtime' => $this->option('docker') ? 'docker' : 'php-8.2:al2',
'build' => [
'COMPOSER_MIRROR_PATH_REPOS=1 composer install --no-dev',
'php artisan event:cache',
file_exists(Path::current().'/webpack.mix.js')
Expand Down
26 changes: 13 additions & 13 deletions src/Commands/EnvDescribeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,20 @@ public function handle()
$domain = count($domains) ? $domains[0] : null;

$description = [
'project_id' => $environment['project_id'],
'uuid' => $environment['uuid'],
'id' => $environment['id'],
'name' => $environment['name'],
'vanity_domain' => $environment['vanity_domain'],
'latest_deployment_id' => $environment['latest_deployment_id'],
'project_id' => $environment['project_id'],
'uuid' => $environment['uuid'],
'id' => $environment['id'],
'name' => $environment['name'],
'vanity_domain' => $environment['vanity_domain'],
'latest_deployment_id' => $environment['latest_deployment_id'],
'latest_deployment_status' => $environment['latest_deployment'] ? $environment['latest_deployment']['status'] : null,
'latest_deployment_url' => 'https://vapor.laravel.com/app/projects/'.$environment['project_id'].'/environments/'.$environment['name'].'/deployments/'.$environment['latest_deployment_id'],
'deployment_status' => $environment['deployment_status'],
'domains' => $domains,
'domain' => $domain,
'management_url' => 'https://vapor.laravel.com/app/projects/'.$environment['project_id'].'/environments/'.$environment['name'],
'vanity_url' => 'https://'.$environment['vanity_domain'],
'custom_url' => $domain ? 'https://'.$domain : null,
'latest_deployment_url' => 'https://vapor.laravel.com/app/projects/'.$environment['project_id'].'/environments/'.$environment['name'].'/deployments/'.$environment['latest_deployment_id'],
'deployment_status' => $environment['deployment_status'],
'domains' => $domains,
'domain' => $domain,
'management_url' => 'https://vapor.laravel.com/app/projects/'.$environment['project_id'].'/environments/'.$environment['name'],
'vanity_url' => 'https://'.$environment['vanity_domain'],
'custom_url' => $domain ? 'https://'.$domain : null,
];

if ($this->option('list')) {
Expand Down
18 changes: 9 additions & 9 deletions src/Commands/LocalCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,36 +106,36 @@ protected function dockerConfiguration()
}

return [
'version' => '3.7',
'version' => '3.7',
'services' => [
'redis' => [
'image' => 'redis:alpine',
'image' => 'redis:alpine',
'volumes' => [
'vapor_redis:/data',
],
'restart' => 'always',
],
'mysql' => [
'image' => 'mysql:8.0',
'image' => 'mysql:8.0',
'volumes' => [
0 => 'vapor_mysql:/var/lib/mysql',
],
'restart' => 'always',
'restart' => 'always',
'environment' => [
'MYSQL_ROOT_PASSWORD' => 'secret',
'MYSQL_DATABASE' => 'vapor',
'MYSQL_USER' => 'vapor',
'MYSQL_PASSWORD' => 'secret',
'MYSQL_DATABASE' => 'vapor',
'MYSQL_USER' => 'vapor',
'MYSQL_PASSWORD' => 'secret',
],
],
'app' => [
'image' => static::$images[$this->option('php') ? $this->option('php') : '8.2'],
'image' => static::$images[$this->option('php') ? $this->option('php') : '8.2'],
'depends_on' => [
0 => 'mysql',
1 => 'redis',
],
'restart' => 'always',
'init' => true,
'init' => true,
],
],
'volumes' => [
Expand Down
12 changes: 6 additions & 6 deletions src/Commands/ProjectDescribeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ public function handle()
$project = $this->vapor->project(Manifest::id());

$description = [
'id' => $project['id'],
'name' => $project['name'],
'team_id' => $project['team_id'],
'team_name' => $project['team']['name'],
'region' => $project['region'],
'id' => $project['id'],
'name' => $project['name'],
'team_id' => $project['team_id'],
'team_name' => $project['team']['name'],
'region' => $project['region'],
'github_repository' => $project['github_repository'],
'management_url' => 'https://vapor.laravel.com/app/projects/'.$project['id'],
'management_url' => 'https://vapor.laravel.com/app/projects/'.$project['id'],
];

if ($this->option('list')) {
Expand Down
4 changes: 2 additions & 2 deletions src/Commands/RetrievesProviderCredentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protected function getAWSCredentials()
}

return [
'key' => Helpers::ask('What is your AWS user key'),
'key' => Helpers::ask('What is your AWS user key'),
'secret' => Helpers::secret('What is your AWS user secret'),
];
}
Expand All @@ -36,7 +36,7 @@ protected function getCredentialsFromFile()
);

return [
'key' => $credentials[$credential]['aws_access_key_id'],
'key' => $credentials[$credential]['aws_access_key_id'],
'secret' => $credentials[$credential]['aws_secret_access_key'],
];
}
Expand Down
62 changes: 31 additions & 31 deletions src/ConsoleVaporClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ public function login($email, $password, $twoFactorAuthenticationToken = null)
{
try {
return $this->request('post', '/api/login', [
'host' => gethostname(),
'email' => $email,
'password' => $password,
'host' => gethostname(),
'email' => $email,
'password' => $password,
'two_factor_token' => $twoFactorAuthenticationToken,
])['access_token'];
} catch (ClientException $e) {
Expand Down Expand Up @@ -102,7 +102,7 @@ public function teamMembers()
public function addTeamMember($email, array $permissions)
{
$this->requestWithErrorHandling('post', '/api/teams/'.Helpers::config('team').'/members', [
'email' => $email,
'email' => $email,
'permissions' => $permissions,
]);
}
Expand Down Expand Up @@ -232,7 +232,7 @@ public function createZone($providerId, $zone)
{
return $this->requestWithErrorHandling('post', '/api/teams/'.Helpers::config('team').'/zones', [
'cloud_provider_id' => $providerId,
'zone' => $zone,
'zone' => $zone,
]);
}

Expand Down Expand Up @@ -270,8 +270,8 @@ public function records($zoneId)
public function createRecord($zoneId, $type, $name, $value)
{
return $this->requestWithErrorHandling('put', '/api/zones/'.$zoneId.'/records', [
'type' => $type,
'name' => $name,
'type' => $type,
'name' => $name,
'value' => $value,
]);
}
Expand Down Expand Up @@ -323,9 +323,9 @@ public function network($networkId)
public function createNetwork($providerId, $name, $region, $withInternetAccess)
{
$this->requestWithErrorHandling('post', '/api/teams/'.Helpers::config('team').'/networks', [
'cloud_provider_id' => $providerId,
'name' => $name,
'region' => $region,
'cloud_provider_id' => $providerId,
'name' => $name,
'region' => $region,
'with_internet_access' => $withInternetAccess,
]);
}
Expand Down Expand Up @@ -399,12 +399,12 @@ public function database($databaseId)
public function createDatabase($networkId, $name, $type, $instanceClass, $storage, $public, $pause = false)
{
return $this->requestWithErrorHandling('post', '/api/networks/'.$networkId.'/databases', [
'name' => $name,
'type' => $type,
'name' => $name,
'type' => $type,
'instance_class' => $instanceClass,
'storage' => $storage,
'public' => $public,
'pause' => $pause,
'storage' => $storage,
'public' => $public,
'pause' => $pause,
]);
}

Expand All @@ -420,7 +420,7 @@ public function scaleDatabase($databaseId, $instanceClass, $storage)
{
$this->requestWithErrorHandling('put', '/api/databases/'.$databaseId.'/size', [
'instance_class' => $instanceClass,
'storage' => $storage,
'storage' => $storage,
]);
}

Expand Down Expand Up @@ -507,7 +507,7 @@ public function rotateDatabasePassword($databaseId)
public function restoreDatabase($databaseId, $name, $restoreTo)
{
return $this->requestWithErrorHandling('post', '/api/restored-databases?database_id='.$databaseId, [
'name' => $name,
'name' => $name,
'restore_to' => $restoreTo,
]);
}
Expand Down Expand Up @@ -585,8 +585,8 @@ public function cache($cacheId)
public function createCache($networkId, $name, $type, $instanceClass)
{
return $this->requestWithErrorHandling('post', '/api/networks/'.$networkId.'/caches', [
'name' => $name,
'type' => $type,
'name' => $name,
'type' => $type,
'instance_class' => $instanceClass,
]);
}
Expand Down Expand Up @@ -734,9 +734,9 @@ public function requestCertificate($providerId, $domain, array $alternativeNames
{
$this->requestWithErrorHandling('post', '/api/teams/'.Helpers::config('team').'/certificates', [
'cloud_provider_id' => $providerId,
'domain' => $domain,
'domain' => $domain,
'alternative_names' => $alternativeNames,
'region' => $region,
'region' => $region,
'validation_method' => $validationMethod,
]);
}
Expand Down Expand Up @@ -1024,12 +1024,12 @@ public function createArtifact(
$coreVersion = null
) {
$artifact = $this->requestWithErrorHandling('post', '/api/projects/'.$projectId.'/artifacts/'.$environment, [
'uuid' => $uuid,
'commit' => $commit,
'uuid' => $uuid,
'commit' => $commit,
'commit_message' => $commitMessage,
'vendor_hash' => $vendorHash,
'cli_version' => $cliVersion,
'core_version' => $coreVersion,
'vendor_hash' => $vendorHash,
'cli_version' => $cliVersion,
'core_version' => $coreVersion,
'uses_container_image' => is_null($file),
]);

Expand Down Expand Up @@ -1123,8 +1123,8 @@ public function deployment($deploymentId)
public function validateManifest($projectId, $environment, array $manifest, $cliVersion = null, $coreVersion = null)
{
$this->requestWithErrorHandling('post', '/api/projects/'.$projectId.'/environments/'.$environment.'/linted-manifest', [
'manifest' => $manifest,
'cli_version' => $cliVersion,
'manifest' => $manifest,
'cli_version' => $cliVersion,
'core_version' => $coreVersion,
]);
}
Expand Down Expand Up @@ -1450,10 +1450,10 @@ protected function request($method, $uri, array $json = [], $tries = 0)
protected function requestWithoutErrorHandling($method, $uri, array $json = [])
{
return json_decode((string) $this->client()->request($method, ltrim($uri, '/'), [
'json' => $json,
'json' => $json,
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Content-Type' => 'application/json',
'Authorization' => 'Bearer '.Helpers::config('token', $_ENV['VAPOR_API_TOKEN'] ?? getenv('VAPOR_API_TOKEN') ?? null),
],
])->getBody(), true);
Expand Down
Loading
Loading