Вопрос

I run my php application on elastic beanstalk. Whenever, I push updates from my local repository, using git aws.push, a directory called picture along with it's all content is deleted from server. The local version of this directory is added to .gitignore, because I don't want to push it to the server. The directory on server should remain intact, as it contains uploaded images. How should I stop the directory from being deleted every time I push?

Это было полезно?

Решение

Like most Platform as a Service providers, Elastic Beanstalk does not provide a persistent filesystem:

Persistent Storage

AWS Elastic Beanstalk applications run on Amazon EC2 instances that have no persistent local storage. When the Amazon EC2 instances terminate, the local file system is not saved, and new Amazon EC2 instances start with a default file system. You should design your application to store data in a persistent data source. Amazon Web Services offers a number of persistent storage options that you can leverage for your application, including

This means that you cannot store files dynamically and expect them to survive a new deployment.

The recommended solution is to use a cloud file storage provider like S3.

Другие советы

Just to add, but from what I've seen this only applies to your app directory at var/app/current, which is indeed cleared out after you push your changes.

Files anywhere else aren't touched, we use config files to download maxmind geo dbs locally and they survive until the instance terminates.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top