Skip to content

Commit

Permalink
Merge pull request #1725 from brecke/new-etherpad
Browse files Browse the repository at this point in the history
  • Loading branch information
brecke committed Apr 23, 2019
2 parents 2adcc16 + 68d091b commit 229e1ac
Show file tree
Hide file tree
Showing 473 changed files with 32,033 additions and 37,933 deletions.
11 changes: 6 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2
jobs:
test:
docker:
- image: 'alpine:3.8'
- image: "alpine:3.8"
environment:
TMP: /root/tmp
working_directory: ~/Hilary
Expand Down Expand Up @@ -37,6 +37,7 @@ jobs:
printf "\nconfig.search.hosts[0].host = 'oae-elasticsearch';" >> config.js
printf "\nconfig.mq.connection.host = ['oae-rabbitmq'];" >> config.js
printf "\nconfig.etherpad.hosts[0].host = 'oae-etherpad';" >> config.js
printf "\nconfig.ethercalc.host = 'oae-ethercalc';" >> config.js
printf "\nconfig.previews.enabled = true;" >> config.js
printf "\nconfig.email.debug = false;" >> config.js
printf "\nconfig.email.transport = 'sendmail';" >> config.js
Expand All @@ -45,17 +46,17 @@ jobs:
- run:
name: Install docker and docker-compose
command: |
apk add --update --no-cache docker py-pip
pip install docker-compose
apk add --update --no-cache docker py-pip python-dev libffi-dev openssl-dev gcc libc-dev make
pip install docker-compose~=1.23.2
- run:
name: Create the containers
command: docker-compose up --no-start --build oae-cassandra oae-redis oae-rabbitmq oae-elasticsearch oae-hilary
command: docker-compose up --no-start --build oae-cassandra oae-redis oae-rabbitmq oae-elasticsearch oae-hilary oae-ethercalc
- run:
name: Start the containers we need
command: |
docker-compose up -d oae-cassandra oae-redis oae-rabbitmq oae-elasticsearch
sleep 25s
docker-compose up -d oae-etherpad
docker-compose up -d oae-etherpad oae-ethercalc
- run:
name: Install Hilary dependencies
command: |
Expand Down
2 changes: 1 addition & 1 deletion 3akai-ux
Submodule 3akai-ux updated 39 files
+1 −1 .gitignore
+17 −17 package-lock.json
+9 −1 packages/oae-core/addtofolder/addtofolder.html
+2 −0 packages/oae-core/addtofolder/bundles/default.properties
+5 −0 packages/oae-core/createcollabsheet/bundles/default.properties
+44 −0 packages/oae-core/createcollabsheet/createcollabsheet.html
+22 −0 packages/oae-core/createcollabsheet/css/createcollabsheet.css
+209 −0 packages/oae-core/createcollabsheet/js/createcollabsheet.js
+11 −0 packages/oae-core/createcollabsheet/manifest.json
+2 −0 packages/oae-core/deletefolder/deletefolder.html
+14 −0 packages/oae-core/deleteresource/deleteresource.html
+13 −1 packages/oae-core/deleteresources/deleteresources.html
+2 −0 packages/oae-core/editcontent/bundles/default.properties
+2 −0 packages/oae-core/ethercalc/bundles/default.properties
+83 −0 packages/oae-core/ethercalc/css/ethercalc.css
+26 −0 packages/oae-core/ethercalc/ethercalc.html
+87 −0 packages/oae-core/ethercalc/js/ethercalc.js
+6 −0 packages/oae-core/ethercalc/manifest.json
+1 −0 packages/oae-core/foldercontentvisibility/bundles/default.properties
+3 −1 packages/oae-core/foldercontentvisibility/foldercontentvisibility.html
+24 −0 packages/oae-core/setpermissions/bundles/default.properties
+2 −2 packages/oae-core/setpermissions/js/setpermissions.js
+48 −0 packages/oae-core/setpermissions/setpermissions.html
+7 −0 packages/oae-core/share/bundles/default.properties
+18 −0 packages/oae-core/share/share.html
+665 −578 shared/oae/api/oae.api.content.js
+50 −1 shared/oae/bundles/ui/default.properties
+5 −0 shared/oae/css/oae.components.css
+443 −333 shared/oae/js/activityadapter.js
+4 −0 shared/oae/js/mimetypes.js
+9 −1 shared/oae/macros/list.html
+1 −1 ui/content.html
+1 −0 ui/folder.html
+1 −0 ui/group.html
+1 −0 ui/index.html
+14 −2 ui/js/content.js
+6 −0 ui/js/folder.js
+29 −42 ui/js/group.js
+6 −0 ui/js/index.js
31 changes: 29 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,41 @@
# $ docker run -it --name=hilary --net=host oae-hilary:latest
#

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

LABEL Name=OAE-Hilary
LABEL Author=ApereoFoundation
LABEL Email=oae@apereo.org

RUN apk --update --no-cache add \
git \
python \
ghostscript \
graphicsmagick

# Installs the 3.8 Chromium package.
RUN apk update && apk upgrade && \
echo @3.8 http://nl.alpinelinux.org/alpine/v3.8/community >> /etc/apk/repositories && \
echo @3.8 http://nl.alpinelinux.org/alpine/v3.8/main >> /etc/apk/repositories && \
apk add --no-cache \
chromium@3.8 \
nss@3.8 \
freetype@3.8 \
harfbuzz@3.8 \
ttf-freefont@3.8

# Tell Puppeteer to skip installing Chrome. We'll be using the installed package.
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true

# Install libreoffice
RUN apk add --no-cache libreoffice openjdk8-jre

# install nodegit
RUN apk --update --no-cache add build-base libgit2-dev
RUN ln -s /usr/lib/libcurl.so.4 /usr/lib/libcurl-gnutls.so.4

# Set the base directory
ENV HILARY_DIR usr/src/Hilary
ENV HILARY_DIR /usr/src/Hilary
RUN mkdir -p ${HILARY_DIR} \
&& chown -R node:node ${HILARY_DIR} \
&& chmod -R 755 ${HILARY_DIR}
Expand Down
13 changes: 5 additions & 8 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,29 @@
* permissions and limitations under the License.
*/

/* eslint-disable security/detect-non-literal-require */
const path = require('path');
const repl = require('repl');
const PrettyStream = require('bunyan-prettystream');
const optimist = require('optimist');
const _ = require('underscore');

const OAE = require('oae-util/lib/oae');
const { logger } = require('oae-logger');

const log = logger();

const { argv } = optimist
.usage('$0 [--config <path/to/config.js>]')
.alias('c', 'config')
.describe('c', 'Specify an alternate config file')
.default('c', path.join(__dirname, '/config.js'))

.alias('h', 'help')
.describe('h', 'Show usage information')

.alias('i', 'interactive')
.describe('i', 'Start an interactive shell, implies --pretty')

.alias('p', 'pretty')
.describe('p', 'Pretty print the logs');

const OAE = require('oae-util/lib/oae');
const log = require('oae-logger').logger();

if (argv.help) {
optimist.showHelp();
process.exit(0);
Expand All @@ -57,7 +55,6 @@ if (argv.config.match(/^\.\//)) {

const configPath = argv.config;
let { config } = require(configPath);

const envConfigPath = `${process.cwd()}/${process.env.NODE_ENV || 'local'}`;
const envConfig = require(envConfigPath).config;
config = _.extend({}, config, envConfig);
Expand Down
15 changes: 15 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
/* eslint-disable camelcase, capitalized-comments */
const Path = require('path');
const bunyan = require('bunyan');

const config = {};
const LOCALHOST = 'localhost';
module.exports.config = config;
Expand Down Expand Up @@ -431,6 +432,20 @@ config.etherpad = {
]
};

/**
* `config.ethercalc`
*
* Configuration namespace for the ethercalc logic.
*
* @param {String} host The hostname or IP address on which Hilary will be accessing the Ethercalc API.
* @param {Number} port The port number on which Hilary will be accessing the ethercalc API.
*/
config.ethercalc = {
host: LOCALHOST,
port: 8000,
protocol: 'http',
timeout: 2500
};
/**
* `config.tincanapi`
*
Expand Down
17 changes: 13 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# docker-compose up
#

version: '3'
version: "3"

networks:
my_network:
Expand All @@ -35,12 +35,12 @@ services:
context: .
dockerfile: Dockerfile
container_name: oae-hilary
# command: nodemon -L app.js | bunyan # default
# command: grunt test-module:oae-principals # for running tests
# command: nodemon -L app.js | npx bunyan # default
# command: npm test # for running tests
extra_hosts:
- "admin.oae.com:172.20.0.9"
# - "tenant1.oae.com:172.20.0.9"
# - "any.other.host.oae.com:172.20.0.9"
# - "any.other.host.oae.com:172.20.0.9"
image: hilary:latest
restart: always
networks:
Expand Down Expand Up @@ -132,3 +132,12 @@ services:
ports:
- 9001:9001
tty: false
oae-ethercalc:
container_name: oae-ethercalc
image: oaeproject/oae-ethercalc-docker
restart: always
networks:
- my_network
ports:
- 8000:8000
tty: false
2 changes: 1 addition & 1 deletion etc/migration/12.5-to-12.6/create-explicit-shib-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const configKey = 'oae-authentication/shibboleth/externalIdAttributes';
const currentDefault = 'eppn persistent-id targeted-id';

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

// We only want the tenancies with Shibboleth enabled...
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
/*!
* Copyright 2017 Apereo Foundation (AF) Licensed under the
* Educational Community License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may
* obtain a copy of the License at
*
* http://opensource.org/licenses/ECL-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an "AS IS"
* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
* Copyright 2017 Apereo Foundation (AF) Licensed under the
* Educational Community License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may
* obtain a copy of the License at
*
* http://opensource.org/licenses/ECL-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an "AS IS"
* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

/*
* Disable users belonging to a disabled tenancy
* Github issue #1304
*/
* Disable users belonging to a disabled tenancy
* Github issue #1304
*/
/* eslint-disable */
const path = require('path');
const util = require('util');
import PrincipalsAPI from 'oae-principals';

import path from 'path';
import util from 'util';
import {logger} from 'oae-logger'

import { User } from 'oae-principals/lib/model';
import { AuthzConstants } from 'oae-authz/lib/constants';
import { Context } from 'oae-context';

const { AuthzConstants } = require('oae-authz/lib/constants');
const { Context } = require('oae-context');
const log = require('oae-logger').logger('oae-script-main');
const PrincipalsAPI = require('oae-principals');
const TenantsAPI = require('oae-tenants');
const { User } = require('oae-principals/lib/model');
import * as TenantsAPI from 'oae-tenants';

const log = logger('oae-script-main');
/**
* Disable users from the system by updating the deleted flag
*
Expand Down Expand Up @@ -69,6 +72,6 @@ const doMigration = function(ctx, tenantAlias, disabled, callback) {
}
};

module.exports = {
export {
doMigration
};
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,25 @@
* permissions and limitations under the License.
*/

import { config } from '../../config';

const fs = require('fs');
const path = require('path');
const { promisify } = require('util');
const async = require('async');
const PrettyStream = require('bunyan-prettystream');
const { eachSeries } = require('async');

const LogAPI = require('oae-logger');

const _createLogger = function(config) {
const prettyLog = new PrettyStream();
prettyLog.pipe(process.stdout);
config.log.streams[0].stream = prettyLog;
LogAPI.refreshLogConfiguration(config.log);
return LogAPI.logger();
};

const log = require('oae-logger').logger();
const log = _createLogger(config);

const readFolderContents = promisify(fs.readdir);
const checkIfExists = promisify(fs.stat);
Expand All @@ -40,15 +53,17 @@ const lookForMigrations = async function(allModules) {
if (migrateFileExists.isFile()) {
migrationsToRun.push({ name: eachModule, file: migrationFilePath });
}
} catch (e) {
} catch (error) {
log().warn('Skipping ' + eachModule);
}
}
}

return migrationsToRun;
};

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

try {
Expand All @@ -62,7 +77,7 @@ const runMigrations = async function(dbConfig, callback) {
})
.then(() => {
require(path.join(PACKAGES_FOLDER, 'oae-util', LIB_FOLDER, 'cassandra.js')).init(dbConfig, () => {
async.eachSeries(
eachSeries(
data.allMigrationsToRun,
(eachMigration, done) => {
log().info(`Updating schema for ${eachMigration.name}`);
Expand All @@ -73,15 +88,16 @@ const runMigrations = async function(dbConfig, callback) {
log().error({ err }, 'Error running migration.');
callback(err);
}

log().info('Migrations complete');
callback();
}
);
});
});
} catch (e) {
log().error({ err: e }, 'Error running migration.');
callback(e);
} catch (error) {
log().error({ err: error }, 'Error running migration.');
callback(error);
}
};

Expand Down
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// eslint-disable-next-line no-global-assign
require = require('esm')(module /* , options */);
// Import the rest of our application.
module.exports = require('./app.js');
12 changes: 4 additions & 8 deletions migrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@
* permissions and limitations under the License.
*/

const path = require('path');
const optimist = require('optimist');

const log = require('oae-logger').logger();
const { runMigrations } = require('./etc/migration/migration-runner');
const { config } = require('./config');

const config = require(path.join(__dirname, 'config.js'));
const dbConfig = config.config.cassandra;
const migrationRunner = require(path.join(__dirname, 'etc/migration/migration_runner.js'));
const dbConfig = config.cassandra;

const { argv } = optimist
.usage('$0 [--keyspace <keyspace>]')
Expand All @@ -37,9 +35,7 @@ if (argv.help) {
dbConfig.keyspace = argv.keyspace === true ? dbConfig.keyspace : argv.keyspace;

const execute = function() {
log().info('Running migrations for keyspace ' + dbConfig.keyspace + '...');
migrationRunner.runMigrations(dbConfig, () => {
log().info('All done.');
runMigrations(dbConfig, () => {
process.exit(0);
});
};
Expand Down
Loading

0 comments on commit 229e1ac

Please sign in to comment.