Skip to content

Commit 229e1ac

Browse files
committed
Merge pull request #1725 from brecke/new-etherpad
2 parents 2adcc16 + 68d091b commit 229e1ac

473 files changed

Lines changed: 32033 additions & 37933 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/config.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: 2
22
jobs:
33
test:
44
docker:
5-
- image: 'alpine:3.8'
5+
- image: "alpine:3.8"
66
environment:
77
TMP: /root/tmp
88
working_directory: ~/Hilary
@@ -37,6 +37,7 @@ jobs:
3737
printf "\nconfig.search.hosts[0].host = 'oae-elasticsearch';" >> config.js
3838
printf "\nconfig.mq.connection.host = ['oae-rabbitmq'];" >> config.js
3939
printf "\nconfig.etherpad.hosts[0].host = 'oae-etherpad';" >> config.js
40+
printf "\nconfig.ethercalc.host = 'oae-ethercalc';" >> config.js
4041
printf "\nconfig.previews.enabled = true;" >> config.js
4142
printf "\nconfig.email.debug = false;" >> config.js
4243
printf "\nconfig.email.transport = 'sendmail';" >> config.js
@@ -45,17 +46,17 @@ jobs:
4546
- run:
4647
name: Install docker and docker-compose
4748
command: |
48-
apk add --update --no-cache docker py-pip
49-
pip install docker-compose
49+
apk add --update --no-cache docker py-pip python-dev libffi-dev openssl-dev gcc libc-dev make
50+
pip install docker-compose~=1.23.2
5051
- run:
5152
name: Create the containers
52-
command: docker-compose up --no-start --build oae-cassandra oae-redis oae-rabbitmq oae-elasticsearch oae-hilary
53+
command: docker-compose up --no-start --build oae-cassandra oae-redis oae-rabbitmq oae-elasticsearch oae-hilary oae-ethercalc
5354
- run:
5455
name: Start the containers we need
5556
command: |
5657
docker-compose up -d oae-cassandra oae-redis oae-rabbitmq oae-elasticsearch
5758
sleep 25s
58-
docker-compose up -d oae-etherpad
59+
docker-compose up -d oae-etherpad oae-ethercalc
5960
- run:
6061
name: Install Hilary dependencies
6162
command: |

3akai-ux

Submodule 3akai-ux updated 39 files

Dockerfile

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,41 @@
2626
# $ docker run -it --name=hilary --net=host oae-hilary:latest
2727
#
2828

29-
FROM oaeproject/oae-hilary-deps-docker:v0.4
29+
FROM node:10-alpine
3030

3131
LABEL Name=OAE-Hilary
3232
LABEL Author=ApereoFoundation
3333
LABEL Email=oae@apereo.org
3434

35+
RUN apk --update --no-cache add \
36+
git \
37+
python \
38+
ghostscript \
39+
graphicsmagick
40+
41+
# Installs the 3.8 Chromium package.
42+
RUN apk update && apk upgrade && \
43+
echo @3.8 http://nl.alpinelinux.org/alpine/v3.8/community >> /etc/apk/repositories && \
44+
echo @3.8 http://nl.alpinelinux.org/alpine/v3.8/main >> /etc/apk/repositories && \
45+
apk add --no-cache \
46+
chromium@3.8 \
47+
nss@3.8 \
48+
freetype@3.8 \
49+
harfbuzz@3.8 \
50+
ttf-freefont@3.8
51+
52+
# Tell Puppeteer to skip installing Chrome. We'll be using the installed package.
53+
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
54+
55+
# Install libreoffice
56+
RUN apk add --no-cache libreoffice openjdk8-jre
57+
58+
# install nodegit
59+
RUN apk --update --no-cache add build-base libgit2-dev
60+
RUN ln -s /usr/lib/libcurl.so.4 /usr/lib/libcurl-gnutls.so.4
61+
3562
# Set the base directory
36-
ENV HILARY_DIR usr/src/Hilary
63+
ENV HILARY_DIR /usr/src/Hilary
3764
RUN mkdir -p ${HILARY_DIR} \
3865
&& chown -R node:node ${HILARY_DIR} \
3966
&& chmod -R 755 ${HILARY_DIR}

app.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,29 @@
1515
* permissions and limitations under the License.
1616
*/
1717

18-
/* eslint-disable security/detect-non-literal-require */
1918
const path = require('path');
2019
const repl = require('repl');
2120
const PrettyStream = require('bunyan-prettystream');
2221
const optimist = require('optimist');
2322
const _ = require('underscore');
2423

24+
const OAE = require('oae-util/lib/oae');
25+
const { logger } = require('oae-logger');
26+
27+
const log = logger();
28+
2529
const { argv } = optimist
2630
.usage('$0 [--config <path/to/config.js>]')
2731
.alias('c', 'config')
2832
.describe('c', 'Specify an alternate config file')
2933
.default('c', path.join(__dirname, '/config.js'))
30-
3134
.alias('h', 'help')
3235
.describe('h', 'Show usage information')
33-
3436
.alias('i', 'interactive')
3537
.describe('i', 'Start an interactive shell, implies --pretty')
36-
3738
.alias('p', 'pretty')
3839
.describe('p', 'Pretty print the logs');
3940

40-
const OAE = require('oae-util/lib/oae');
41-
const log = require('oae-logger').logger();
42-
4341
if (argv.help) {
4442
optimist.showHelp();
4543
process.exit(0);
@@ -57,7 +55,6 @@ if (argv.config.match(/^\.\//)) {
5755

5856
const configPath = argv.config;
5957
let { config } = require(configPath);
60-
6158
const envConfigPath = `${process.cwd()}/${process.env.NODE_ENV || 'local'}`;
6259
const envConfig = require(envConfigPath).config;
6360
config = _.extend({}, config, envConfig);

config.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
/* eslint-disable camelcase, capitalized-comments */
1717
const Path = require('path');
1818
const bunyan = require('bunyan');
19+
1920
const config = {};
2021
const LOCALHOST = 'localhost';
2122
module.exports.config = config;
@@ -431,6 +432,20 @@ config.etherpad = {
431432
]
432433
};
433434

435+
/**
436+
* `config.ethercalc`
437+
*
438+
* Configuration namespace for the ethercalc logic.
439+
*
440+
* @param {String} host The hostname or IP address on which Hilary will be accessing the Ethercalc API.
441+
* @param {Number} port The port number on which Hilary will be accessing the ethercalc API.
442+
*/
443+
config.ethercalc = {
444+
host: LOCALHOST,
445+
port: 8000,
446+
protocol: 'http',
447+
timeout: 2500
448+
};
434449
/**
435450
* `config.tincanapi`
436451
*

docker-compose.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# docker-compose up
2121
#
2222

23-
version: '3'
23+
version: "3"
2424

2525
networks:
2626
my_network:
@@ -35,12 +35,12 @@ services:
3535
context: .
3636
dockerfile: Dockerfile
3737
container_name: oae-hilary
38-
# command: nodemon -L app.js | bunyan # default
39-
# command: grunt test-module:oae-principals # for running tests
38+
# command: nodemon -L app.js | npx bunyan # default
39+
# command: npm test # for running tests
4040
extra_hosts:
4141
- "admin.oae.com:172.20.0.9"
4242
# - "tenant1.oae.com:172.20.0.9"
43-
# - "any.other.host.oae.com:172.20.0.9"
43+
# - "any.other.host.oae.com:172.20.0.9"
4444
image: hilary:latest
4545
restart: always
4646
networks:
@@ -132,3 +132,12 @@ services:
132132
ports:
133133
- 9001:9001
134134
tty: false
135+
oae-ethercalc:
136+
container_name: oae-ethercalc
137+
image: oaeproject/oae-ethercalc-docker
138+
restart: always
139+
networks:
140+
- my_network
141+
ports:
142+
- 8000:8000
143+
tty: false

etc/migration/12.5-to-12.6/create-explicit-shib-config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const configKey = 'oae-authentication/shibboleth/externalIdAttributes';
7070
const currentDefault = 'eppn persistent-id targeted-id';
7171

7272
function _filterTenants(tenants, callback) {
73-
const AuthenticationConfig = ConfigAPI.config('oae-authentication');
73+
const AuthenticationConfig = ConfigAPI.setUpConfig('oae-authentication');
7474
const tenantsWithShibEnabled = [];
7575

7676
// We only want the tenancies with Shibboleth enabled...

etc/migration/disable_users_from_tenancy/lib/disable-users-by-tenancy.js

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,36 @@
11
/*!
2-
* Copyright 2017 Apereo Foundation (AF) Licensed under the
3-
* Educational Community License, Version 2.0 (the "License"); you may
4-
* not use this file except in compliance with the License. You may
5-
* obtain a copy of the License at
6-
*
7-
* http://opensource.org/licenses/ECL-2.0
8-
*
9-
* Unless required by applicable law or agreed to in writing,
10-
* software distributed under the License is distributed on an "AS IS"
11-
* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12-
* or implied. See the License for the specific language governing
13-
* permissions and limitations under the License.
14-
*/
2+
* Copyright 2017 Apereo Foundation (AF) Licensed under the
3+
* Educational Community License, Version 2.0 (the "License"); you may
4+
* not use this file except in compliance with the License. You may
5+
* obtain a copy of the License at
6+
*
7+
* http://opensource.org/licenses/ECL-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing,
10+
* software distributed under the License is distributed on an "AS IS"
11+
* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12+
* or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
1515

1616
/*
17-
* Disable users belonging to a disabled tenancy
18-
* Github issue #1304
19-
*/
17+
* Disable users belonging to a disabled tenancy
18+
* Github issue #1304
19+
*/
2020
/* eslint-disable */
21-
const path = require('path');
22-
const util = require('util');
21+
import PrincipalsAPI from 'oae-principals';
22+
23+
import path from 'path';
24+
import util from 'util';
25+
import {logger} from 'oae-logger'
26+
27+
import { User } from 'oae-principals/lib/model';
28+
import { AuthzConstants } from 'oae-authz/lib/constants';
29+
import { Context } from 'oae-context';
2330

24-
const { AuthzConstants } = require('oae-authz/lib/constants');
25-
const { Context } = require('oae-context');
26-
const log = require('oae-logger').logger('oae-script-main');
27-
const PrincipalsAPI = require('oae-principals');
28-
const TenantsAPI = require('oae-tenants');
29-
const { User } = require('oae-principals/lib/model');
31+
import * as TenantsAPI from 'oae-tenants';
3032

33+
const log = logger('oae-script-main');
3134
/**
3235
* Disable users from the system by updating the deleted flag
3336
*
@@ -69,6 +72,6 @@ const doMigration = function(ctx, tenantAlias, disabled, callback) {
6972
}
7073
};
7174

72-
module.exports = {
75+
export {
7376
doMigration
7477
};
Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,25 @@
1313
* permissions and limitations under the License.
1414
*/
1515

16+
import { config } from '../../config';
17+
1618
const fs = require('fs');
1719
const path = require('path');
1820
const { promisify } = require('util');
19-
const async = require('async');
21+
const PrettyStream = require('bunyan-prettystream');
22+
const { eachSeries } = require('async');
23+
24+
const LogAPI = require('oae-logger');
25+
26+
const _createLogger = function(config) {
27+
const prettyLog = new PrettyStream();
28+
prettyLog.pipe(process.stdout);
29+
config.log.streams[0].stream = prettyLog;
30+
LogAPI.refreshLogConfiguration(config.log);
31+
return LogAPI.logger();
32+
};
2033

21-
const log = require('oae-logger').logger();
34+
const log = _createLogger(config);
2235

2336
const readFolderContents = promisify(fs.readdir);
2437
const checkIfExists = promisify(fs.stat);
@@ -40,15 +53,17 @@ const lookForMigrations = async function(allModules) {
4053
if (migrateFileExists.isFile()) {
4154
migrationsToRun.push({ name: eachModule, file: migrationFilePath });
4255
}
43-
} catch (e) {
56+
} catch (error) {
4457
log().warn('Skipping ' + eachModule);
4558
}
4659
}
4760
}
61+
4862
return migrationsToRun;
4963
};
5064

5165
const runMigrations = async function(dbConfig, callback) {
66+
log().info('Running migrations for keyspace ' + dbConfig.keyspace + '...');
5267
const data = {};
5368

5469
try {
@@ -62,7 +77,7 @@ const runMigrations = async function(dbConfig, callback) {
6277
})
6378
.then(() => {
6479
require(path.join(PACKAGES_FOLDER, 'oae-util', LIB_FOLDER, 'cassandra.js')).init(dbConfig, () => {
65-
async.eachSeries(
80+
eachSeries(
6681
data.allMigrationsToRun,
6782
(eachMigration, done) => {
6883
log().info(`Updating schema for ${eachMigration.name}`);
@@ -73,15 +88,16 @@ const runMigrations = async function(dbConfig, callback) {
7388
log().error({ err }, 'Error running migration.');
7489
callback(err);
7590
}
91+
7692
log().info('Migrations complete');
7793
callback();
7894
}
7995
);
8096
});
8197
});
82-
} catch (e) {
83-
log().error({ err: e }, 'Error running migration.');
84-
callback(e);
98+
} catch (error) {
99+
log().error({ err: error }, 'Error running migration.');
100+
callback(error);
85101
}
86102
};
87103

index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// eslint-disable-next-line no-global-assign
2+
require = require('esm')(module /* , options */);
3+
// Import the rest of our application.
4+
module.exports = require('./app.js');

0 commit comments

Comments
 (0)