Commit a2bc75f2 authored by Alexandros Georgantas's avatar Alexandros Georgantas
Browse files

feat(service): xsweet service finalized

parent 82cb2cf3
Pipeline #14833 canceled with stages
const { commitizen } = require('@coko/lint')
commitizen.scopes = ['service', '*']
module.exports = commitizen
database
temp
.*
config/*.env
*.config.*
docker-compose.yml
docker-compose.*.yml
Dockerfile
*.log
\ No newline at end of file
!.cz-config.js
!.eslintrc.js
!.prettierrc.js
const { eslint } = require('@coko/lint')
module.exports = eslint
node_modules
yarn-error.log
config/*.env
database
config/local*
epubcheck_data/*
epubcheck_log/*
epubchecker_data/*
epubchecker_log/*
logs/*
tmp/
temp/
uploads/*
.env.*
\ No newline at end of file
const { prettier } = require('@coko/lint')
module.exports = prettier
FROM node:12-alpine
RUN apk update && apk add --no-cache unzip openjdk11-jre-headless
WORKDIR /home/node/service-xsweet
# Download XSweet
RUN wget https://gitlab.coko.foundation/XSweet/XSweet/repository/archive.zip?ref=master -O xsweet.zip; unzip xsweet.zip; rm xsweet.zip
RUN wget https://gitlab.coko.foundation/XSweet/editoria_typescript/repository/archive.zip?ref=master -O typescript.zip; unzip typescript.zip; rm typescript.zip
RUN wget https://gitlab.coko.foundation/XSweet/HTMLevator/repository/archive.zip?ref=master -O htmlevator.zip; unzip htmlevator.zip; rm htmlevator.zip
# Download Saxon
RUN wget "https://downloads.sourceforge.net/project/saxon/Saxon-HE/9.9/SaxonHE9-9-1-1J.zip" -O saxon.zip; unzip saxon.zip -d saxon; rm saxon.zip
RUN chown -R node:node /home/node/service-xsweet
COPY package.json ./package.json
COPY yarn.lock ./yarn.lock
RUN yarn
COPY . .
RUN chmod +x ./scripts/move_xslts.sh
RUN chmod +x ./scripts/wait-for-it.sh
RUN chmod +x ./scripts/execute_chain.sh
RUN ./scripts/move_xslts.sh
USER node
ENTRYPOINT . scripts/startServer.sh
module.exports = {
extends: ['@commitlint/config-conventional'],
}
const permissions = {
// eslint-disable-next-line consistent-return
before: () => true,
}
module.exports = permissions
[
"@coko/service-auth",
"@coko/service-auth/src/models/service-client",
"./server/"
]
module.exports = {
'pubsweet-server': {
secret: 'PUBSWEET_SECRET',
db: {
user: 'POSTGRES_USER',
password: 'POSTGRES_PASSWORD',
host: 'POSTGRES_HOST',
database: 'POSTGRES_DB',
port: 'POSTGRES_PORT',
},
port: 'SERVER_PORT',
},
}
const winston = require('winston')
const path = require('path')
const components = require('./components')
const logger = new winston.Logger({
transports: [
new winston.transports.Console({
colorize: true,
}),
],
})
module.exports = {
authsome: {
mode: path.join(__dirname, 'authsome.js'),
},
publicKeys: ['pubsweet', 'pubsweet-server'],
pubsweet: {
components,
},
'pubsweet-server': {
db: {},
logger,
port: 3000,
useGraphQLServer: false,
pool: { min: 0, max: 10, idleTimeoutMillis: 1000 },
},
}
const { deferConfig } = require('config/defer')
const path = require('path')
const winston = require('winston')
require('winston-daily-rotate-file')
const logger = new winston.Logger({
transports: [
new winston.transports.Console({
colorize: true,
}),
new winston.transports.DailyRotateFile({
filename: 'app-%DATE%.log',
dirname: path.join(__dirname, '../logs/development'),
datePattern: 'DD-MM-YYYY',
zippedArchive: true,
maxFiles: '30d',
json: true,
handleExceptions: true,
humanReadableUnhandledException: true,
}),
],
})
module.exports = {
'pubsweet-server': {
baseUrl: deferConfig(
cfg => `http://localhost:${cfg['pubsweet-server'].port}`,
),
logger,
},
}
const { deferConfig } = require('config/defer')
const path = require('path')
const winston = require('winston')
require('winston-daily-rotate-file')
const logger = new winston.Logger({
transports: [
new winston.transports.Console({
colorize: true,
}),
new winston.transports.DailyRotateFile({
filename: 'app-%DATE%.log',
dirname: path.join(__dirname, '../logs/production'),
datePattern: 'DD-MM-YYYY',
zippedArchive: true,
maxFiles: '30d',
json: true,
handleExceptions: true,
humanReadableUnhandledException: true,
}),
],
})
module.exports = {
'pubsweet-server': {
baseUrl: deferConfig(
cfg => `http://localhost:${cfg['pubsweet-server'].port}`,
),
logger,
},
}
version: '2'
services:
epub-checker:
build:
context: .
dockerfile: ./Dockerfile
restart: always
ports:
- ${SERVER_PORT:-3050}:3000
environment:
- PUBSWEET_SECRET=${PUBSWEET_SECRET:-dev_secret}
- POSTGRES_USER=${POSTGRES_USER:-epub-checker_user_dev}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-secretpassword}
- POSTGRES_HOST=${POSTGRES_HOST:-localhost}
- POSTGRES_DB=${POSTGRES_DB:-epub-checker_dev_db}
- POSTGRES_PORT=${POSTGRES_PORT:-5432}
- SERVER_PORT=3000
- NODE_ENV=${NODE_ENV:-production}
- WAIT_SERVICE_PORT=${POSTGRES_HOST:-localhost}:${POSTGRES_PORT:-5432}
\ No newline at end of file
version: '2'
services:
server:
depends_on:
- db
build:
context: .
dockerfile: ./Dockerfile
restart: always
ports:
- ${SERVER_PORT:-3000}:3000
environment:
- PUBSWEET_SECRET=${PUBSWEET_SECRET:-dev_secret}
- POSTGRES_USER=${POSTGRES_USER:-service-xsweet_user_dev}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-secretpassword}
- POSTGRES_HOST=db
- POSTGRES_DB=${POSTGRES_DB:-service-xsweet_dev_db}
- POSTGRES_PORT=5432
- SERVER_PORT=3000
- NODE_ENV=${NODE_ENV:-development}
- WAIT_SERVICE_PORT=db:5432
db:
image: postgres:10-alpine
restart: always
ports:
- ${POSTGRES_PORT:-5432}:5432
environment:
- POSTGRES_USER
- POSTGRES_DB
- POSTGRES_PASSWORD
- POSTGRES_PORT
# volumes:
# - ./database/data:/var/lib/postgresql/data
{
"name": "@coko/service-xsweet",
"version": "1.0.0",
"description": "Service that converts docx files into HTML",
"main": "server/index.js",
"scripts": {
"cz": "git-cz",
"migrate": "pubsweet migrate",
"server": "pubsweet start:server",
"release": "standard-version",
"create:client": "createServiceClient",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://gitlab.coko.foundation/cokoapps/service-xsweet"
},
"keywords": [
"pubsweet",
"pubsweet-server",
"coko"
],
"author": "Alexandros Georgantas",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@coko/server": "^1.4.1",
"@coko/service-auth": "^1.1.1",
"@pubsweet/logger": "^0.2.46",
"config": "^3.3.2",
"fs-extra": "^9.0.1",
"multer": "^1.4.2",
"tmp-promise": "^2.0.0",
"winston": "2",
"winston-daily-rotate-file": "^3.2.1"
},
"devDependencies": {
"@coko/lint": "^0.0.2",
"standard-version": "^7.1.0"
},
"config": {
"commitizen": {
"path": "cz-customizable"
}
},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
}
}
#!/bin/sh
# Directory of script
DIRECTORY=$(cd `dirname $0` && pwd)
# Modified from https://gitlab.coko.foundation/XSweet/XSweet_runner_scripts/raw/master/execute_chain.sh
# For producing HTML5 outputs via XSweet XSLT from sources extracted from .docx (Office Open XML)
# is any short identifier
TEMP=$1
XSWEET=$(find ${DIRECTORY}/.. -maxdepth 1 -name "XSweet*" -print -quit)
# TYPESCRIPT=$(find ${DIRECTORY}/.. -maxdepth 1 -name 'editoria_typescript*' -print -quit)
# HTMLEVATOR=$(find ${DIRECTORY}/.. -maxdepth 1 -name 'HTMLevator*' -print -quit)
SAXONDIR=$(find ${DIRECTORY}/.. -maxdepth 1 -name 'saxon' -print -quit)
echo $XSWEET
# echo $TYPESCRIPT
# echo $HTMLEVATOR
# Note Saxon is included with this distribution, qv for license.
saxonHE="java -jar ${SAXONDIR}/saxon9he.jar" # SaxonHE (XSLT 3.0 processor)
# EXTRACTION
PIPELINE="${XSWEET}/applications/PIPELINE.xsl" # "Extraction" stylesheet
XMLTOHTML5="${XSWEET}/applications/html-polish/html5-serialize.xsl"
$saxonHE -xsl:$PIPELINE -s:$TEMP/word/document.xml -o:$TEMP/outputs/PIPELINED.xhtml
if [ $? -eq 0 ]
then
echo "Made PIPELINED.xhtml"
else
echo "There was an error converting the document." >&2
exit 1
fi
$saxonHE -xsl:$XMLTOHTML5 -s:$TEMP/outputs/PIPELINED.xhtml -o:$TEMP/outputs/HTML5.html
if [ $? -eq 0 ]
then
echo "Made HTML5.html"
exit 0
else
echo "There was an error converting the document." >&2
exit 1
fi
#!/bin/sh
set -x
# Directory of script
DIRECTORY=$(cd `dirname $0` && pwd)
TEMP=$1
XSWEET=$(find ${DIRECTORY}/.. -maxdepth 1 -name "XSweet*" -print -quit)
TYPESCRIPT=$(find ${DIRECTORY}/.. -maxdepth 1 -name 'editoria_typescript*' -print -quit)
HTMLEVATOR=$(find ${DIRECTORY}/.. -maxdepth 1 -name 'HTMLevator*' -print -quit)
SAXONDIR=$(find ${DIRECTORY}/.. -maxdepth 1 -name 'saxon' -print -quit)
echo $XSWEET
echo $TYPESCRIPT
echo $HTMLEVATOR
mv $XSWEET XSweet
mv $TYPESCRIPT XSweet/applications/typescript
mv $HTMLEVATOR XSweet/applications/htmlevator
#!/bin/sh
set -x
./scripts/wait-for-it.sh $WAIT_SERVICE_PORT -- ./node_modules/.bin/pubsweet migrate && ./node_modules/.bin/pubsweet start:server
\ No newline at end of file
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