Skip to content
This repository has been archived by the owner on Jul 24, 2019. It is now read-only.

Prepare for offline use #90

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM ruby:1.9.3

# Use a directory called /code in which to store
# this application's files. (The directory name
# is arbitrary and could have been anything.)
WORKDIR /code

# Copy all the application's files into the /code
# directory.
COPY . /code

# Run bundle install to install the Ruby dependencies.
RUN bundle install

RUN git clone https://github.com/BenGardiner/static.mindmup.com
RUN ln -nsf $(which sed) /usr/local/bin/gsed
RUN cd static.mindmup.com && sh pack.sh
RUN cp -Lpr static.mindmup.com/content/img public
RUN cp -Lpr static.mindmup.com/content/font public
RUN cp -Lpr static.mindmup.com/content/pack_latest public

ENV PUBLIC_HOST="http://localhost:5000"
RUN sed -i "s/20161111155712/pack_latest/g" web.rb

RUN gem install foreman
EXPOSE 5000
CMD ["foreman", "start"]

81 changes: 8 additions & 73 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,78 +1,13 @@
MindMup - Zero Friction Mind Map Canvas
=======================================
This is a fork of the old and awesome mindmup (mindmup-legacy).

[![Build Status](https://api.travis-ci.org/mindmup/mindmup.png)](http://travis-ci.org/mindmup/mindmup)
See https://github.com/davedf/mindmup for the real deal.

MindMup is a zero-friction mind map canvas. Our aim is to create the most productive mind mapping environment out there, removing
all the distractions and providing powerful editing shortcuts.
This repo is _only_ for running mindmup-legacy offline:

This git project is the server-side portion of MindMup. It provides a web interface that serves maps, allows users to edit and save them,
provides menus and feedback forms and links to analytics. You can see an example of this live on http://www.mindmup.com.
```sh
docker build -t ogmindmup .
docker run -p 5000:5000 ogmindmup
```

Dependencies
-------------

- This app is designed to run in the Heroku cloud or as a standalone [Sinatra application](https://github.com/sinatra/sinatra/).
- It depends on the [MapJS](http://github.com/mindmup/mapjs) javascript canvas for client side rendering, and imports a compiled
single-file version of that project as /public/mapjs-compiled.js
- It uses Google Drive and Amazon S3 AWS service to store maps
- It uses Google analytics to track feature votes, usage patterns and report error rates
- It uses Google URL shortener to produce short links for sharing

Configuration
-------------

The server depends on the following environment variables:
- GOOGLE_SHORTENER_API_KEY _Google shortener API key_
- GOOGLE_CLIENT_ID _Google Drive Client Id_
- GOOGLE_ANALYTICS_ACCOUNT _Google analytics ID to use for tracking. Don't use the production IDs in staging. Not used in dev and testing_
- S3_BUCKET_NAME _Only the name of S3 Bucket where files are located (eg mindmup)_
- S3_KEY_ID _AWS Access key ID that has write access for the bucket_
- S3_SECRET_KEY _AWS Secret key corresponding to the ID above_
- S3_UPLOAD_FOLDER _folder within the bucket where user maps are stored. (eg map). Avoid using the same folder for production and testing_
- S3_WEBSITE _website domain name where user files are publicly accessible. Don't specify protocol or slashes (eg mindmup.s3.amazonaws.com)_
- SITE_URL _public URL for the web site instance, used to get S3 to redirect back to us. Include protocol and slashes (eg http://localhost:5000/)_
- DEFAULT_MAP _name or key of the map to be shown on homepage (eg default)_
- RACK_SESSION_SECRET _hashing key for rack sessions (should be relatively random, alphanumeric)_
- MAX_UPLOAD_SIZE _in KB, maximum size allowed for the users to upload. If not defined, 100 is the default value_
- NETWORK_TIMEOUT_MILLIS _number of milliseconds before we start reporting to users that there is a problem, in case of a timeout. Default is 10000._
- CURRENT_MAP_DATA_VERSION _prefix for files signaling the data format. For now, we use a1. This is to help in the future with format versioning_

Running standalone
------------------

To run the application in standalone mode (without Heroku), create a .env configuration file (_don't commit this to git_) and put your S3 account info
and other stuff mentioned above into that. You don't need a JotForm account to run the site (but sharing and feedback won't work without it). Then
execute:


gem install foreman
bundle install
foreman start

See [Heroku Configiration Local Setup](https://devcenter.heroku.com/articles/config-vars#local-setup) for more information.

Note: Unless RACK_ENV is production, Google analytics is not used, the analytics information is instead logged to the JavaScript console.

Executing tests
---------------

We do a bunch of exploratory tests and some manual sanity tests before each release,
and use this [ACC Matrix](https://github.com/mindmup/mindmup/wiki/Attribute%2C-Component%2C-Capability-matrix) to guide testing. Most client tests
are in the MapJS project, so see that as well. This server does very little apart from some basic routing, so there are not many automated tests
in this project. For server testing, there are a few RSpec tests that should run before commiting. Execute them with:

rspec test/*.rb

The tests don't depend on the .env file intentionally. Supply your own config as part of the test if needed.

All JavaScript widgets are tested using Jasmine, here are two ways of running tests:

- Visual: Open SpecRunner.html in a browser, this will run all Jasmine tests

- Automated: Using [PhantomJs](phantomjs.org), in the test folder, run

sh runtests.sh

Please note that the CI server uses phantomjs, so make sure that tests run with phantom before committing.
That's it. That's the README.

2 changes: 1 addition & 1 deletion public/e/dropbox.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.repo-d {
background-image: url('//static.mindmup.com/img/dropbox-16.png');
background-image: url('img/dropbox-16.png');
padding-left: 16px;
}

Expand Down
2 changes: 1 addition & 1 deletion public/e/github.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.repo-h {
background-image: url('//static.mindmup.com/img/github-16.png');
background-image: url('img/github-16.png');
padding-left: 16px;
}
#modalGithubOpen td a {
Expand Down
2 changes: 1 addition & 1 deletion public/e/google-collaboration.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.repo-c {
background-image: url('//static.mindmup.com/img/repo-c.png');
background-image: url('img/repo-c.png');
background-repeat: no-repeat;
background-position:left center;
}
Expand Down
16 changes: 8 additions & 8 deletions public/ios/3/mindmap-ios.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,28 @@ body.ios-wkwebview {
padding: 0;
}
.repo-a {
background-image: url('//static.mindmup.com/img/logo_16.png');
background-image: url('img/logo_16.png');
}
.repo-b {
background-image: url('//static.mindmup.com/img/logo_gold_16.png');
background-image: url('img/logo_gold_16.png');
}
.repo-p {
background-image: url('//static.mindmup.com/img/logo_gold_private_16.png');
background-image: url('img/logo_gold_private_16.png');
}
.repo-g {
background-image: url('//static.mindmup.com/img/google_drive.png');
background-image: url('img/google_drive.png');
}
.repo-o {
background-image: url('//static.mindmup.com/img/offline.png');
background-image: url('img/offline.png');
}
.chrome .repo-o {
background-image: url('//static.mindmup.com/img/offline-chrome.png');
background-image: url('img/offline-chrome.png');
}
.safari .repo-o {
background-image: url('//static.mindmup.com/img/offline-safari.png');
background-image: url('img/offline-safari.png');
}
.gecko .repo-o {
background-image: url('//static.mindmup.com/img/offline-firefox.png');
background-image: url('img/offline-firefox.png');
}

a.repo, a.repo, a.repo {
Expand Down
16 changes: 8 additions & 8 deletions public/ios/4/mindmap-ios.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,28 @@ body.ios-wkwebview {
padding: 0;
}
.repo-a {
background-image: url('//static.mindmup.com/img/logo_16.png');
background-image: url('img/logo_16.png');
}
.repo-b {
background-image: url('//static.mindmup.com/img/logo_gold_16.png');
background-image: url('img/logo_gold_16.png');
}
.repo-p {
background-image: url('//static.mindmup.com/img/logo_gold_private_16.png');
background-image: url('img/logo_gold_private_16.png');
}
.repo-g {
background-image: url('//static.mindmup.com/img/google_drive.png');
background-image: url('img/google_drive.png');
}
.repo-o {
background-image: url('//static.mindmup.com/img/offline.png');
background-image: url('img/offline.png');
}
.chrome .repo-o {
background-image: url('//static.mindmup.com/img/offline-chrome.png');
background-image: url('img/offline-chrome.png');
}
.safari .repo-o {
background-image: url('//static.mindmup.com/img/offline-safari.png');
background-image: url('img/offline-safari.png');
}
.gecko .repo-o {
background-image: url('//static.mindmup.com/img/offline-firefox.png');
background-image: url('img/offline-firefox.png');
}

a.repo, a.repo, a.repo {
Expand Down