Merge pull request #158 from overleaf/jpa-entry-point-cleanup

[misc] entry point cleanup
This commit is contained in:
Henry Oswald 2020-04-23 13:52:04 +01:00 committed by GitHub
commit a5887fad50
7 changed files with 33 additions and 28 deletions

View file

@ -5,3 +5,6 @@ gitrev
.npm
.nvmrc
nodemon.json
cache/
compiles/
db/

View file

@ -24,5 +24,7 @@ COPY . /app
FROM base
COPY --from=app /app /app
RUN mkdir -p cache compiles db \
&& chown node:node cache compiles db
CMD ["node", "--expose-gc", "app.js"]

View file

@ -1,5 +1,6 @@
clsi
--acceptance-creds=None
--data-dirs=cache,compiles,db
--dependencies=
--docker-repos=gcr.io/overleaf-ops
--env-add=

View file

@ -9,7 +9,7 @@ module.exports = {
username: 'clsi',
dialect: 'sqlite',
storage:
process.env.SQLITE_PATH || Path.resolve(__dirname + '/../db.sqlite'),
process.env.SQLITE_PATH || Path.resolve(__dirname + '/../db/db.sqlite'),
pool: {
max: 1,
min: 1

2
services/clsi/db/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*
!.gitignore

View file

@ -1,26 +1,18 @@
#!/bin/sh
echo "Changing permissions of /var/run/docker.sock for sibling containers"
ls -al /var/run/docker.sock
docker --version
cat /etc/passwd
docker --version >&2
# add the node user to the docker group on the host
DOCKER_GROUP=$(stat -c '%g' /var/run/docker.sock)
groupadd --non-unique --gid ${DOCKER_GROUP} dockeronhost
usermod -aG dockeronhost node
mkdir -p /app/cache
chown -R node:node /app/cache
mkdir -p /app/compiles
chown -R node:node /app/compiles
chown -R node:node /app/bin/synctex
mkdir -p /app/test/acceptance/fixtures/tmp/
chown -R node:node /app
chown -R node:node /app/bin
# compatibility: initial volume setup
chown node:node /app/cache
chown node:node /app/compiles
chown node:node /app/db
# make synctex available for remount in compiles
cp /app/bin/synctex /app/bin/synctex-mount/synctex
exec runuser -u node -- "$@"

View file

@ -19,11 +19,17 @@ const Client = require('./helpers/Client')
const request = require('request')
require('chai').should()
const fs = require('fs')
const fsExtra = require('fs-extra')
const ChildProcess = require('child_process')
const ClsiApp = require('./helpers/ClsiApp')
const logger = require('logger-sharelatex')
const Path = require('path')
const fixturePath = path => Path.normalize(__dirname + '/../fixtures/' + path)
const fixturePath = path => {
if (path.slice(0, 3) === 'tmp') {
return '/tmp/clsi_acceptance_tests' + path.slice(3)
}
return Path.normalize(__dirname + '/../fixtures/' + path)
}
const process = require('process')
console.log(
process.pid,
@ -32,13 +38,6 @@ console.log(
process.getgroups(),
'PID'
)
try {
console.log('creating tmp directory', fixturePath('tmp'))
fs.mkdirSync(fixturePath('tmp'))
} catch (error) {
const err = error
console.log(err, fixturePath('tmp'), 'unable to create fixture tmp path')
}
const MOCHA_LATEX_TIMEOUT = 60 * 1000
@ -201,10 +200,16 @@ Client.runServer(4242, fixturePath('examples'))
describe('Example Documents', function() {
before(function(done) {
return ChildProcess.exec('rm test/acceptance/fixtures/tmp/*').on(
'exit',
() => ClsiApp.ensureRunning(done)
)
ClsiApp.ensureRunning(done)
})
before(function(done) {
fsExtra.remove(fixturePath('tmp'), done)
})
before(function(done) {
fs.mkdir(fixturePath('tmp'), done)
})
after(function(done) {
fsExtra.remove(fixturePath('tmp'), done)
})
return Array.from(fs.readdirSync(fixturePath('examples'))).map(example_dir =>