~travisshears/micro_blog_repo

A elixir app to store my bluesky and pleroma posts
502c434d — Travis Shears 8 months ago
create posts gql resolver
c4569740 — Travis Shears 8 months ago
move api auth to middleware
dc240ac3 — Travis Shears 8 months ago
use jwt to secure graphql

refs

main
browse  log 

clone

read-only
https://git.sr.ht/~travisshears/micro_blog_repo
read/write
git@git.sr.ht:~travisshears/micro_blog_repo

You can also use your local clone with git send-email.

#MicroBlogRepo

An application to store and make my micro blog posts (tweets, toots, skeets) from various source available for other personal projects.

Currently supports:

  • Bluesky via Bluesky API
  • Pleroma via Pleroma API

#Tech

App: Elixir app built with:

I opted out of using Phoenix to keep things small and simple.

Database: internal sqlite

#Version control

I'm using this project to experiment with Jujutsu version control, following this guide.

#Dev

Run app locally.

MIX_ENV=dev iex -S mix run --no-halt
iex> MicroBlogRepo.BlueSky.refresh_posts
iex> r(MicroBlogRepo.BlueSky)
iex> recompile

#Deploying

I'm currently hosting my app on fly.io. I like the ease of setup.

fly launch
fly volumes create micro_blog_db --region ams --size 1
fly deploy

#Testing the Docker container locally

If I'm changing something with how the app runs, I like to first test the container locally with:

$ docker build -t micro_blog_repo:latest .
$ docker run --name micro_blog --rm -p 4001:4001 micro_blog_repo:latest

#Running commands on the production container

One of the cool things about Elixir is you can tap into the running program and run functions. Currently the only way to create a user and add credentials is via this workflow.

$local fly ssh console
$remote ./.bin/micro_blog_repo remote
$remote_app 
root@xxxxxxxxxxxxxx:/app# ./bin/micro_blog_repo remote
Erlang/OTP 26 [erts-14.2.2] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1] [jit:ns]
Interactive Elixir (1.16.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(micro_blog_repo@xxxxxxxxxxxxxx)1> 
iex(micro_blog_repo@xxxxxxxxxxxxxx)1> MicroBlogRepo.Repo.insert(%MicroBlogRepo.User{username: "bob"})

#Run tests

mix test

#Powered by

This app is built with the following open source software