These instructions on based on the more complicated installation instructions for Coauthor.
Here is how to get a local test server running:
- Install Meteor:
npm install -g meteororsudo npm install -g meteor --unsafe-perm. Prefix witharch -x86_64on Apple M1. - Download Cocreate:
git clone https://github.com/edemaine/cocreate.git - Run meteor:
cd cocreatemeteor npm installmeteor
Even a test server will be accessible from the rest of the Internet, on port 3000.
To deploy to a public server, we recommend deploying from a development machine via meteor-up. We provide two example deployment configurations:
We've found that one machine running everything (Meteor, MongoDB, Redis, proxy)
to be reasonable for up to ~50 simultaneous users,
given ~2-4GB of RAM and 1-2 cores.
This configuration can be achieved fully automatically via mup as follows:
- Install Meteor and download Cocreate as above.
- Install
mupandmup-redisvianpm install -g mup mup-redis(after installing Node and thus NPM). - Copy
settings.jsonto.deploy1/settings.jsonand edit. In particular, you should change thecors-anywheresetting to point to your own CORS Anywhere server, or remove that setting altogether (to disable image loading via proxy). For further configuration choices forsettings.json, see APM and CDN below. - Edit
.deploy1/mup.jsto point to your hostname/IP and SSH key (for accessing the server), and maybe adjust RAM available to Meteor. cd .deploy1mup setupto install all necessary software on the server.mup deployeach time you want to deploy code to server (initially and after eachgit pull).
To scale beyond ~50 simultaneous users, we offer a different deployment
configuration in the .deployN directory. It runs the
following arrangement of servers:
| Number | Tasks | Recommended configuration |
|---|---|---|
| several (currently 4) | Meteor servers | 2GB RAM (1GB causes occasional crashes), 1 core, open to UDP ingress/egress on port 123 |
| one | MongoDB server | 4GB RAM, 4 cores |
| one | Redis and proxy | 1GB RAM, 1 core, open to TCP ingress ports 80 and 443 |
Cocreate assumes that all servers have roughly the same notion of time. So be sure to run an NTP client and open UDP port 123 for ingress and egress.
The nginx reverse proxy is the public facing web server (and should be the only server with publicly open ports), and automatically distributes requests to the Meteor servers (by IP hashing), automatically detecting crashed/upgrading servers and using the other servers to compensate. You should firewall the other servers (and the Redis server on the proxy machine) to protect them from outside access.
mup handles deployment of the Meteor servers and nginx reverse proxy.
You need to manually setup the MongoDB and Redis servers.
As in the provided mup.js, all Meteor servers except one
should have the COCREATE_SKIP_UPGRADE_DB environment variable set, to avoid
multiple servers from upgrading the Cocreate database format from older
versions.
To monitor server performance, you can use one of the following:
- Monti APM (no setup required, free for 8-hour retention); or
- deploy your own open-source Kadira server. To get this running (on a different machine), I recommend kadira-compose.
After creating an application on one of the servers above,
edit your .deploy/settings.json to include the following
(omit endpoint if you're using Monti):
{
"kadira": {
"appId": "xxxxxxxxxxxxxxxxx",
"appSecret": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"endpoint": "https://your-kadira-server:22022"
}
}All of Cocreate's data is stored in the Mongo database (which is part of Meteor). You probably want to do regular (e.g. daily) dump backups.
mup's MongoDB stores data in /var/lib/mongodb. MongoDB prefers an XFS
filesystem, so you might want to
create an XFS filesystem
and mount or link it there.
(For example, I have mounted an XFS volume at /data and linked via
ln -s /data/mongodb /var/lib/mongodb).
mup also, by default, makes the MongoDB accessible to any user on the
deployed machine. This is a security hole: make sure that there aren't any
user accounts on the deployed machine.
But it is also useful for manual database inspection and/or manipulation.
Install MongoDB client
tools,
run mongo cocreate (or mongo then use cocreate) and you can directly
query or update the collections. (Start with show collections, then
e.g. db.messages.find().)
On a test server, you can run meteor mongo to get the same interface.
Cocreate uses
tex2svg-webworker
to render LaTeX math.
For sake of performance, we recommend serving this rather large WebWorker
script via CDN, and the provided settings.json
does so via JSDelivr.
You can configure your .deploy/settings.json to use a different CDN as follows:
{
"public": {
"tex2svg": "https://your.cdn/tex2svg.js"
}
}Without this setting, e.g. when developing via meteor,
the WebWorker script will be served from the Cocreate server.
To enable flexible embedding images from the web,
including those restricted by CORS, we recommend installing a
CORS Anywhere proxy server and
configuring Cocreate to use it by setting the cors-anywhere public setting
in .deploy/settings.json. For example, here is how to use the CORS Anywhere
public test server, which is rate limited and for development only:
{
"public": {
"cors-anywhere": "https://cors-anywhere.herokuapp.com/"
}
}CORS Anywhere is a framework for making proxy servers. A good specific server
is Corsproxy which has
easy-to-follow installation instructions
(for ports ≥ 1024, e.g., 8080), along with the accompanying
certbot letsencrypt installation instructions
for SSL certificates.
While it may be tempting to set REQUIRED_HEADER="Origin",
Firefox won't send Origin headers for images
so it's best to leave it empty.
If you omit the cors-anywhere setting, Cocreate will never attempt to proxy
embedded images, so more images will fail to embed.
To install bcrypt on Windows (to avoid warnings about it missing), install
windows-build-tools
via npm install --global --production windows-build-tools, and
then run meteor npm install bcrypt.