This tutorial takes you through the steps for downloading all photos, documents and other assets store in a Beach instance to your local machine.
You will need the following before starting with this tutorial:
- a running Beach instance
- working SSH access to your instance
- a installation of the same Neos / Flow project on your local machine, using a fresh database dump from your Beach instance
Your Beach instance is using Google Cloud Storage for storing and providing the persistent resources of the Neos site or Flow application. This means that the Data/Persistent/Resources folder of your instance is empty and you need to download the assets from the Google Cloud Storage bucket instead.
The difference between storage and target buckets
Flow stores all asset originals in a "storage". This storage is private and cannot be accessed from the internet. Assets which are going to be displayed on your website or variants / thumbnails of your photos will be pubslished to the "target". The target is accessible for all internet users.
Resource information stored in the database
Neos and Flow also keep track of all resources in certain database tables. This is where metadata such as filenames are stored. Your application will always need these two components, the binary data from your storage and the metadata in the database, in order to function. Therefore make sure that you have a database state which matches the current state of your resources. Tools like ./flow resource:clean can help you to figure out if the database matches the actual set of resource files.
Steps for downloading your assets
In general, you will use a little tool (the Beach CLI tool) for donwloading all resources. This tool is quite new and all it can do, right now, is download resources. Fortunately that's exactly what you want to do, so let's start using it:
First, download the Beach CLI tool and move it to your preferred location (for example /usr/local/bin)
curl -SL "https://beach.flownative.com/cli/download" -o beach && chmod 0775 beach mv beach /usr/local/bin/beach
Next, figure out the instance identifier of your instance. You'll find it right at the top in the instance view in the Beach user interface.
When you have that, get back to the command line and navigate to your project's root directory. Now you're ready to download all the resources from the cloud to your local project:
beach resource:download -i instance-e1b43ad8-e060-4845-97f1-31b123ae5528
Finally, make sure that the database of your local project corresponds to the database of your Beach instance, so your local Neos or Flow actually knows about all the resources it now has in Data/Persistent/Resources/