Commit 22db89ee authored by Alain Takoudjou's avatar Alain Takoudjou

WIP: add new SR for signaturepdf

parent 1d9d9781
# THIS IS NOT A BUILDOUT FILE, despite purposedly using a compatible syntax.
# The only allowed lines here are (regexes):
# - "^#" comments, copied verbatim
# - "^[" section beginings, copied verbatim
# - lines containing an "=" sign which must fit in the following categorie.
# - "^\s*filename\s*=\s*path\s*$" where "path" is relative to this file
# Copied verbatim.
# - "^\s*hashtype\s*=.*" where "hashtype" is one of the values supported
# by the re-generation script.
# Re-generated.
# - other lines are copied verbatim
# Substitution (${...:...}), extension ([buildout] extends = ...) and
# section inheritance (< = ...) are NOT supported (but you should really
# not need these here).
[template-signaturepdf-instance]
filename = signaturepdf-instance.cfg.in
md5sum = b95da85fd8f2157e65b4a9f9376298dd
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Parameters to instantiate Signature PDF",
"type": "object",
"additionalProperties": false,
"properties": {
"instance.proxy-url": {
"title": "Proxy URL",
"description": "Url used to access signature pdf instance.",
"type": "string",
"format": "uri",
"default": ""
},
"instance.nss-cert-nick": {
"title": "NSS Certificate Nick name",
"description": "NSS Certificate Nick name without dot (.).",
"type": "string",
"default": "rapid_space_nexedi"
}
}
}
{
"$schema": "http://json-schema.org/draft-07/schema#",
"name": "Output Parameters",
"properties": {
"backend-url": {
"title": "Backend URL",
"description": "URL used to connect directly to backend without frontend. Requires IPv6.",
"type": "string",
"format": "uri",
"require": true
},
"url": {
"title": "URL",
"description": "URL used to connect to the service.",
"type": "string",
"format": "uri",
"require": false
}
}
}
#############
# Redis #
#############
[pdf-directory]
recipe = slapos.cookbook:mkdirectory
data = ${directory:srv}/data
meta = ${:data}/meta
backup = ${directory:backup}/signature
tmp = ${buildout:directory}/tmp
nss = ${directory:srv}/nss
[apache-php-configuration]
document-root = ${directory:www}/public
[instance-parameter]
# php.ini
php.opcache.revalidate-freq = 60
php.opcache.interned-strings-buffer = 24
php.max_file_uploads = 200
signature-pdf-url = ${slap-parameter:instance.proxy-url}
nss-cert-nick = ${slap-parameter:instance.nss-cert-nick}
[config.ini]
recipe = collective.recipe.template
output = ${directory:www}/config/config.ini
input = inline:[globals]
PDF_STORAGE_PATH=${pdf-directory:data}
DISABLE_ORGANIZATION=false
; Manage demo link pdf : true (by default, show with default link), false (hide), or custom link
PDF_DEMO_LINK=true
METADATA_DEFAULT_FIELDS[metadata_key].type = "text"
;Declare your public domain here if you can't handle location rewriting through your reverse proxy.
REVERSE_PROXY_URL=${instance-parameter:signature-pdf-url}
; Encryption activation (need GPG is installed)
PDF_STORAGE_ENCRYPTION=false
; Authorize these IP to use debug mode (separate IP adresses with space ' ')
;ADMIN_AUTHORIZED_IP=
; Enable the edition of local server pdf metadata
PDF_LOCAL_PATH=${pdf-directory:meta}
NSS3_DIRECTORY=${pdf-directory:nss}/
NSS3_PASSWORD="${nss-password:passwd}"
NSS3_NICK="${instance-parameter:nss-cert-nick}"
depends = ${copy-application:recipe}
[apache-php-wrapper]
environment =
PATH=${directory:bin}:{{ imagemagick_location }}/bin:{{ libnss3_location }}/bin:{{ poppler_location }}/bin:{{ ghostscript_location }}/bin:{{ potrace_location }}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
DEFAULT_LANGUAGE=fr_FR.UTF-8
LANG=$DEFAULT_LANGUAGE
LANGUAGE=$DEFAULT_LANGUAGE
LC_ALL=$DEFAULT_LANGUAGE
[nss-password]
recipe = slapos.cookbook:generate.password
storage-path = ${directory:etc}/.nss_pwd
[pdftk-wrapper]
recipe = slapos.cookbook:wrapper
wrapper-path = ${directory:bin}/pdftk
command-line = {{ java_jdk_location }}/bin/java -jar {{ pdftk_bin }}
[convert-wrapper]
recipe = slapos.cookbook:wrapper
command-line =
{{ imagemagick_location }}/bin/convert
wrapper-path = ${directory:bin}/convert
[rsvg-convert-wrapper]
recipe = slapos.cookbook:wrapper
wrapper-path = ${directory:bin}/rsvg-convert
command-line = {{ librsvg_location }}/bin/rsvg-convert
[create-nss-certificates]
recipe = slapos.cookbook:wrapper
wrapper-path = ${directory:bin}/create-nss-certificates
command-line = bash ${directory:www}/tools/create_nss_certs.sh ${pdf-directory:nss}/ ${nss-password:passwd} ${instance-parameter:nss-cert-nick} ${instance-parameter:signature-pdf-url}
environment = ${apache-php-wrapper:environment}
[signaturepdf-install.sh-X]
recipe = slapos.recipe.template:jinja2
url =
output = ${directory:scripts}/nextcloud-install
context =
section parameter_dict instance-parameter
depends =
[signaturepdf-install.sh]
recipe = plone.recipe.command
command = echo true
depends =
${config.ini:recipe}
${pdftk-wrapper:recipe}
${convert-wrapper:recipe}
${rsvg-convert-wrapper:recipe}
${create-nss-certificates:recipe}
[publish-connection-information]
nss-password = ${nss-password:passwd}
[slap-parameter]
instance.proxy-url = https://softinst281246.host.vifib.net
instance.nss-cert-nick = rapid_space_nexedi
[buildout]
extends =
buildout.hash.cfg
../..//component/java-jdk/buildout.cfg
../../component/librsvg/buildout.cfg
../../component/ghostscript/buildout.cfg
../../component/potrace/buildout.cfg
../../component/gnupg/buildout.cfg
../../component/imagemagick/buildout.cfg
../../component/poppler/buildout.cfg
../../stack/lamp/buildout.cfg
[signature-download]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/${:filename}
[pdftk]
recipe = slapos.recipe.build:download
url = https://gitlab.com/pdftk-java/pdftk/-/jobs/924565145/artifacts/raw/build/libs/pdftk-all.jar
md5sum = 53b2991d7714c8dc82b61a5178be3a89
filename = pdftk.jar
[application]
url = https://github.com/24eme/signaturepdf/archive/refs/tags/v1.7.2.tar.gz
md5sum = a124b0249713274426bd4cbdae6b6e8c
[template-nextcloud-install.sh]
<= nc-download
[template-nextcloud-config.json]
<= nc-download
[template-signaturepdf-instance]
recipe = slapos.recipe.template:jinja2
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:directory}/instance-signaturepdf.cfg
extensions = jinja2.ext.do
context =
key gzip_location gzip:location
key php_location apache-php:location
key ghostscript_location ghostscript:location
key potrace_location potrace:location
key poppler_location poppler:location
key libnss3_location libnss3:location
key imagemagick_location imagemagick:location
key java_jdk_location java-jdk:location
key librsvg_location librsvg:location
raw pdftk_bin ${pdftk:location}/${pdftk:filename}
# raw gpg_bin_location ${ gnupg:location}/bin
[custom-application-deployment]
path = ${template-signaturepdf-instance:output}
part-list = signaturepdf-install.sh
db-name = signature-pdf
db-user = signaturepdf
[nc-download-unpacked]
recipe = slapos.recipe.build:download-unpacked
[news-updater]
<= nc-download-unpacked
url = https://github.com/nextcloud/news-updater/archive/11.0.0.tar.gz
md5sum = 1e75222638cab49d3f66b7c76394f104
[versions]
gyp-next = 0.17.0
{
"name": "SignaturePDF",
"description": "SignaturePDF",
"serialisation": "xml",
"software-type": {
"default": {
"title": "Default",
"description": "Instance Signature PDF",
"request": "signaturepdf-input-schema.json",
"response": "signaturepdf-output-schema.json",
"index": 0
}
}
}
Tests for SignaturePDF Software Release
##############################################################################
#
# Copyright (c) 2018 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from setuptools import setup, find_packages
import glob
import os
version = '0.0.1.dev0'
name = 'slapos.test.signaturepdf'
long_description = open("README.md").read()
setup(name=name,
version=version,
description="Test for SignaturePDF Software Release",
long_description=long_description,
long_description_content_type='text/markdown',
maintainer="Nexedi",
maintainer_email="info@nexedi.com",
url="https://lab.nexedi.com/nexedi/slapos",
packages=find_packages(),
install_requires=[
'slapos.core',
'slapos.cookbook',
'slapos.libnetworkcache',
'erp5.util',
'supervisor',
'psutil',
],
zip_safe=True,
test_suite='test',
)
##############################################################################
#
# Copyright (c) 2018 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from __future__ import unicode_literals
import os
import requests
from slapos.testing.testcase import makeModuleSetUpAndTestCaseClass
setUpModule, SlapOSInstanceTestCase = makeModuleSetUpAndTestCaseClass(
os.path.abspath(
os.path.join(os.path.dirname(__file__), '../software.cfg')))
class TestSignaturePDF(SlapOSInstanceTestCase):
__partition_reference__ = 'PDF'
def setUp(self):
self.connection_parameters = self.computer_partition.getConnectionParameterDict()
def test_url_get(self):
resp = requests.get(self.connection_parameters['url'], verify=False)
self.assertEqual(requests.codes.ok, resp.status_code)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment