Development environment

This section aims to guide a developer to build up a sample application and the intrasheets server using Docker in 5 minutes.

Introduction

It is essential to remember that Intrasheets and the application are two separate entities, and you can integrate withany application.

The code you will download implements a basic PHP application with authentication, build up the Intrasheets server, and integrates the sample application with Intrasheets. You can use the application provided to build understanding and help integrate Intrasheets into your application later.

Requirements

  • Docker

Cookbook

Following the cookbook below, you should be able to have Intrasheets running on your browser in a few minutes.


1. Clone the sample project

The first step is to clone the following project from github. After that, please open the terminal in the project folder.
% git clone https://github.com/intrasheets/app.git intrasheets
% cd intrasheets


2. Setup the environment configuration

As explained above, this project implements a basic application with authentication, builds the Intrasheets service, and integrates both. In this project, you must update the .env file in both applications and the Intrasheets server.

We have a sample file available, so you can rename and update the configuration in both files as below.
// Create the .env file and update its configuration
% mv .env-sample .env

// Create the .env file and update its configuration
% mv resources/docker/sheets/.env-sample resources/docker/sheets/.env
When editing your files, it is crucial to bear in mind the following:
  • Use the same LICENSE in both files. That can be downloaded from your intrasheets.com profile.
  • Use the same BOSSANOVA_JWT_SECRET in both files.
  • The AWS S3 is mandatory for image uploading and history management.


3. Install Intrasheets service dependencies

The next step is to install the dependencies of the Intrasheets service as below
% cd resources/docker/sheets
% npm install


4. Build and run the docker containers

Now you can return to the project root folder and build up docker.
% docker-compose up


5. To install the sample database

To simplify this sample project, we only have one database for Intrasheets and applications. That probably won't happen when you have an application in production. On a new terminal in the project too folder and execute the following commands:

// Connect to the database container
% docker-compose exec postgresql bash

// Open the database console
/var/www/html# psql -U postgres

// Create the intrasheets database
postgres=# CREATE DATABASE intrasheets;

// Create the application database
postgres=# CREATE DATABASE application;

// Exit the database console
postgres=# \q

// Recovery the Intrasheets tables
/var/www/html# psql -U postgres intrasheets < resources/intrasheets.sql

// Recovery the Application tables
/var/www/html# psql -U postgres application < resources/application.sql

// Exit the database container
/var/www/html# exit


6. To install the dependencies for the sample application.

To install the dependencies for the sample application will need to connect to the PHP container and run the composer.

// Connect to the PHP container
% docker-compose exec php bash

// Install the dependencies
/var/www/html# composer install

// Exit the terminal
/var/www/html# exit


7. Create a new user

Now you can go to the browser and create a new user.
// Open the following URL in the browser
http://localhost:8000
Now click to register a new user and fill out the form.


8. Get the registration email

The registration email will be intercepted and won't reach your email account. To get the registration email you need to use the MAILHOG webmail.
// Open the following URL in the browser
http://localhost:8021
Now you can click on the link and start using it. Have fun!



Common Questions

1) How to run the application in the browser?
http://localhost:8000

2) How to run the database in the browser? That is useful for you to be able to update something in the database, backups, etc.
http://localhost:8035
// Create a server to:
pathname: postgresql
username: postgres
password: postgres

3) How to run the demo webmail in the browser? It intercepts any email for debugging purposes.
http://localhost:8021