Giter Site home page Giter Site logo

15thnight's Introduction

15th Night App

Development

Requirements

  • python2.7
  • pip
  • node
  • npm
  • virtualenv
  • git

Standard Development Installation

$ git clone https://github.com/15thnight/15thnight
$ cd 15thnight
$ virtualenv venv
$ echo "export PYTHONPATH=$(pwd)" >> venv/bin/activate
$ source venv/bin/activate
$ pip install -r requirements.txt
$ cd client
$ npm install
$ ./node_modules/.bin/webpack && cd ..

At this point, you will have the project downloaded along with the python packages.

Customize Config

Copy All Default Settings

To customize the entire default configuration, you can simply copy the distribution config file to config.py and then edit config.py:

$ cp configdist.py config.py
$ vim config.py

Import Settings and Overwrite Individually

Another option is to import all the default settings and only overwrite certain settings. Here is an example of a minimal config.py file that imports default values and sets the database to a MySQL connection and sets the address:

from configdist import *

DATABASE_URL = 'mysql://db_user:db_pass@db_host/db_name'
# SERVER_NAME must NOT have a protocol prefix (no http/https)
SERVER_NAME = 'localhost:5000'

Database

The DATABASE_URL string in the config file determines the engine and settings for the database connection. The default is a SQLite connection string that creates a test.db file. NOTE: migrations are not possible with SQLite

Database Type

Postgres, MySQL and SQLite databases are supported.

Postgres

Example postgres connection string:

postgres://db_user:db_pass@db_host/db_name

MySQL

In order to use MySQL, MySQL-python must be installed:

pip install MySQL-python

Example MySQL connection string:

mysql://db_user:db_pass@db_host/db_name

Create the Database Tables

The database tables can either be created with migrations (recommended) or without.

For MySQL and Postgres databases, the database must be created first before creating the tables:

CREATE DATABASE db_name

Migrations (Postgres/MySQL)

To create the database tables via migrations, MySQL or PostgreSQL must be used as the database. This command will create the database tables and is also used to migrate the tables if there are any new migrations:

$ alembic upgrade head

For more information on how the project migrations work, refer to the alembic documentation.

No Migrations (SQLite/Postgres/MySQL)

For simple development, such as with sqlite, create the database tables with the following command:

$ ./manage.py create_db

Note that migrating the database tables to future versions is not possible when they are created with this command.

Twilio

To use SMS features, a Twilio account is required. Follow these steps to set up twilio:

  1. Sign up for an account at twilio.com.
  2. At the dashboard page, locate the Account SID and Auth Token values and set them in config.py. They correlate to the TWILIO_ACCOUNT_SID and TWILIO_ACCONT_AUTH_TOKEN settings, respectfully.
  3. Click on the # button in the upper left to be taken to the phone numbers page.
  4. Buy a phone number that has SMS capabilities and set the TWILIO_FROM_NUMBER in the config to that number. Make sure the number is in the format +1XXXXXXXXXX.

Twilio allows use of the twilio number and SMS capabilities for a little while as a trial account without paying.

Creating a User

$ ./manage.py create_user <email> <password> <role>

Example:

$ ./manage.py create_user [email protected] password admin

Seed the database with the test users (refer to the source code for the user details):

$ ./manage.py seed_db

Running the Development Server

Begin by running celery:

$ celery -A _15thnight.queue worker

Then start up the development web server with live reloading of python code changes (r flag) and debug output (d flag):

$ ./manage.py runserver -dr

Go to localhost:5000 in your browser.

Hosting a Production Server

To host the project from a production environment, first follow the instructions under Standard Development Installation and set up a database.

Requirements

  • Apache or nginx
  • WSGI
  • MySQL or PostgreSQL (recommended)
  • Redis or RabbitMQ (recommended)

Setup Celery

Automatically (as root or with sudo)

./setup_celery.sh

Manually

# Change the 3 to the concurrency level desired
sed \{"s?PROJECT_PATH?$(pwd)?g; s?THREAD_COUNT?3?g;"\} celeryd.template > celeryd.conf
mv celeryd.conf /etc/default/celeryd
cp celeryd.init /etc/init.d/celeryd
useradd -M -r -s /bin/false celery

Create the WSGI File

Create a WSGI file for Apache/nginx:

$ sed "s?PROJECT_PATH?$(pwd)?g" 15thnight.wsgi.template > 15thnight.wsgi

Apache Config

Create the apache config (this config assumes you have a _15thnight user added to a _15thnight group that has access to the project directory):

$ sed "s?PROJECT_PATH?$(pwd)?g" 15thnight.apache.template

15thnight's People

Contributors

edwardszczepanski avatar justinnoah avatar lebonesco avatar nobane avatar slively avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

15thnight's Issues

Name and Org fields for Users

User model needs a name field and an organization field that can be edited in the user profile.

Shall we also show these as optional fields in the registration form?

@spectralsun

closed alerts don't send final txt msg

From Megan: I am registered as a Provider in the RAN for some of the services. I received an alert from Donna Butera on Friday via text message. When I logged on to the RAN it was there as well but when she closed the case, I did not get a text message. I had to log back in to see that it was closed. Something for the Devs to check out.

Latest Updates Broke Login

We updated www.15thnight.help via "git pull" and restarted services yesterday, but this broke login. On the web interface the message "An unknown error occured while logging in." was displayed. The password reset page also didn't work and displayed a similar error. I didn't see anything in the Apache or messages logs, although I didn't expect to fine anything relevant in these logs. Celery log looked OK, but I also didn't think this would be relevant to login. I wasn't sure where else to look and so I decided rollback the changes from yesterday. I can now login and I believe the site is fine, but we'll need to identify he issue so we can update the server again.

Below is the output from "git pull" that resulted in breaking login. Possibly you can review one of these 21 files and identify the issue, but if you need more information from us please advise how we can better assist you with troubleshooting the issue.

CHANGELOG | 2 +
_15thnight/init.py | 14 ++--
_15thnight/api/account.py | 57 ++++++----------
_15thnight/api/alert.py | 10 +--
_15thnight/api/category.py | 12 ++--
_15thnight/api/need.py | 4 +-
_15thnight/api/response.py | 8 +--
_15thnight/api/service.py | 10 +--
_15thnight/api/user.py | 10 +--
_15thnight/core.py | 60 ++++++++++++++++-
_15thnight/templates/email/support_request.txt | 5 ++
client/src/actions/account.js | 28 ++++++--
client/src/components/chrome/NavbarLinks.js | 6 ++
client/src/components/chrome/index.css | 2 +-
.../components/pages/advocate/AdvocateHelpPage.js | 11 ++++
client/src/components/pages/advocate/index.js | 1 +
.../components/pages/provider/ProviderHelpPage.js | 73 +++++++++++++++++++++
client/src/components/pages/provider/index.js | 1 +
client/src/routes/AdvocateRoutes.js | 4 +-
client/src/routes/ProviderRoutes.js | 4 +-
configdist.py | 3 +
21 files changed, 244 insertions(+), 81 deletions(-)

non-chrome browsers need testing

We are getting reports form the field that FF, Safari just give a blank page at 15thNight.help. I have not re-created this but for now we are telling folks to use chrome. I only care the about latest version of FF, IE, Edge, Safari. Its OK to work best on Chrome in my book but the blank page is bummer. If nothing else, make a screen that tells them to use chrome.

change passwordlink broken

From Megan. I have not reproduced this myself.

An advocate forgot her password so she clicked on the "forgot password" prompt and entered her email. The link that was sent to her email did not work.

I went in as an administrator and changed her password from my end so she is able to access the RAN but we should look into the "link"

Alert Form Cleanup (and discussion)

The description field has been seen as confusing: discussion needed.

Required fields should be identified

Tooltip some simple suggestions on some fields (maybe?)

Improper Naming of Category in seed_services

        clothing.name = "Clothing",

should read

        clothing.name = "Clothing"

PostgreSQL and MySQL apparently haven't had an issue with this, however SQLite fails because the added , in python means it's a tuple instead of a String.

"Clothing",

becomes:

("Clothing",)

and SQLite chokes on that

Effective UI for Alert Description Character Limit

Currently the user does not know how many characters are in the description box. This causes a lot of trial and error for guessing how to reword the description for the advocate. Basically, a character count in gray below the description box showing something like 144/200 would be ideal.

Deleting Categories fails

Currently when deleting a category all services below said category have the category field set to NULL. This is not allowed by our models and thus fails.

IMO we should cascade delete since it doesn't make sense to have category-less services.

Help pages

From Mike,

The issue that I wasn't aware of until the conference call is that most end-users shouldn't contact us directly. Instead they should contact their own internal IT, such as at the schools. The solution we discussed is to generate a different help page depending on their role. Advocates would be instructed to reach out to their local IT resources, whereas providers would be provided with a form to request support. Is this feature in the works?

The help page form for providers hopefully would only include a description field and a submit button. The submit button would send an e-mail to our ticketing system at [email protected]. The body of the e-mail would include the description field, and the name of the provider. The from address would need to be the providers e-mail address and the subject "15th Night RAN Website Support Request". If you can accomplish this, then a ticket would be generated with all the information we need. The end-user would get an automatic response initially, and then we could provide prompt service from any of the 3 of us here in IT.

Code Cleanup for GoLive

With the branch that references this issue, I am tracking develop and doing some code cleanup to follow flake8 standards. I believe this should be merged just before the GoLive release, aka 0.1.0 is done. Discussion is very much welcome.

Alert Urgency Level

Is this a normal alert (one that may take a while like getting a soc. security card) or is this something like the child needs a bed for the night tonight.

Services Migration

The services migration is currently not working if data already exists for categories. And this migration also breaks the seed_db manage command.

Description box character limit

There must be a character limit in the description box because you will get an error message if you go over. We need to tell people what the character limit is or not have a limit.

Redirect any URL after login

Right now we only catch respond-to URLs for logged out users and redirect them on login. This system should be made generic to handle any URL that doesn't match something in external routes, and attempt to redirect after login. The app should also convert the URL into a query parameter so if the user refreshes the page before they login, they will still get redirected, ex: /respond-to/1 becomes /?redirect=/respond-to/1.

Fix mobile formatting

The site has drifted far away from formatting nicely on smaller monitors and mobile devices.

URL shortner

Acquire 15n.help (or some other short URL) and use it for shorter URLs in texts.

Feature Based Releases/MIlestones

I like the idea of semver'ing the project and am for new major and/or minor version bumps to be milestones. Patch bumps maybe not? I'm not sure how we want to handle that besides simply cutting a bugfix w/o tying to a milstone. Have you any thoughts?

I think in the project wiki we should have a Roadmap page that outlines our desires for milestones and once a milestone, say 0.4.0, is fleshed out on the Roadmap we start creating issues for and assigning them to said milestone.

Also, a release cutting guide page and a release upgrade path page would both be valuable as well. Especially since we can link the latter to OSLC for instructions and we can clear up the README to keep it simple.

Alerts Not Working

Megan reported today that alerts were not being sent. They would submit an alert and received the message at the top of the page "An unknown error occured while sending alert". I rolled back the code to an older date and now when you submit an alert you receive the message "Alert sent successfully", but messages are not sent. I tried to roll back the site to several different dates, including to the major release the night before 15th Night event, but same issue occurs.

I am viewing git events with command "git reflog --date=iso", then I rollback to a previous code version with something like "git reset --hard 11c10b7", where 11c10b7 is an example of a hash associated with a particular date. Each time I use "git reset" I restart PostgreSQL, Apache and Celery. Possibly this isn't the correct procedure?

When I use ./manage.py twillio_test I receive a text, so SMS is working. I can't test alerts through the web interface though. I can add, remove and edit users and I created a few test users. However, when I select role type provider, select a service and submit, the message at the top of the page reports success, but the service is not added. I can then edit the user and try to select a service again, but it doesn't work. What I did instead was send an alert selecting the service "Dental Care", which Megan has a provider user account setup, and she is the only provider user account with this service selected. When I send a alert for Dental Care the message at the top of the window reports "Alert sent successfully", but when I view Postfix logs I see no e-mails were sent. I can see previous e-mails from Tuesday and older before the site was updated with "git pull". I don't know if an SMS is sent because I don't know where or if that is logged.

The Celery daemon is running, and I've poked around to try to figure this out, but I've run out of ideas. I'm hoping you may know the issue or can offer suggestions. Any ideas?

Mobile friendliness has disappeaed.

Currently on mobile platforms, we don't get a burger menu, we don't shrink as necessary, just a bunch of scrolling looking like a Desktop webpage.

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.