Thanks to visit codestin.com
Credit goes to github.com

Skip to content

humeman/site-tecktip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

site-tecktip

The source code for tecktip.today, a revolutionary website which delivers the best and brightest tecknological advice directly to a web browser near you.

Why?

This website is a joke. It was initially a Discord bot named "teck tip bot" which would reply with innovative teck tips from Linus himself after hearing certain trigger words -- and eventually, when I realized .today existed as a TLD, I had to make it a website.

The joke as a whole was, I think, somewhat inspired by @LinusTechTip_ on Twitter.

It accepts submissions from anyone, and has a neat admin panel that allows for managing tips, submissions, and images.

Design

The backend is a simple Quart API written in Python and backed by a MySQL database. The frontend is built on SvelteKit and uses Tailwind.

Both of these are automatically deployed using GitHub Workflows and an Ansible playbook.

Screenshots

image The tecktip.today homepage.

image The admin panel.

image TeckGPT, a teck tip generating assistant running off of a ChatGPT fine-tuned model.

image image The site allows visitors to submit their own teck tips for review.

image Images can be uploaded by admins. Definitely don't want submissions for that one.

image Full edit logs.

Use

I'm not sure why anyone would want this... but here's how to run it:

Manual

To run the backend, set the following env vars:

  • MYSQL_HOST
  • MYSQL_USER
  • MYSQL_PASSWORD
  • MYSQL_DB
  • HYPERCORN_CERTFILE ("/etc/letsencrypt/live/{{ site_host }}/fullchain.pem")
  • HYPERCORN_KEYFILE ("/etc/letsencrypt/live/{{ site_host }}/privkey.pem")
  • PORT
  • IMAGE_URL
  • IMAGE_FOLDER
  • OPENAI_API_KEY
  • OPENAI_MODEL

Then install dependencies:

cd src_api
python3 -m venv .venv
source .venv/bin/activate
pip3 install -r requirements.txt

Then run:

python3 main.py

To get the frontend, first build it:

cd src_site
npm run build

Then start it:

SITE_HOST="some-host" API_PORT="backend-port" HOST="127.0.0.1" PORT=some-port node build/index.js

For development purposes, you can also run it with:

SITE_HOST="some-host" API_PORT="backend-port" HOST="127.0.0.1" PORT=some-port npm run dev

Ansible Playbook

Your vault needs to contain the following:

  • sql.db
  • sql.user
  • sql.password
  • site_host (ie: tecktip.today)
  • cdn_host (ie: cdn.tecktip.today)
  • site_name (nginx site name)
  • openai_key (for TeckGPT)
  • openai_model (for TeckGPT)

The server this is being deployed to must have a local MySQL instance running on it. Assuming a login is permitted with sudo mysql -uroot and no password, the database and user do not need to be created beforehand. Your server should be using Nginx. A records should exist for site_host and cdn_host.

You can then run the Ansible playbook:

ansible-playbook playbooks/main.yml

About

teck tip today!!!!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published