Commit 728a606a authored by Nikos Marinos's avatar Nikos Marinos

ftp improvements, production container to 80.

parent b5bf8bbc
......@@ -60,6 +60,6 @@ ENV NODE_ENV ${NODE_ENV}
RUN [ "npx", "pubsweet", "build"]
EXPOSE ${PORT:-3000}
EXPOSE ${PORT:-80}
CMD []
# populate journals table from NCBI service
0 8 * * 0 node server/populate-journal/api.js
# Pdf converter polling
*/5 * * * * node server/pdfConversion/api
# toNcbi
*/5 * * * * node server/ncbi-integration/toNcbi
# fromNcbi
*/5 * * * * node server/ncbi-integration/fromNcbi
# always leave an empty line at the end of the file
......@@ -5,10 +5,10 @@ services:
volumes: # remember to replace /folder_on_disk/ with the path to where you want to store the files on the host machine
- "ftpdata:/home/xpub/ftpdata/"
ports:
- "3000:3000"
- "80:80"
environment:
NODE_ENV: production
PORT: "3000"
PORT: "80"
env_file:
- .env.prod
......
......@@ -3,11 +3,11 @@
echo "Running cron service"
service cron start
echo "Running ftp monitor"
echo "Running ftp bulk upload monitor"
./runShellScript.sh "node server/ftp-integration/api" &
echo "Running pdf converter"
./runShellScript.sh "node server/pdfConversion/api" &
echo "Running ftp taggers upload monitor"
./runShellScript.sh "node server/ftp-integration/taggedXML" &
echo "Running Seed"
yarn seed
......
*/1 * * * * node server/ncbi-integration/test.js
......@@ -9,7 +9,7 @@ module.exports.getFTPUser = function getFTPUser(rootPath, filename) {
// const userName = path.basename(path.dirname(filename))
const rootParts = rootPath.split('/')
const fileNameParts = filename.split('/')
const userName = fileNameParts[rootParts.length - 1]
const userName = fileNameParts[rootParts.length - 2]
Identity.findByFieldEager(
'email',
......
......@@ -6,11 +6,17 @@ const tar = require('./functions/unTar.js')
const files = require('./functions/files.js')
const db = require('./functions/db.js')
const rootPath = `${process.env.HOME}/${config.get('ftp_directory')}/`
const ftpTagger = config.get('ftp_tagger')
const rootPath = `${process.env.HOME}/${config.get('ftp_directory')}/${
ftpTagger.username
}/Done`
const ignoreNewFolder = `${rootPath}/New`
// chokidar monitors tagged folder
const watcher = chokidar.watch(`${rootPath}**/*.tar.gz`, {
persistent: true,
ignored: ignoreNewFolder,
awaitWriteFinish: {
stabilityThreshold: 2000,
pollInterval: 100,
......
......@@ -13,11 +13,13 @@ const Manuscript = require('../xpub-model/entities/manuscript/data-access')
const pubsweetServer = config.get('pubsweet-server.baseUrl')
const pdfTransformerApi = config.get('ncbiPdfTransformerApi')
runMonitor()
// deposit()
getDeposits()
// runMonitor()
/*
async function runMonitor() {
/* eslint-disable no-await-in-loop */
/!* eslint-disable no-await-in-loop *!/
while (true) {
getDeposits()
await sleep(pdfTransformerApi.freq)
......@@ -29,6 +31,7 @@ function sleep(ms) {
setTimeout(resolve, ms)
})
}
*/
async function getDeposits() {
logger.info('Polling for PDF conversion jobs...')
......
......@@ -9,7 +9,7 @@ echo "Wait up to 3 minutes for server to respond, check every 20 seconds"
COUNTER=0
while [ $COUNTER -lt 15 ]; do
RUNNING=$(curl --silent --connect-timeout 20 "http://localhost:3000/" | grep "/assets/")
RUNNING=$(curl --silent --connect-timeout 20 "http://localhost/" | grep "/assets/")
if [ -n "$RUNNING" ] ; then
echo "xPub is running"
#echo "Creating the Users"
......
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