Sign inSign up

realworldio/floralapi

By realworldio

Updated about 5 years ago

Image
0

826

realworldio/floralapi repository overview

floralapi

https://floralwebshop.com is one of the largest foral eCommerce website in UAE, hosting thousands of listings of foral for sale.

floralapi is simple web scraper interface to acquire the listing of florals from the website and package it as a JSON api endpoint.

Installation and execution

Option 1 - Use Docker

By using Docker, the installation and upgrading to a new version will be easier and will ensure that working code is always shipped. Also, there will be no need for you to setup supervisor or daemon manager for auto starting and restarting the application whenever the server restarts.

YouTube video about Docker and Docker Compose: https://youtu.be/DX1T-PKHKhg

Please note, you don't have to pull the code if you're using Docker.

Installing Docker and Docker Compose
sudo apt install docker -y
sudo apt install docker-compose -y

Follow this guide to install docker-compose: https://phoenixnap.com/kb/install-docker-compose-ubuntu

Running the code

Once you have Docker and Docker Compose installed. Run the following command. Create a compose file, docker-compose.yml.

version: '3.3'

services:
  web:
    image: realworldio/floralapi
    restart: always
    volumes: ["./data/:/usr/src/app/data"]
    environment:
      - FLORAL_APP_USERNAME=<username>
      - FLORAL_APP_PASSWORD=<password>
    ports:
      - 8080:8080

Afterwards, run the following command:

docker-compose up -d

You should now be able to access the API endpoint on port 8080.

Environmental Variables

Required Environmental Variables
  • FLORAL_APP_USERNAME
  • FLORAL_APP_PASSWORD
Optional Environmental Variables
  • SERVER_PORT
  • SERVER_TIMEOUT
Option 2 - Use Node

Using this method, you will need to pull the source code and have both node and npm insalled.

Installing Node and NPM
sudo apt install node npm -y
Setting the environment variables

You will need to set the following environment variables:

  • FLORAL_APP_USERNAME
  • FLORAL_APP_PASSWORD

Make sure you add these in your .bashrc for persistency.

Installing and Running the software
npm install
npm start

Note, you will need to user superviosr or some kind of process manager to auto-run and manage the application in the background as a daemon.

Tag summary

Content type

Image

Digest

Size

574.9 MB

Last updated

about 5 years ago

docker pull realworldio/floralapi