Code Monkey home page Code Monkey logo

narrows's Introduction

NARROWS

NARROWS is an online storytelling system. The name stands for NARRation On Web System. The easiest way to explain it is to imagine an online Choose Your Own Adventure book with the following differences:

  1. Instead of having a single reader, there are as many readers as protagonists in the story (it could be one, but also four or five).
  2. Instead of having to choose between two or three preset choices after each "chapter", readers can write in a textbox whatever their characters do.
  3. Instead of the narrator writing the whole story with all possible branches upfront, then give it to the readers; the narrator writes only one chapter at a time and waits for the readers to submit the "actions" for their characters. Based on those actions, the narrator writes the next chapter.

You can also think of it as a way of running ruleless, diceless RPGs online (which is indeed the reason why I wrote it in the first place).

Installation

NARROWS is a web application with a backend. As such, it needs a server connected to the internet to be used. To install you need to run the following steps:

  1. Clone the code somewhere.
  2. Make sure you have Node.js (at least version 10) and NPM (at least version 4).
  3. Run npm install (note that you cannot use yarn!)
  4. Install Elm 0.19.1
  5. Run npm run build
  6. Install MySQL, create a new user and an empty MySQL database. Make sure the new user has all privileges to that database.
  7. Copy config/default.js to config/local-production.js and modify any values you need.
  8. Run NODE_ENV=production npm run dbmigrate
  9. Run NODE_ENV=production node build/index.js

If all this works you will have to find a way to keep the server running, eg. supervisor.

Updating the code

Every time you update the code you will have to install any new dependencies with:

npm install

And run any new migrations with the following command. Note that you might need to pass the NODE_ENV variable as in the installation instructions above:

npm run dbmigrate

Then you will have to recompile the frontend and backend code with:

npm run build

Running the tests

To be able to run the tests you need to create two test databases: the main one, and the "user storage" one. For the first one you have the settings in config/test.js. The second one is the same, except for the database name, which is narrows-userstore-test.

Once you have the two databases created and the test user created and have given access to them, you can run the tests by typing:

npm t

Docker

This repo includes a Dockerfile for building a deployable image. It also contains a docker-compose.yaml suitable for quickly getting a local copy running. The Dockerfile and compose file have been used (with modification) to host a production version of the app.

To get going with docker-compose:

docker-compose create && docker-compose up -d

If you want to host it publicly and setup e-mail, add the appropriate Docker environment variables from below:

  • PORT: port to listen to.
  • PUBLIC_ADDRESS: used to generate URLs in e-mails.
  • DB_HOST: MySQL hostname/IP.
  • DB_USER: MySQL username.
  • DB_PASSWORD: MySQL password.
  • DB_NAME: database name.
  • FROM_EMAIL: e-mail address to send from. e.g. "Narrows" <[email protected]>.
  • NODEMAILER: a nodemailer URI configuration string, e.g. smtps://user:[email protected]/?secure=true.

Note: NODEMAILER URI strings need to URI escape special characters within username/password. For example, usernames often contain @, and AWS SES passwords often contain /.

Credits

Icons/graphics

  • Speaker/mute icons made by Madebyoliver, from Flaticon. They are licensed under Creative Commons BY 3.0.
  • Trash icon by Freepik, from Flaticon. Licensed under Creative Commons BY 3.0.
  • Add/plus icon, message icon, user icon, info icon and edit icon by Lucy G, from Flaticon. Licensed under Creative Commons BY 3.0.
  • RSS icon by Dave Gandy from Flaticon. Licensed under Creative Commons BY 3.0.
  • Vintage divider by Web Design Hot. Licensed under Creative Commons BY 3.0.

Contributors

  • Tess Gadwa (tessgadwa): UX help and recommendations.
  • James Sapara (interlock): Docker setup.

narrows's People

Contributors

emanchado avatar fhemberger avatar interlock avatar jamesmcdonald avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

narrows's Issues

Duplicate Chapter

When pressing the "Publish" button for a New Chapter, a duplicate, identical chapter is sometimes created. (This only happened once, when the third chapter, "A Classic Whodunit," was published.

This chapter should also appear at the end of the chapter list, not in the middle.

Error when uploading new background image on chapter page.

I received the following error when attempting to load a new image onto the chapter page:

Error upload media file: Cannot add new media file: TypeError: Cannot read property 'name' of undefined

In addition, load time was very slow.

However, the new background image did in fact upload.

local - Docker-compose failed

When local - Docker-composing , i'm getting
`
...
jordi@anarres:~/Docker/narrows> docker-compose create && docker-compose up -d
...
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/nodemon/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN [email protected] No repository field.
npm WARN [email protected] license should be a valid SPDX license expression
npm ERR! Linux 5.11.4-1-default
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v6.11.5
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node-pre-gyp install --fallback-to-build
npm ERR! Exit status 7
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the bcrypt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs bcrypt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls bcrypt
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /opt/narrows/npm-debug.log
ERROR: Service 'narrows' failed to build : The command '/bin/sh -c npm install && npm install -g [email protected] && npm install -g pm2 && elm-package install --yes && npm run build' returned a non-zero code: 1
`

( on openSUSE Tumbleweed with latest dokcker/ NodeJS running fine with other projects...)

what am i missing ?

Brunch Build Error

Hello, I am having trouble trying to install it on my system could you help me figure it out?
I have the latest NPM installed. Is there something wrong with the latest release?

Trying to run the "buildfe" using :
npm run buildfe

The brunch build failed at the npm install line.

Stack trace was suppressed. Run with LOGGY_STACKS=1 to see the trace.

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "buildfe"
npm ERR! node v7.10.0
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] buildfe: brunch build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] buildfe script 'brunch build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the narrows package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! brunch build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs narrows
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls narrows
npm ERR! There is likely additional logging output above.

Uploading 2017-05-28T02_25_44_827Z-debug.txt…

Add option to skip the chapter "Start" page

Some users might want to skip the "Start" page for every chapter. This should probably be something tied to the device, as the preference for the background music.

It's not possible to start music in some/all mobile browsers without user interaction, so maybe this will only work properly if the user doesn't want music.

See #14 for some discussion about this.

Docker launch fails: ER_HOST_NOT_PRIVILEGED: Host 'XX.XX.XX.XX' is not allowed to connect to this MySQL server

Hello!! I just discovered this app and it's a dream come true that I didn't know I had! I saw there were docker instructions, but when I tried running them I received the above error. I'm not sure why?

I edited the docker-compose.yml values, and then continued to created an .env file to assign the variables such as PUBLIC_ADDRESS and NODEMAILER as listed in the instructions. Am I missing something?

Also as a side note, I'm willing to try to install this outside of docker, but I'm not sure where to change the NODEMAILER variable? I use an SMTP and would like to send email via that if possible

Thank you again for making this wonderful webapp!! I've told a friend about it and we're both excited to give this a try.

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.