There are times where you might want to trigger a redeployment of your application, such as to update environment access for a new developer or add custom TLS certificates. A redeploy reuses your built app and services.
To trigger a redeploy, follow these steps:
- In the management console, navigate to the environment you want to redeploy.
- Click Redeploy.
Run the following command:
The redeploy takes place after any scheduled activities (either Running or Pending).
Despite the name, redeployment doesn’t rerun the
deploy hook, only the
deploy hooks are tied to individual commits in code.
They’re reused until another commit is pushed to the environment.
See more about hooks and their reuse.
To rerun the
deploy hooks, manually trigger a build.
You may find that you need to clear the build cache, such as when it’s grown too big or, in rare circumstances, when it’s corrupted. It may get corrupted when code is downloaded from a third-party language service like Packagist or npm while that service is experiencing issues.
To clear the build cache, run the following command:
platform project:clear-build-cache -p <PROJECT_ID>
The next build for each environment is likely to take longer as the cache rebuilds.
If you see these errors when accessing your application, it indicates your application is crashing or unavailable.
Typical causes and potential solutions include:
.platform.app.yamlconfiguration has an error and a process isn’t starting or requests can’t be forwarded to it correctly.
- Check your
web.commands.startentry or your
- Check your
- The amount of traffic coming to your site exceeds the processing power of your application.
- Certain code paths in your application are too slow and timing out.
- Check your code is running smoothly.
- Consider adding an observability solution to get a better view of your application.
- A PHP process is crashing because of a segmentation fault.
- A PHP process is killed by the kernel out-of-memory killer.
When trying to upload a large JSON file to your API, you might see a 400 response code (
Platform.sh enforces a 10 MB limit on files with the
To send large files, use the
multipart/form-data header instead:
$ curl -XPOST 'https://example.com/graphql' --header 'Content-Type: multipart/form-data' -F file=large_file.json
If you try to use a user to create a database, you get an error saying
permission denied to create database.
The database is created for you
and can be found in the
path key of the
$PLATFORM_RELATIONSHIPS environment variable.
If you attempt to write to disk outside a
build hook, you may encounter a
read-only file system error.
Except where you define it, the file system is all read-only, with code changes necessary through git.
This gives you benefits like repeatable deployments, consistent backups, and traceability.
You can write to disk a
build hook to generate anything you need later.
Or you can declare writable mounts, which are writable even during and after deploy.
They can be used for your data: file uploads, logs, and temporary files.
If you see a build or deployment running longer than expected, it may be one of the following cases:
- The build is blocked by a process in your
- The deployment is blocked by a long running process in your
- The deployment is blocked by a long running cron job in the environment.
- The deployment is blocked by a long running cron job in the parent environment.
To determine if your environment is being stuck in the build or the deployment,
look at the activities log available in the management console or by running
If the activity has the result
success, the build has completed successfully and the system is trying to deploy.
If the result is still
running, the build is stuck.
In most regions, stuck builds terminate after one hour.
In older regions (
eu), create a support ticket to have the build killed.
When a deployment is blocked, you should try the following:
- Connect to your environment using SSH.
- Find any long-running cron jobs or deploy hooks on the environment by running
- Kill any long running processes with
kill <PID>. Replace
<PID>with the process ID shown by
activate process is stuck, try the above on the parent environment.
Builds can take long time or fail. Most of the time, it’s related to an application issue. Here are a few tips that can help you find the exact cause.
Invisible errors during the build and deploy phase can cause increased wait times, failed builds, and other problems. Investigate each log and fix any errors you find.
deploy hooks can cause long build times.
If they run into issues, they can cause the build to fail or hang indefinitely.
build hooks can be tested in your local environment.
deploy hooks can be tested either locally
or by logging into the application over SSH and running them there.
Be careful not to test the scripts on production environments.
You can also test your hooks with these Linux commands to help debug issues:
time $cmd # Print execution time strace -T $cmd # Print a system call report
Containers can’t be shutdown while long-running cron jobs and scheduled tasks are active. That means long-running cron jobs block a container from being shut down to make way for a new deploy.
Make sure your custom cron jobs run quickly and properly. Cron jobs may invoke other services in unexpected ways, which can increase execution time.