Skip to content

Commit

Permalink
refactor(common/cli): file structure use new ems archive (#1043)
Browse files Browse the repository at this point in the history
  • Loading branch information
theus77 authored Oct 14, 2024
1 parent 17c510d commit c2e8aa2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
1 change: 1 addition & 0 deletions _sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
- [Zip](/dev/submission-bundle/handlers/zip.md)
- Recipes
- [Export as word](/recipes/export-as-word.md)
- [File structure](/recipes/websites/file-structure.md)
- [Hierarchy to JSON Netsed](/recipes/hierarchy-to-json-netsed.md)
- [Store Data](/recipes/store-data.md)
- [Postprocessing](/recipes/postprocessing.md)
Expand Down
22 changes: 8 additions & 14 deletions recipes/websites/file-structure.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,28 @@
# Synchronize a directory structure and publish into an S3 bucket

First of all you must configure a [`directory`](directory.json) content type in an elasticms admin.

Each document of that `directory` content type can contains a file structure.

## Initialize a document

Just click on `New Directory`and fill the Identifier field. `Demo` in this example. Not need to fill the `Structure` fields.
# File structure

## Push a local folder to ElasticMS

The following command is available in all ElacticMS applications (Admin, Web and CLI) but required that your are logged in first (`ems:admin:login`).

```shell
php bin/console ems:file-structure:push demo ../../demo --term-field=identifier
php bin/console ems:file-structure:push ../../demo
```
This command will upload all files present in the ../../demo folder an give you an hash as output.
That hash identify an ElasticMS Archive, it's a JSON containing the all files structure (with hash, filename, size and mimetype of all files).

## Update a local folder from ElasticMS


```shell
php bin/console ems:file-structure:pull demo ../../demo --term-field=identifier
php bin/console ems:file-structure:pull d3bb0298fd9a69743333fb25dbe6cdefdc834ff2 ../../demo
```
Update the folder ../../demo by the content of the ElasticMS archive identified by the hash `d3bb0298fd9a69743333fb25dbe6cdefdc834ff2`.

## Publish a file structure to a S3 bucket

There is another command that allows you to publish a `directory` document, for a revision publish in some environment into a S3 bucket.
There is another command that allows you to publish an ElasticMS archive into a S3 bucket.

```shell
php bin/console ems:file-structure:publish demo website_preview website --term-field=identifier --s3-credential='{"version":"2006-03-01","credentials":{"key":"accesskey","secret":"secretkey"},"region":"us-east-1","endpoint":"http://localhost:9000","use_path_style_endpoint":true}'
php bin/console ems:file-structure:publish d3bb0298fd9a69743333fb25dbe6cdefdc834ff2 website --term-field=identifier --s3-credential='{"version":"2006-03-01","credentials":{"key":"accesskey","secret":"secretkey"},"region":"us-east-1","endpoint":"http://localhost:9000","use_path_style_endpoint":true}'
```

## Publish your bucket as website
Expand Down

0 comments on commit c2e8aa2

Please sign in to comment.