Skip to content

Preview backend service for Zextras Carbonio CE

License

Notifications You must be signed in to change notification settings

zextras/carbonio-preview-ce

Repository files navigation

Carbonio-Preview-ce 🚀

Preview-ce backend service for Zextras Carbonio

Contributors Activity security: bandit Code style: black Ruff License Project Twitter

You can preview the following type of files:

  • images(png/jpeg/gif)
  • pdf
  • docx, doc, odp, odt, ppt, xls, xlsx

You will be able to:

  • Get preview of files.
  • Generate thumbnail of files.

Preview will always try to output the file in its original format, while thumbnail will convert it to an image. There is no difference in quality between the two, the difference in quality can be achieved only by asking for a jpeg format and changing the quality parameter. Asking for a GIF output can only be done when the input file is a GIF, otherwise it will raise and error.

APIs Documentation 📚

Once the service is up and running, APIs will be found here

Dependencies 🔗

These are the dependencies that the service has. These dependencies are required to run the service correctly but are not installed by the package. They must be installed if Mandatory otherwise user discretion is advised

Name Mandatory/Optional
carbonio-storages-ce Optional
carbonio-docs-editor Optional

Service installation 🏁

Install carbonio-preview-ce via apt:

sudo apt install carbonio-preview-ce

or via yum:

sudo yum install carbonio-preview-ce

Daemon setup 📈

After the installation you must run pending-setups in order to register the service in service-discover. This will start the service as a daemon and allow carbonio-preview-ce to communicate with the suite using Consul.

Project setup ⚙️🔧

To develop this project you will need to configure a proper enviroment.

  • download the project from the repository:
git clone 'https://github.com/Zextras/carbonio-preview-ce'
  • Go to the project folder
virtualenv --python /usr/bin/python3 venv
source venv/bin/activate
  • Install python libraries
pip3 install -r "dev_requirements.txt"

Debug and run 🔎

To start the application from command line, go to the project folder and type:

gunicorn controller:app --config gunicorn.conf.py

There are others alternatives, you can also start the program from the main class (if you want to debug it).

CI and Tests 🤖

Static analysis is provided by a few tools:

  • Bandit: security analysis;
  • Flake8: code style and indentation analysis;
  • Pre-commit: runs static analysis before every commit;
  • autopep8: called automatically by pre-commit to static errors.

Pre-commit needs to be activated in the root directory of the project using:

pre-commit install

To activate commit lint (mandatory) then:

pre-commit install --hook-type commit-msg

To run unit tests manually, run the following command from the project folder:

python -m pytest

Tech Stack 💾

All the python libraries used can be found on the "requirements.txt" file.

License

Official Preview-ce backend service for Zextras Carbonio.

Released under the AGPL-3.0-only license as specified here: COPYING.

See COPYING file for the project license details

See THIRDPARTIES file for other licenses details

Copyright notice

All non-software material (such as, for example, names, images, logos, sounds) is owned by Zextras s.r.l. and is licensed under CC-BY-NC-SA.

Where not specified, all source files owned by Zextras s.r.l. are licensed under AGPL-3.0-only