Coder Social home page Coder Social logo

itsfza / holoapi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from holofans/holoapi

0.0 0.0 0.0 1.26 MB

Platform to serve Hololive content to the community tools.

License: GNU General Public License v3.0

JavaScript 95.76% Dockerfile 0.29% Shell 0.76% HTML 3.19%

holoapi's Introduction

HoloFans API

Deploy to production

Platform to serve Hololive information to community tools

Development

  • Requirements
    • Optional, you can just run Postgres locally. docker and docker-compose to run Postgres and PGAdmin4.
  • Have a gcp-key.json on project root
    • You may get this from your GCP Project, under credentials
      • Create Service Account
      • Create JSON key file. Rename it to gcp-key.json. Store it safely since it cannot be re-downloaded.
  • Copy .env.example into .env
    • Change values for your environment
  • Change values in ecosystem.config.js for your environment
  • Execute docker-compose up or npm start on root
    • API is then accessible through http://localhost:2434/

Applications

Client API

Crawler: YouTube

Note that cron format used here is:

 *    *    *    *    *    *
 ┬    ┬    ┬    ┬    ┬    ┬
 │    │    │    │    │    │
 │    │    │    │    │    └ day of week (0 - 7) (0 or 7 is Sun)
 │    │    │    │    └───── month (1 - 12)
 │    │    │    └────────── day of month (1 - 31)
 │    │    └─────────────── hour (0 - 23)
 │    └──────────────────── minute (0 - 59)
 └───────────────────────── second (0 - 59, OPTIONAL)

Crawler: BiliBili

Production Deployment

Set up deployment of holotools-api by using the following deployment methods:

Digital Ocean

Setting up a dev user account

# Add user to run DB under
$  adduser holotools
$  usermod -aG sudo holotools

# Have SSH keys synced
$  rsync --archive --chown=holotools:holotools ~/.ssh /home/holotools

Setting up postgresql

$  sudo apt update && sudo apt install postgresql postgresql-contrib
$  sudo -i -u postgres

#  Create a new user in postgres with same username as the dev user (holotools):
$  createuser --interactive

#  Set it up with the holotools user.
$  createdb holotools

Now you have holotools user which can modify holotools database without pg auth.

For testing connections from outside, modify the pg_hba.conf for your postgres install:

host    all             all             127.0.0.1/32            trust

change the pg_hba.conf for localhost (127.0.0.1/32) from md5 to trust to give pg permissions. This allows SSH tunneling to log in to postgres.

To connect to postgres from external: set up SSH tunnel -L 9999:localhost:5432 or, use SSH-tunnel connection option bundled with any db administration tools (tableplus, pgAdmin4). Then use holotools user to log in. No db password is needed in this setup, but don't open up the db to external or security issues may arise.

Installing Memcached: Detailed Guide

$ sudo apt install memcached libmemcached-tools

This sets up memcached service at localhost:11211, well, it's not daemonized.

holoapi's People

Contributors

sphinxrave avatar dragonjet avatar iamvisco avatar chooks22 avatar dependabot[bot] avatar justhumanz avatar ricecakess 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.