Quick Installation Using Docker

Prerequisite Knowledge

This installation guide is simple enough. Even if you have just the basic knowledge of how to browse web and use computers that is sufficient. There are things which you may need to learn but you can learn them easily.

If you dont know anything about docker and cloud hosting dont worry. Just follow our stepwise procedure and you will get through.

If you are completely new to Cloud hosting then you can learn it in just few minutes with these simple tutorials.

https://www.digitalocean.com/docs/droplets/how-to/create/
https://www.digitalocean.com/docs/droplets/how-to/connect-with-ssh/

We assume some familiarity with Ubuntu terminal commands and cloud hosting. If you completely new to this you can follow tutorials like these

http://www.linuxandubuntu.com/home/10-basic-linux-commands-that-every-linux-newbies-should-remember

Steps for Installation

Step 1: Install docker and docker compose
Step 2: Download Docker file and run it
Step 3 : Assign a Domain name
Step 4 : Enter container and update instance configuration
Step 5 : Publish your app on Google Play (Optional)
Step 6 : Submit your market to Nearby Shops (Optional)
Step 7 : Login as admin and update Market Configuration

We have already tested this guide on Digital Ocean One-Click Docker Image. So For simplicity and ease of Installation we recommend Digital Ocean. To get started you can create a new Droplet using One Click Docker Image given here https://marketplace.digitalocean.com/apps/docker This image comes with Docker preinstalled. So you dont have to install docker manually.

Please Note : We recommend Digital Ocean for simplicity but you can use any other cloud hosting platform. We are assuming that you are installing on a ubuntu based cloud server with an IP address & internet access.

Step 1: Install docker and docker compose

If you already have docker preinstalled then you can skip this step.

If you dont have latest version of docker and docker compose please install them using the following official installation guides.

Install the latest version of docker using this link https://docs.docker.com/install/linux/docker-ce/ubuntu/
Install the latest version of docker Compose using this link https://docs.docker.com/compose/install/

Step 2: Download Docker Compose file and run it

Download the docker compose file and run it.

                     Commands
                  
    cd ~
    mkdir nearbyshops
    cd nearbyshops

    wget https://raw.githubusercontent.com/NearbyShops/Nearby-Shops-Android-app/master/docker-compose.yml

    docker-compose up

    (Exit container using Ctrl + C or Ctrl + Z  ... If nothing works close the terminal window & start a new terminal)
      
                

This is optional. You can also edit the docker-compose.yml file and change the settings like port number, container name to suit your needs.

                    Optional Commands
                  
    sudo nano docker-compose.yml
                
                

Verify Successful Execution : In order to verify and test that we have a successful connection to the Api Server. We will test the endpoints to see if we get any result.

Before testing the endpoints please ensure that your container is running.

                    Terminal Commands
                  

    docker-compose start
    (please ensure that you are inside the directory where docker-compose.yml resides)

    OR 

    docker start nbs_api_container     
                
                

The url for the endpoint is
[IP:port]/api/ServiceConfiguration
Replace the IP and port number according to your installation. For example if your IP address is 139.59.81.21 and port number is 80 you can type some like 139.59.81.21/api/ServiceConfiguration in URL of Firefox browser. When you execute this url in your firefox browser you should see some text json output.
Having the output verifies successful execution.

Step 3 : Assign a Domain name

Well if you dont have a domain address you can use IP:Port in place of domain name. But we recommend using a domain name in Production Setup.

IP addresses can change and are not stable. For stable and long term access to your instance it is always a good idea to assign a domain name to your server. Based on the hosting provider you are using you have to follow their respective methods.

If you are completely new to clould hosting and dont know how to assign a domain name. Then follow these tutorials https://www.youtube.com/watch?v=7itQ-AXiM5o

https://www.digitalocean.com/community/tutorials/how-to-point-to-digitalocean-nameservers-from-common-domain-registrars

Step 4 : Enter container and update instance configuration

You need to change few api configuration settings like domain name & admin email to ensure that you are able to access your market Instance.

Enter your container and update api configuration.

                     Commands
                  

    docker-compose start
    (please ensure that you are inside the directory where docker-compose.yml resides)

    OR 

    docker start nbs_api_container 
    


    docker exec -it nbs_api_container bash

    cd ~/nearbyshops/data 
    
    sudo nano api_config.properties

    (Save and Exit using Ctrl + X)
    (Exit container using Ctrl + C or Ctrl + D)
                
                

Things to Update

  • Admin Email
  • Domain Name
  • Market ID for FCM
  • admin_email is the field name. Admin email is the email of the market admin. Without providing this you wont be able to access your market and change settings.

    domain_name is the field name and you need to set this equal to your domain name

    market_id_for_fcm is the field name. It should be some unique id that uniquely identifies your market. It is used to enable push notifications.

    Setup Email and SMS (Can be skipped and Done later also) Email and SMS are required for sending live order status updates to the customers. They are also used for login purposes. The Email and SMS setup instructions are provided in our Integrations guide.

    You can skip Email and SMS setup and do this later also.

    Everytime you make a change in the configuration file you need to restart the server in order to ensure that changes are reflected.

                        Commands : Restart Container
                      
    
        docker-compose restart
        (please ensure that you are inside the directory where docker-compose.yml resides)
    
        OR
      
        docker stop nbs_api_container
    
        docker start nbs_api_container
    
                    
                    

    Step 5 : Publish your app on Google Play (Optional)

    You can customize our android app (White Label Solution) and connect the app to your Instance and publish to the Google Play. This is optional and isnt mandatory.

    More information about how to customize your app and publish on Google Play is given in the article Customize apps.

    Step 6 : Link your market to Local Market Aggregators (Optional)

    This is optional and isnt mandatory.

    You can link your website to Google and Bing to gain extra traffic for your website. Similarly you can link your market to various local market Aggregators and gain free extra traffic (customers) to your app.

    Nearby Shops is a Nonprofit Local Market Aggregator. Which means that you will never be charged any Commission and Marketing fee for linking to Nearby Shops. You can link to other Local Market Aggregators also.

    To link your instance to Nearby Shops please ensure that your instance api_config.properties file has the following field. If you do not want to link to Nearby Shops for privacy reasons that is totally fine in that case you can do it by removing the url part of string given below. Please remove only the url part and dont remove "trusted_market_aggregators = " . Removing the field name would crash the app.

                           Code 
                        
                            trusted_market_aggregators = http://sds.nearbyshops.org
                        
                        


    You can also convert your app into a Local Market Aggregator if you run your app in the multi-market Mode. If you're interested please get in touch !

    Step 7 : Login as admin and update Market Configuration

    Remember the email that you assigned as admin email in the configuration file. You will use this email to login to your own custom app or the nearby shops app.

    In Case you have your custom app ready follow these instructions.

    After login go the the profile screen and you would see Admin Dashboard in Profile screen. In your admin dashboard you will see Market Configuration. Enter that screen. Set all the fields appropriately & save the settings.

    In case you dont have your own custom app. And your Local Market is linked to Nearby Shops.

    Download Nearby Shops android app from Google Play and Please change your location to Bali, Indonesia. Your newly setup market name could be Daily Essentials in Bali, Indonesia.

    After login please select your market and you should be able to see Admin Dashboard in Markets screen. In your admin dashboard you will see Market Configuration. Enter that screen. Set all the fields appropriately & save the settings.

    Follow our tutorials to Learn more !

    To learn more about how to add vendors and use nearby shops. Please follow our tutorials given at this link https://blog.nearbyshops.org/tag/tutorials/

    Facing difficulty in understanding anything ? ... let us help you ! If you have any questions and queries do not hesitate to get in touch with us on our forum