Skip to content

Latest commit

 

History

History
124 lines (88 loc) · 3.76 KB

development.md

File metadata and controls

124 lines (88 loc) · 3.76 KB

Setup the development environment

For now, the development environment is managed with Docker by default. This is to avoid installing the dependencies at a system level and to avoid (or at least to reduce) issues with people not being able to setup the environment (i.e. everyone run the same configured environment with the same dependencies). If you don’t want to use Docker, I provide some information below to help you to get started, but please don’t expect I’ll be able to help you: you know your own setup better than me.

In both cases, you’ll need to download flusio with Git:

$ git clone --recurse-submodules https://github.com/flusio/flusio.git
$ cd flusio

With Docker

First, make sure to install Docker and Docker Compose.

Then, install the dependencies with:

$ make install

This command will run the composer and npm install commands to download the PHP and JS dependencies.

Once this is done, you should start the webserver and the database:

$ make start

This command calls docker-compose with the file under the docker/ folder. The first time you call it, it will download the Docker images and build the php one with the information from the docker/Dockerfile.php file.

The last step is to setup the environment with:

$ make setup

It will copy the env.sample file to .env and call the flusio CLI to configure the database. If you need to, you can change the environment variables in the .env file. The SMTP_ variables should be set to be used with an existing email account.

Now, you should be able to access flusio at localhost:8000.

The containers can be stopped and cleaned with:

$ make stop

Most of the time, you can settle for CTRL + C (the Docker network and containers aren’t deleted this way).

Without Docker

Here are some indicators if you’re not using Docker.

First, make sure you have PHP 7.3+, Node 14 and a running PostgreSQL 12 with a user being able to create and drop a database. You also must install the PHP composer dependency manager.

You might want to configure browscap. This allows to detect the browser and the platform of a user correctly in order to identify a session. Without browscap, all the sessions will be identified as “Unknown browser on unknown platform”. You’ll have to place the docker/lite_php_browscap.ini file somewhere on your filesystem and set the browscap path to this file in your php.ini file (see an example). If you need an up-to-date browscap.ini file, you can download one on browscap.org.

Then, create and edit the .env file:

$ cp env.sample .env
$ vim .env # or whatever text editor you use

The most important section is the DB_* configuration. You can verify the access to your database with:

$ php ./cli --request /database/status
Database status: OK

If the status is not “OK”, you should fix the error that is shown.

You should now install the dependencies and setup the database with:

$ export NO_DOCKER=true # tell the `make` commands to use native commands
$ make install
$ make setup

You’re all good now, just start a PHP development server:

$ php -t public/ -S localhost:8000 public/index.php

Then start the job worker in a different console:

$ php ./cli --request /jobs/watch

And Parcel in another console:

$ npm run watch

You can finally access flusio at localhost:8000.