Giter Club home page Giter Club logo

part-up's Introduction

Part-up

Installation

  • ensure imagemagick is installed (OS X: brew install imagemagick)
  • ensure meteor is installed
  • make sure you have all the correct environment variables set, which can be done in two ways:
    1. generate the development configuration using cd config/development && ./decrypt (this requires a password, which can be requested from the Part-up team)
    2. rename the file config/development/env.sh.dist to config/development/env.sh and fill in all the required credentials
  • ./start (in the root folder of the app)
  • App running at: http://localhost:3000/

Frontend

Structure

We have four types of application parts: layout, page, widget and small component. The explanation below points out their uses. Grahpic: app/packages/partup:client-pages/app and for the modals app/packages/partup:client-pages/modal.

Layout

Layouts are the top-level templates. They can contain a header, current page placeholder and footer. The Sass file should only contain header and footer positioning rules. The js file should keep track of the state of the template and handle navigation functionality.

Page

Pages can contain single components with page-specific functionality, widgets (packages) and sub-pages. A page, in fact, only represents a composition. Therefore, the Sass file should only contain position defenitions of the inside components. The js file should handle the page states and navigation functionality if subpages are present. Pages are directly binded to routes.

Widget (packages)

With a funcionality, you can think of a widget which will fulfill one standalone functionality. Functionalities that tie the app together (like a navigation bar) should not be declared as a package, because it’s not a widget with a standalone functionality. The Sass file may only contain component composition rules. When a widget is called WidgetsPartupActivities, the package should be called partup:client-widgets-partup-activities.

Small component

The whole app is made up of small styled components. These components are not functional by themselves, but only provides styling. For example: buttons, inputs, titles, paragraphs and menus. Each component should be defined as a Sass class prefixed with “pu-”, for example “pu-button”. Be aware not to define any styling dealing with the position of the component inside its parent or relative to its siblings.

Backend

Collections manipulation flow

  • Frontend uses Meteor.call to insert, update or remove documents in a collection.
  • Backend checks if the logged in user is authorised to perform the given operation (inside a Meteor method).
  • Backend saves document in mongodb
  • Backend emits an event that corresponds with the given CRUD operation, e.g. inserted, updated or removed (inside a Meteor method).
  • Handlers are created that have to react to these created events, for instance when inserting an update or notification.

Fixtures

Unit / Integration tests

  • disable tests
    • cd app
    • meteor remove mike:mocha
  • enable tests
    • cd app
    • meteor add mike:mocha
    • meteor add xolvio:cucumber

DevOps

Quick deployment

  • cd devops
  • ./devops provision <environment> all --tags=app (provide the SHA hash of the commit to be deployed, make sure it is build by Jenkins upfront)

MongoDB

  • Connecting: mongo "<host>/<database>" -u "<user>" -p "<password>"
  • Dumping: mongodump "<host>" --db "<database>" -u "<user>" -p "<password>" -o \date +%s``
  • Restoring: mongorestore "<host>" --db "<database>" -u "<user>" -p "<password>"
  • Restoring Meteor LoginServiceConfiguration: mongorestore "<host>" --db "<database>" -u "<user>" -p "<password>" -c "meteor_accounts_loginServiceConfiguration" <bson file from dump>
  • Emptying all Collections (run in mongo shell): db.getCollectionNames().forEach(function(collectionName) { db[collectionName].remove({}); });
  • Make user (super)admin: db.users.update({ '_id': '<insertuseridhere>' }, { $set: { 'roles': ['admin'] } })
  • Find faulty / wrongly uploaded pictures: db.getCollection('cfs.images.filerecord').find({'copies':{$exists:false}})

Unit testing

  • meteor run --test

Required server environment variables

NODE_ENV
MONGO_URL
ROOT_URL
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_BUCKET_REGION
AWS_BUCKET_NAME
FACEBOOK_APP_ID
FACEBOOK_APP_SECRET
LINKEDIN_API_KEY
LINKEDIN_SECRET_KEY
TZ = Europe/Amsterdam
MAIL_URL
FLICKR_API_KEY
FLICKR_SECRET_KEY
NEW_RELIC_LICENSE_KEY
NEW_RELIC_APP_NAME
NEW_RELIC_NO_CONFIG_FILE = true
KADIRA_APP_ID
KADIRA_APP_SECRET
METEOR_SETTINGS = {"public":{"analyticsSettings":{"Google Analytics":{"trackingId":""}}}}
GOOGLE_API_KEY

data dumps

clean userdump

  • regular mongo dump command
  • unpack bson for f in *.bson; do bsondump "$f" > "$f.json"; done
  • cat users.bson.json | sed 's/accessToken" : "[^"]*"/accessToken" : ""/g' > users.bson-clean.json
  • cat users.bson-clean.json | sed 's/hashedToken" : "[^"]*"/hashedToken" : ""/g' > users.bson-clean-2.json
  • cat users.bson-clean-2.json | sed 's/bcrypt" : "[^"]*"/bcrypt" : ""/g' > users.bson-clean-3.json
  • cat users.bson-clean-3.json | sed 's/token" : "[^"]*"/token" : ""/g' > users.bson-clean-4.json

editing env.sh-ecrypted

cd config/development && ansible-vault edit env.sh-encrypted

License

Copyright (C) 2016 Part-up

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses/.

An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.

part-up's People

Contributors

bryantebeek avatar jessedvrs avatar peterpeerdeman avatar tlimpanont avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.