Giter VIP home page Giter VIP logo

trapscan-backend's Introduction

TrapScan Backend

Setup

TrapScan backend uses Laravel 8.

You can setup a dev environment using Docker with Laravel Sail.

1. Install Docker
  • Install instructions can be found on the docker website: https://www.docker.com/products/docker-desktop
  • Start the Docker Desktop program
  • Go through their setup to ensure it's working correctly
  • You don't need a docker desktop account ( You can skip the last step )
Note: You may need to enable visualisation in your bios

https://www.virtualmetric.com/blog/how-to-enable-hardware-virtualization

Note: You may also need to install WSL2

https://aka.ms/wslkernel

Restart Docker Desktop once the linux kernel is installed

Link Docker and WSL2

https://docs.docker.com/desktop/windows/wsl/

2. Clone Repo
  • SSH: git clone [email protected]:KurtisPapple/TrapScan-Backend.git
  • HTTP:git clone https://github.com/KurtisPapple/TrapScan-Backend.git

If you're struggling with this you can try use the GitHub Desktop program https://desktop.github.com/

Or clone the repo through VSCode

Note: Modify .env file
  • Copy the .env.example file to .env
  • Update values for your local instance
3. Install PHP & Composer (Windows)
4. Install PHP & Composer (WSL2)
  • Install WSL2 if you haven't (https://aka.ms/wslkernel)
  • Open Windows Terminal in your WSL tab (Ctrl + Shift + 3)
  • Setup Git SSH Keys
  • ssh-keygen
  • cat ~/.ssh/id_rsa.pub
  • Copy this output
  • Open your Profile settings in GitHub (where you'd change your password)
  • SSH Keys tab
  • New SSH Key
  • Paste in your key and give it a title
  • sudo apt-get update
  • Reclone the repo inside WSL
  • sudo apt install php
  • sudo apt install unzip
  • Install PHP extensions. This depends on the version of PHP you installed. The following packages are needed for PHP8
  • sudo apt install php8.0-gd php8.0-dom php8.0mbstring
  • Verify the install with php --version
  • Install composer with Command-line installation ( https://getcomposer.org/ )
  • Verify the install with composer --verion
  • Setup docker for use with WSL (https://stackoverflow.com/questions/61592709/docker-not-running-on-ubuntu-wsl-cannot-connect-to-the-docker-daemon-at-unix)
3. Run Laravel Sail

https://laravel.com/docs/8.x/sail

You may need to restart docker (from your toolbar, clicking the X doesn't close it)
4. Run Migration and Seeders
  • Edit ~/.bashrc to add the sail alias
  • nano ~/.bashrc
  • Add alias sail='bash vendor/bin/sail' into this file
  • source ~/.bashrc sail artisan migrate:fresh --seed
5. Running

http://localhost will be the main app http://localhost:8090 has a phpmyadmin instance (credentials can be found in your .env)

Loading Production Data

You can load data from any TrapNZ projects you have access to by suppliing your username and password in your .env GET http://localhost/scrape

TRAP_NZ_USERNAME=your-user-name
TRAP_NZ_PASSWORD=your-password

This will pull all traps and projects you have access to. It will not grab notes or trapline data

To get this additional data you'll need to download the csv trap reports from TrapScan and post the file to the upload route. Field name "file" is expected. There's a very loose Postman collection available through Dylan or Kurtis. POST http://localhost/scrape/upload Headings expected: "Project","ID","Trap line","Trap type","Trap sub type","Date installed","Retired","Sensor ID","Sensor provider","Status","Total kills","Lat","Lon","Notes"

Learning Laravel

Laravel has the most extensive and thorough documentation and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.

If you don't feel like reading, Laracasts can help. Laracasts contains over 1500 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.

trapscan-backend's People

Contributors

dylanhobbs avatar dylan-hobbs avatar kurtispapple avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.