Skip to content

Opla.ai Backend using Node es2018 react and redux

License

Notifications You must be signed in to change notification settings

aclk/opla-backend

 
 

Repository files navigation

opla-backend

Build Status

Opla.ai Backend using Node es7 react and redux.

Getting started

Prerequisites

First of all, make sure you have Node 8.x and Yarn installed.

You will also need MariaDB 10.2 or mysql 5.7. We provide a Docker Compose configuration to get you started quickly.

Installation

  1. Install the (dev) dependencies:

    $ yarn install
    
  2. Run the configuration tool:

    $ bin/opla init
    

    Important: if you want to use Docker Compose, accept all the default settings and run docker-compose up -d, otherwise configure your MariaDB instance.

  3. Run the migrations:

    $ bin/opla migrations up
    
  4. Start the dev environment:

    $ yarn dev
    

This application should be available at: http://127.0.0.1:8081/.

Database migrations

We use db-migrate to manage the database migrations with a specific configuration for this project. By using the bin/opla tool, this configuration is automatically generated and db-migrate is bound to the bin/opla migrations command. Do not run db-migrate directly (it should complain about not finding the configuration file anyway).

Creating a migration

  1. Run:

    $ bin/opla migrations create "short explanation of the migration"
    

    The "short explanation of the migration" will be used in the migration filename (see the content of the migrations/ folder for some examples). Choose something short and self-explanatory.

    This command will create several files, all of them should be put into Git. You should not have to care about the generated JavaScript files as writing migrations in plain SQL is much easier. In addition, you should not deal with the down migrations, since database rollbacks never work in practice, we only go forward.

  2. Write your migration in plain SQL in the generated file:

    echo "<SQL STATEMENT>;" > migrations/sqls/20180307110023-short-explanation-of-the-migration-up.sql
    

    Then, you can apply this migration and make sure everything works as intended.

Applying migrations

To apply all migrations at once, run:

$ bin/opla migrations up

Contributing

Please, see the CONTRIBUTING file.

Contributor Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. See CODE_OF_CONDUCT file.

Docker Image

Configuration

You have 2 options: - pass ENV variables to override config properties one by one. See Dockerfile ENV statement for available environment variables. - override default.json by mounting your own /src/config/config.json file. You can create such a file by running bin/opla init locally.

License

opla-front is released under the GPL v2.0+ License. See the bundled LICENSE file for details.

About

Opla.ai Backend using Node es2018 react and redux

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 99.0%
  • Shell 1.0%