Answers.Body: <p>I haven't tried Cloud Run but whenever I've had this issue it was due to the folder not having permissions for the user/group that PHP runs as. Typically it's <code>www-data:www-data</code>. In other words you might need to use <code>chown</code> instead of <code>chmod</code>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-09T03:46:33.383Z
Answers.LastActivityDate: 2021-08-09T03:46:33.383Z
Answers.UserDisplayName: Judd Lyon
Body: <p>I've been able to get Craft to run on Google App Engine (GAE), but not Cloud Run as of yet.</p>
  <p>The error message I'm seeing in the browser is:</p>
  <p><code>/app/craftcms/storage/runtime isn't writable by PHP. Please fix that.</code></p>
  <p>I encountered this error when deploying to GAE and the solution was to have the Dockerfile run a shell script that <code>chmod 755 -R ./storage</code>. This approach does not work for Cloud Run as I still see the same message in the browser despite running the same script.</p>
  <p>I know that Cloud Run is stateless, but we don't need to run admin functions while it's deployed to Cloud Run, so I can't see this being an issue. Has anyone else successfully deployed to Cloud Run?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-01-26T10:22:27.443Z
Comments.Text: Hi @Eric!
  
  May I ask how you managed to run Craft CMS on GCP App Engine Standard?
  
  As far as I understand you only have write access to /tmp on App Engine Standard, so I tried to set the following variable in bootstrap.php:
  
  define('CRAFT_STORAGE_PATH', '/tmp');
  
  But I still get an error on GCP:
  mkdir(): Read-only file system in /workspace/vendor/yiisoft/yii2/helpers/BaseFileHelper.php on line 711
  
  Cheers
  Michael
Comments.UserDisplayName: Michael Hunziker
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-01-29T22:13:47.877Z
Comments.Text: @MichaelHunziker we used Memorystory's Memcached for temporary files, Google Cloud Storage for image transformation variants via the GCS plugin, and disable logging to a file in production (obviously) and route through stdout.
Comments.UserDisplayName: Eric
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-01-31T14:20:30.217Z
Comments.Text: Thanks a lot @Eric!
Comments.UserDisplayName: Michael Hunziker
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-01-31T14:49:09.750Z
Comments.Text: If you don't mind me asking:
  
  So you use Memcached for tmp files, for example the cpresources, right?
  
  How have you been able to "serve" these cpresources? Do you have a special handler defined in your GCP app.yaml for this?
Comments.UserDisplayName: Michael Hunziker
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-01-31T15:14:03.970Z
Comments.Text: Never mind...
  
  I just figured out this is the only handler i need:
  
  entrypoint: serve web/index.php
  
  handlers:
  
    - url: .*
      script: auto
Comments.UserDisplayName: Michael Hunziker
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-02-02T18:30:47.423Z
Comments.Text: Sure thing @MichaelHunziker - happy to help
Comments.UserDisplayName: Eric
Tags: <deployment>
Title: Is it possible to run Craft CMS on Google's Cloud Run?
ThreadText: # Is it possible to run Craft CMS on Google's Cloud Run?
  
  (Asked by: username_0 on 2021-08-06)
  
  I've been able to get Craft to run on Google App Engine (GAE), but not Cloud Run as of yet.
  
  The error message I'm seeing in the browser is:
  
  `/app/craftcms/storage/runtime isn't writable by PHP. Please fix that.`
  
  I encountered this error when deploying to GAE and the solution was to have the Dockerfile run a shell script that `chmod 755 -R ./storage`. This approach does not work for Cloud Run as I still see the same message in the browser despite running the same script.
  
  I know that Cloud Run is stateless, but we don't need to run admin functions while it's deployed to Cloud Run, so I can't see this being an issue. Has anyone else successfully deployed to Cloud Run?
  
  **Tags:** deployment
  
  > **Comments:**
  > **username_1**: Hi @username_0!  May I ask how you managed to run Craft CMS on GCP App Engine Standard?  As far as I understand you only have write access to /tmp on App Engine Standard, so I tried to set the following variable in bootstrap.php:  define('CRAFT_STORAGE_PATH', '/tmp');  But I still get an error on GCP: mkdir(): Read-only file system in /workspace/vendor/yiisoft/yii2/helpers/BaseFileHelper.php on line 711  Cheers username_1  
  > **username_0**: @username_1 we used Memorystory's Memcached for temporary files, Google Cloud Storage for image transformation variants via the GCS plugin, and disable logging to a file in production (obviously) and route through stdout.  
  > **username_1**: Thanks a lot @username_0!  
  > **username_1**: If you don't mind me asking:  So you use Memcached for tmp files, for example the cpresources, right?  How have you been able to "serve" these cpresources? Do you have a special handler defined in your GCP app.yaml for this?  
  > **username_1**: Never mind...  I just figured out this is the only handler i need:  entrypoint: serve web/index.php  handlers:    - url: .*     script: auto  
  > **username_0**: Sure thing @username_1 - happy to help  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2021-08-09. Score: 1
  
  I haven't tried Cloud Run but whenever I've had this issue it was due to the folder not having permissions for the user/group that PHP runs as. Typically it's `www-data:www-data`. In other words you might need to use `chown` instead of `chmod`.
  
  
  ---
  
  