zaffnet / nexmo-developer

Provides resources for developers using Nexmo API platforms

Home Page:https://developer.nexmo.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nexmo Developer

Contributions · Testing · Running Locally · Admin Dashboard · Troubleshooting

This repository is the code and content for https://developer.nexmo.com, which includes the Nexmo documentation, API reference, SDKs, Tools & Community content.

Contributions

We welcome contributions from everyone! Look at the Contributor Guidelines for more information, and please follow the GitHub Flow.

Testing

We use rspec to test Nexmo Developer.

To run all tests:

bundle exec rspec

To generate code coverage, set the COVERAGE environment variable when running the tests.

COVERAGE=1 bundle exec rspec

This will create a folder named coverage. Open index.html in this folder to view coverage statistics.

Running locally

The project can be run on your laptop, either directly or using Docker. These instructions have been tested for mac.

Setup for running directly on your laptop

Before you start, you will need to make sure that you have:

To set up the project, clone this project and configure your settings:

$ git clone git@github.com:Nexmo/nexmo-developer.git
$ cd nexmo-developer
$ cp .env.example .env

Edit the .env file as appropriate for your platform. Then, run the following:

$ bundle install
$ rake db:create
$ rake db:migrate
$ rake db:seed
$ ./bin/yarn install
$ rails s

You should now be able to see the site on http://localhost:3000/

Setting up with Docker

If you don't want to install Ruby & PostgreSQL then you can use docker to sandbox Nexmo Developer into its own containers. After you Install Docker run the following:

$ git clone git@github.com:Nexmo/nexmo-developer.git
$ cd nexmo-developer
$ cp .env.example .env

Edit the .env file as appropriate for your platform. Then, start the web server with this command:

$ docker-compose up

At this point, open your browser to http://localhost:3000/ ... and wait (it takes about 30 seconds for the first load).

To stop the server cleanly run:

$ docker-compose down

Admin dashboard

You can access the admin dashboard by visiting /admin. If you've populated data via rake db:seed you will have an admin user with the username of admin@nexmo.com and password of development.

The following is an example if you are running Nexmo Developer within a Docker container:

docker exec -it <container_id> rake db:seed

New admin users can be created by visiting /admin/users or by accessing the rails console and creating a new User like so:

User.create!(email: 'example@example.com', password: 'password', admin: true)

Troubleshooting

I'm having issues with my Docker container

The image may have changed, try rebuilding it with the following command:

$ docker-compose up --build

I get an exception PG::ConnectionBad - could not connect to server: Connection refused when I try to run the app.

This error indicates that PostgreSQL is not running. If you installed PostgreSQL using brew you can get information about how to start it by running:

$ brew info postgresql

Once PostgreSQL is running you'll need to create and migrate the database. See Setup for instructions.

About

Provides resources for developers using Nexmo API platforms

https://developer.nexmo.com

License:Other


Languages

Language:HTML 95.5%Language:JavaScript 2.2%Language:CSS 1.4%Language:Ruby 0.5%Language:Java 0.2%Language:C# 0.1%Language:PHP 0.1%Language:Shell 0.0%Language:Python 0.0%Language:Dockerfile 0.0%Language:ASP 0.0%Language:CoffeeScript 0.0%