Commit 54ebed96 authored by Tamlyn Rhodes's avatar Tamlyn Rhodes
Browse files

Initial commit 馃挜

parents
{
"presets": ["env", "react", "stage-2"]
}
\ No newline at end of file
node_modules
#https://github.com/direnv/direnv/wiki/Node#load-nodejs-version-from-a-node-version-or-nvmrc-file
set -e
use node 8
_build
node_modules
{
"env": {
"es6": true,
"browser": true
},
"extends": [
"pubsweet"
],
"parser": "babel-eslint",
"rules": {
"camelcase": 0,
"consistent-return": 0,
"global-require": 0,
"jsx-a11y/anchor-is-valid": 0,
"jsx-a11y/click-events-have-key-events": 0,
"jsx-a11y/label-has-for": 0,
"jsx-a11y/no-static-element-interactions": 0,
"import/extensions": 0,
"import/no-dynamic-require": 0,
"import/no-extraneous-dependencies": 0,
"import/no-named-as-default": 0,
"import/no-named-as-default-member": 0,
"import/prefer-default-export": 0,
"no-console": ["error", { "allow": ["warn", "error"] }],
"no-param-reassign": 0,
"no-shadow": 0,
"no-underscore-dangle": 0,
"react/no-did-mount-set-state": 0,
"react/prop-types": 0,
"sort-keys": 0
}
}
*.log
.bash_history
.env
.env.*
.cache
dist/
node_modules
coverage/
api/db/*
logs/*
log.txt
config.json
_build/
uploads/
config/local*.*
variables:
IMAGE_ORG: xpub
IMAGE_NAME: xpub
BASE_DOMAIN: gateway.xpub.semioticsquares.com
CONFIGURATION_REPOSITORY: https://gitlab.coko.foundation/yld/xpub-deployment-config-postgres.git
stages:
- build
- test
- review
- staging
- production
- demo
build:
image: docker:latest
stage: build
script:
- docker version
- docker build -t $IMAGE_ORG/$IMAGE_NAME:$CI_COMMIT_SHA .
- if [ -z "$DOCKERHUB_USERNAME" ] || [ -z "$DOCKERHUB_PASSWORD" ]; then echo "Not pushing" && exit 0; fi
- docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
- echo "Ignore warning! Cannot perform an interactive login from a non TTY device"
- docker push $IMAGE_ORG/$IMAGE_NAME:$CI_COMMIT_SHA
lint:
image: $IMAGE_ORG/$IMAGE_NAME:$CI_COMMIT_SHA
stage: test
variables:
GIT_STRATEGY: none
script:
- cd ${HOME}
- npm run lint
# disable this job to make it clear we're not running any tests
.test:
image: $IMAGE_ORG/$IMAGE_NAME:$CI_COMMIT_SHA
stage: test
variables:
GIT_STRATEGY: none
# setup data for postgres image
POSTGRES_USER: test
POSTGRES_PASSWORD: pw
# connection details for tests
PGUSER: test
PGPASSWORD: pw
NODE_ENV: test
services:
- postgres
script:
- cd ${HOME}
# specify host here else it confuses the linked postgres image
- PGHOST=postgres npm run test
push:latest:
image: docker:latest
stage: staging
script:
- if [ -z "$DOCKERHUB_USERNAME" ] || [ -z "$DOCKERHUB_PASSWORD" ]; then echo "Not pushing" && exit 0; fi
- docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
- echo "Ignore warning! Cannot perform an interactive login from a non TTY device"
- docker build -t $IMAGE_ORG/$IMAGE_NAME:latest --label COMMIT_SHA=$CI_COMMIT_SHA .
- docker push $IMAGE_ORG/$IMAGE_NAME:latest
only:
- master
review:xpub-collabra:
image: pubsweet/deployer:latest
stage: review
variables:
PACKAGE_NAME: xpub-collabra
FORCE_FRESH_DB: "yes"
REQUIRES_PROVISIONING: "yes"
environment:
name: $PACKAGE_NAME/review/$CI_COMMIT_REF_NAME
# !! kube-lego will fail if domain > 64 chars
url: "http://${CI_ENVIRONMENT_SLUG}.${BASE_DOMAIN}"
on_stop: stop_review:xpub-collabra
except:
- master
script:
- source deploy.sh
- create_deployment
stop_review:xpub-collabra:
image: pubsweet/deployer:latest
stage: review
variables:
PACKAGE_NAME: xpub-collabra
REQUIRES_PROVISIONING: "yes"
GIT_STRATEGY: none
environment:
name: $PACKAGE_NAME/review/$CI_COMMIT_REF_NAME
action: stop
when: manual
except:
- master
script:
- source deploy.sh
- delete_deployment
- delete_objects_in_environment pvc
staging:xpub-collabra:
image: pubsweet/deployer:latest
stage: staging
variables:
PACKAGE_NAME: xpub-collabra
environment:
name: $PACKAGE_NAME/staging
url: "https://${CI_ENVIRONMENT_SLUG}.${BASE_DOMAIN}"
only:
- master
script:
- source deploy.sh
- create_deployment
production:xpub-collabra:
image: pubsweet/deployer:latest
stage: production
variables:
PACKAGE_NAME: xpub-collabra
environment:
name: $PACKAGE_NAME/production
url: "https://${CI_ENVIRONMENT_SLUG}.${BASE_DOMAIN}"
when: manual
only:
- master
script:
- source deploy.sh
- create_deployment
demo:xpub-collabra:
image: pubsweet/deployer:latest
stage: demo
variables:
PACKAGE_NAME: xpub-collabra
environment:
name: $PACKAGE_NAME/demo
url: "https://${CI_ENVIRONMENT_SLUG}.${BASE_DOMAIN}"
when: manual
script:
- source deploy.sh
- create_deployment
{
"semi": false,
"singleQuote": true,
"trailingComma": "all"
}
**/_build
**/node_modules
{
"extends": "stylelint-config-pubsweet"
}
FROM xpub/xpub:base
WORKDIR ${HOME}
COPY package.json yarn.lock ./
# We do a development install because react-styleguidist is a dev dependency
RUN [ "yarn", "install", "--frozen-lockfile" ]
# Remove cache and offline mirror
RUN [ "yarn", "cache", "clean"]
RUN [ "rm", "-rf", "/npm-packages-offline-cache"]
COPY app.js .babelrc .eslintignore .eslintrc .prettierrc .stylelintignore .stylelintrc ./
COPY static static
COPY api api
COPY webpack webpack
COPY config config
COPY app app
ENV NODE_ENV "production"
RUN [ "npx", "pubsweet", "build"]
EXPOSE 3000
CMD []
FROM xpub/xpub:base
WORKDIR ${HOME}
COPY package.json yarn.lock app.js .babelrc .eslintignore .eslintrc .prettierrc .stylelintignore .stylelintrc ./
COPY static static
COPY api api
COPY webpack webpack
COPY config config
COPY app app
EXPOSE 3000
CMD []
Copyright (c) 2017 Adam Hyde
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# xpub-elife
## Quickstart
```
npm start # or docker-compose up
```
**Note**: yarn will be run automatically inside the container to install dependencies. If dependencies were already installed on the host, this may cause problems as the binaries are compiled for the wrong platform. If you encounter errors about "invalid ELF header", do `npm run clean` and then `npm start` again.
See `pubsweet-cli` for detailed documentation on running the app
## Installing
In the root directory, run `yarn` to install all the dependencies.
## Configuration
To enable manuscript conversion via INK, add the following values to `config/local-development.json` (ask in [the xpub channel](https://mattermost.coko.foundation/coko/channels/xpub) if you need an account):
```json
{
"pubsweet-server": {
"secret": "__EDIT_THIS__"
},
"pubsweet-component-ink-backend": {
"inkEndpoint": "__EDIT_THIS__",
"email": "__EDIT_THIS__",
"password": "__EDIT_THIS__"
}
}
```
## Running the app
1. The first time you run the app, initialise the database with `yarn run setupdb` (press Enter when asked for a collection title, to skip that step).
2. `yarn start`
## CI
CI requires a Kubernetes cluster, resources for which can be found in [`pubsweet/infra`](https://gitlab.coko.foundation/pubsweet/infra). In order to set up a Kubernetes cluster (using AWS) you need to follow the instructions there. Templates for deploying to this cluster with [`pubsweet/deployer`](https://gitlab.coko.foundation/pubsweet/deployer) are located in [`xpub/deployment-config`](https://gitlab.coko.foundation/xpub/deployment-config).
## Community
Join [the Mattermost channel](https://mattermost.coko.foundation/coko/channels/xpub) for discussion of xpub.
const logger = require('@pubsweet/logger')
const startServer = require('pubsweet-server')
startServer().catch(err => {
logger.error('FATAL ERROR, SHUTTING DOWN:', err)
process.exit(1)
})
import React from 'react'
import ReactDOM from 'react-dom'
import { AppContainer } from 'react-hot-loader'
import createHistory from 'history/createBrowserHistory'
import { configureStore, Root } from 'pubsweet-client'
import theme from '@pubsweet/default-theme'
import Routes from './routes'
const history = createHistory()
const store = configureStore(history, {})
const render = () => {
ReactDOM.render(
<AppContainer>
<Root history={history} routes={<Routes />} store={store} theme={theme} />
</AppContainer>,
document.getElementById('root'),
)
}
render()
if (module.hot) {
module.hot.accept('./routes', () => {
render()
})
}
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<div id="root"></div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<div id="root"></div>
<script src="/assets/app.js"></script>
</body>
</html>
import React from 'react'
const Routes = () => <div>TODO</div>
export default Routes
module.exports = (user, operation, project, version) =>
// console.log({ user, operation, project, version })
true // TODO
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