GithubHelp home page GithubHelp logo

cothings-app / cothings Goto Github PK

View Code? Open in Web Editor NEW
9.0 6.0 5.0 4.35 MB

Backend and Frontend for CoThings.

Home Page: https://cothings.app

License: GNU Affero General Public License v3.0

Elixir 23.28% CSS 4.68% JavaScript 67.14% HTML 4.53% Dockerfile 0.36%
coronavirus covid-19 elixir-phoenix share-house beacons socket realtime beacon ibeacon altbeacon

cothings's Introduction

CoThings

Codename: Co-Living

Elixir CI GitHub last commit GitHub issues License

CoThings is application to account for current number of people using shared areas or utilities in realtime. The project’s main purpose is avoiding you to visit crowded areas during COVID-19 pandemic if you live in a community.

Without any restriction anyone can update the counter in case of people forget to update their status.

It uses socket for realtime communication.

You can see the project overall progress from here

You can checkout applications' designs from here

For automatic room updates (on enter and exit) you need a beacon installed in the area and the iOS application.

Here's our iOS Application

You can download the iOS application from the App Store

Here's our Demo Web Site.

And here's a screenshot that we use for our share-house facility:

Contributions

Any contributions are welcome. Here is some categories that you might help with:

  • Designing
  • Frontend development
  • Backend development
  • Mobile apps development

Contact with the team

Technical Information

Currently the project is being developed in Elixir + Phoenix Framework. In the future we might separate the backend and frontend.

You can run the web application on your server with Docker using docker-compose. How to part will be detailed later.

How to run the app for Production

Please always chekcout the latest release documentation for Phoenix from here

Stack Versions

Elixir: 1.14.1

Erlang/OTP: 25

Phoenix: 1.6.0

Run as a Docker Container

  1. Create .env file in the root folder of the project or mv .env.example .env and set the environment variables as needed. Here's some explanation of some environment values.

    SECRET_KEY_BASE is an unique key to sign in your cookie and session, to not save it plain. Keep it secret! Don't commit it. You should generate your own by using mix command mix phx.gen.secret

    DATABASE_URL is pretty clear. Should be something like this ecto://db_user:db_password@db_hostname/coliving_prod

    POOL_SIZE Your database's connection pool size

    HOST Your app's domain. You need it in order to confirm the handshaking between clients.

    APP_TITLE "CoThings" is the default app title however feel free to change the app's title, but you need to keep the credits at the bottom acccording to the license.

    ADMIN_USERNAME and ADMIN_PASSWORD are the credentials for managing rooms. To access the rooms management the url is /rooms

    LOG_ROOM_USAGE let the application create room usage logs. Default: false

    APP_IMAGE_URL You can setup an header image for your application. If not, we're going to use this photo by Daniel DiNuzzo @ddinuzzo on Unsplash.

    SERVER_SOURCE_CODE_URL Due to AGPL-3.0 license requirements you have to provide the server's source code. In case you haven't modified the source code; you can use original repo's url from https://cothings.app/code

    IOS_SOURCE_CODE_URL Due to GPL-3.0 license requirements you have to provide the iOS application's source code. In case you haven't modified the source code; you can use original repo's url from https://cothings.app/code

  2. Update your database settings and persistent volume paths in docker-compose.yml file. You can keep track of bussiest days of the week and time of the day for the room usage.

  3. There are two ways to have the docker image:

    1. Build the image by yourself docker build -t coliving . Please note that, since out Dockerfile use multistage build, you will need Docker version 17.05 or later.

    2. Or you can use our initial release docker image by pull it like this: docker pull cothings/web-app:latest or specify in the image and the tag in docker-compose.yml file.

  4. Now run the application docker-compose up -d

  5. See the logs docker-compose logs to confirm your hostname is written in the logs.

  6. ⚠️ Once you've released and ran the app on production, you need to run migration. Run the following command.

docker exec -it {container_name} bash bin/coliving eval Coliving.Release.migrate

Run with Kubernetes using Helm Charts

Kubernetes deployments are supported, by using Helm. Chart can be found under deployment/kubernetes/chart.

Run in Local Environment (or for Development purpose)

To run the project in your local:

  • You'll need a PostgreSQL (docker) instance in your local
  • Install dependencies with mix deps.get
  • Create and migrate your database with mix ecto.setup
  • Install Node.js dependencies with cd assets && npm install
  • Start Phoenix endpoint with mix phx.server

Now you can visit localhost:4000 from your browser.

cothings's People

Contributors

dependabot[bot] avatar furkanmustafa avatar nesimtunc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cothings's Issues

Notification Feature

if the room is full, user can opt-in for a notification when the room becomes available. Kind of line up.

Upgrade to Elixir 1.14.1

Currently upgrading doesn't work on latest alpine and alpine-3.16 docker images

Needs to investigate the problem below

Error loading shared library libstdc++.so.6: No such file or directory (needed by /app/erts-12.3.2.6/bin/beam.smp)
Error loading shared library libgcc_s.so.1: No such file or directory (needed by /app/erts-12.3.2.6/bin/beam.smp)
Error relocating /app/erts-12.3.2.6/bin/beam.smp: __cxa_begin_catch: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZSt24__throw_out_of_range_fmtPKcz: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _Znwm: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZSt20__throw_length_errorPKc: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: __cxa_guard_release: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZNKSt8__detail20_Prime_rehash_policy11_M_next_bktEm: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: __popcountdi2: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZSt29_Rb_tree_insert_and_rebalancebPSt18_Rb_tree_node_baseS0_RS_: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZSt17__throw_bad_allocv: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_appendEPKcm: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZSt18_Rb_tree_incrementPKSt18_Rb_tree_node_base: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: __cxa_end_catch: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: __cxa_guard_acquire: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZNKSt8__detail20_Prime_rehash_policy14_M_need_rehashEmmm: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZSt19__throw_logic_errorPKc: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZSt28__throw_bad_array_new_lengthv: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZSt18_Rb_tree_decrementPSt18_Rb_tree_node_base: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7reserveEm: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: __cxa_rethrow: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _Unwind_Resume: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZdlPvm: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv120__si_class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv120__si_class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv120__si_class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv120__si_class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv120__si_class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv120__si_class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv120__si_class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv120__si_class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv120__si_class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv117__class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv117__class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv117__class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv117__class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv117__class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv117__class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv121__vmi_class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: __gxx_personality_v0: symbol not found
Error loading shared library libstdc++.so.6: No such file or directory (needed by /app/erts-12.3.2.6/bin/beam.smp)
Error loading shared library libgcc_s.so.1: No such file or directory (needed by /app/erts-12.3.2.6/bin/beam.smp)
Error relocating /app/erts-12.3.2.6/bin/beam.smp: __cxa_begin_catch: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZSt24__throw_out_of_range_fmtPKcz: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _Znwm: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZSt20__throw_length_errorPKc: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: __cxa_guard_release: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZNKSt8__detail20_Prime_rehash_policy11_M_next_bktEm: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: __popcountdi2: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZSt29_Rb_tree_insert_and_rebalancebPSt18_Rb_tree_node_baseS0_RS_: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZSt17__throw_bad_allocv: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_appendEPKcm: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZSt18_Rb_tree_incrementPKSt18_Rb_tree_node_base: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: __cxa_end_catch: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: __cxa_guard_acquire: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZNKSt8__detail20_Prime_rehash_policy14_M_need_rehashEmmm: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZSt19__throw_logic_errorPKc: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZSt28__throw_bad_array_new_lengthv: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZSt18_Rb_tree_decrementPSt18_Rb_tree_node_base: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7reserveEm: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: __cxa_rethrow: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _Unwind_Resume: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZdlPvm: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv120__si_class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv120__si_class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv120__si_class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv120__si_class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv120__si_class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv120__si_class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv120__si_class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv120__si_class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv120__si_class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv117__class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv117__class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv117__class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv117__class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv117__class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv117__class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: _ZTVN10__cxxabiv121__vmi_class_type_infoE: symbol not found
Error relocating /app/erts-12.3.2.6/bin/beam.smp: __gxx_personality_v0: symbol not found

Create Wiki Page(s)

  • About the app
  • Setup the backend (web) app for each environment
  • Socket implementation for clients

Let user know when someone enters / exits room (Optional)

I got a feedback from one of users, they were expecting to be notified when someone enters / exits the room with current notification settings. It's not cleared for them that implementation. So maybe in the future we could improve this optional feature when implement Queue feature of the shared things.

Error Handling

Update Error template to a nice one.

Cases

  • Handle DbConnection Error on
    • home page request
    • socket connection
  • Return HTTP 503 Error along with a nice view

Statistics

Show some statistics on home page

  • Busiest time of the day
  • Busiest day of the week

Table to use: usages

Security Option: Add Basic Auth

Enable optional built-in basic auth plug for restriction web application

Example:

# lib/my_app_web/router.ex
use MyAppWeb, :router
import Plug.BasicAuth
import Phoenix.LiveDashboard.Router

...

pipeline :admins_only do
  plug :basic_auth, username: "admin", password: "a very special secret"
end

scope "/" do
  pipe_through [:browser, :admins_only]
  live_dashboard "/dashboard"
end

TODO:

  • Get Basic Auth from Environment Values

Config.json

We need a config.json API request for client side configuration.

Request URL will be {server_url}/config.json

Example:

{
 "app": {
   "image_url": "http://localhost:4000/images/app_image.jpg",
   "title": "CoThings"
 },
 "beacon" : {} 
}

App's title is already is set in environment variables. We can use same approach for photo as well.

This configuration can be used for multiple purposes; like optimizing beacon related parameters.

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.