Installation
Step by step instructions about how to install and run the Manager API on your machine.
Requirements
Before proceeding with the installation, you should make sure the following requirements are installed on your machine:
Git
Docker
MySQL
Cloning the repository
The first step is to clone the repository via HTTPS or SSH.
git clone [email protected]:venuzle/venuzle-manager-api.git
Install Composer dependencies and create the .env file
Move to the directory in which the project was cloned
cd venuzle-manager-api
Install the Composer dependencies
sudo docker-compose run --rm -w /var/www/html/venuzle-manager-api app composer install
Create the .env file
sudo docker-compose run --rm -w /var/www/html/venuzle-manager-api app cp .env.example .env
Generate the application key
Each Laravel application must have a secret key that is used to encrypt and decrypt passwords, cookies, etc. Generate one by running the following command:
sudo docker-compose run --rm -w /var/www/html/venuzle-manager-api app php artisan key:generate
Create the Database and add the details to the .env file
The Manager API is built around a central database and one separate database for each partner. You only need to create the central database. The default name should be manager
but you are free to choose any name you want. Run the following command from the MySQL command line (or your MySQL client) to create the database:
create database manager;
Next, open the .env
file and replace the database details with your valid details.
MANAGER_DB_HOST=host.docker.internal
MANAGER_DB_PORT=3306
MANAGER_DB_DATABASE=manager
MANAGER_DB_USERNAME=root
MANAGER_DB_PASSWORD=secret
Set the session driver
The API is using Laravel Sanctum for authentication which requires a cookie session driver. Open the .env
file and change the session driver:
SESSION_DRIVER=cookie
Running the migrations
At this point, if the database details are ok, you should be able to run the migrations. To do so, execute the following command:
sudo docker-compose run --rm -w /var/www/html/venuzle-manager-api app php artisan migrate --path=database/migrations/manager
This will create all the required tables in the main database.
Starting and stopping the container
In order to have the API running, you must start the container. To do so, run:
sudo docker-compose up -d
In order to stop the container, run:
sudo docker-compose down
Port binding
By default, the docker container binds the port 80
on your machine. This means that you can access the API by using the URL localhost:80
. Often, this port is already taken by something else (the frontend instance for example). In order to solve the problem, from the docker-compose.yml
file you can bind any port you want. As an example, let's bind the port 8084
(line 13)
version: '2'
services:
app:
build:
context: ./docker/app
dockerfile: Dockerfile
image: manager.venuzle.com/app
restart: always
volumes:
- .:/var/www/html/venuzle-manager-api:cached
- ./storage/logs/nginx:/var/log/nginx:cached
ports:
- "8084:80" # port is binded here
networks:
- sdnet
networks:
sdnet:
driver: "bridge"
After that change, you are able to access the API via the URL localhost:8084
Last updated
Was this helpful?