Skip to content

wezm/read-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Read Rust

Source code to readrust.net. A news aggregator for Rust news.

Build Status

Contributing

Check out the Submission page on the website for info on submitting a post.

Development

First up: I'm sorry.

I'm aware this involves a lot of dependencies. I had started building this version of the site in Rust but paused that effort as at Oct 2019 the web and async state of Rust was very much in flux. I picked Lucky because it was a batteries included web framework backed by an ergonomic, statically typed language that did not require a large runtime. In some parts I'm still using Rust since I already had the code/it was easier for me. Eventually I hope to shift to an all Rust code base but today is not that day.

My development environment for the site is Arch Linux and it generally makes the experience straightforward. The instructions below are for Arch, adjust accordingly for other systems.

Prerequisites

  • Crystal 0.31.1
  • Lucky CLI
    • node and yarn (for assets)
    • overmind (process runner to make development nicer)
  • Diesel CLI — install with cargo install diesel_cli --no-default-features --features postgres
  • Rust >= 1.38.0
  • PostgreSQL (9, 10, or 11 should be fine. I develop on 11, CI runs 9)
  • Chromium (for running [flow tests])

The package list on Arch is something like this.

rustup crystal shards nodejs yarn postgresql postgresql-libs chromium gcc pkgconf sudo make

Plus from the AUR:

Additionally, due to limitations in the Crystal compiler you need to build and install my little striptags library:

git clone https://github.com/wezm/aur
cd aur/libstriptags
makepkg -si

If you've never set up PostgreSQL before, you will need to follow the initial configuration steps. For local development with PostgreSQL it's convienient to have a role with the same name as your username:

sudo -u postgres createuser --interactive $USER
Shall the new role be a superuser? (y/n) y

Building and Running

Clone the repo if you have not done so already:

git clone https://github.com/wezm/read-rust.git
cd read-rust

Create .env file with configuration. You only need to change, DATABASE_URL and TEST_DATABASE_URL to match the user your created above.

cp .env.sample .env
$EDITOR .env

Set up the database and asset pipeline (only need to do this once):

diesel database setup --locked-schema --migration-dir rust/migrations
cd crystal
yarn install
yarn dev
shards install

Run the development server:

lucky dev

After it compiles the site should now be accessible at: http://127.0.0.1:3001/

Notes

These are mostly notes to self (wezm).

Importing From Version 1

cd crystal
lucky import_posts ../content/_data/rust/posts.json ../content/_data/{tweeted,tooted}.json
lucky import_creators ../content/_data/creators.yaml

Resize Avatars

cd content/images/u
convert *.png *.jpg -set filename:name '%t' -resize 100\> -quality 60 'thumb/%[filename:name].jpg'

Updating OPML

Download subscriptions from Feedbin, then:

./script/opml2json ~/Downloads/subscriptions.xml > content/_data/rust/blogs.json
make
xmllint public/rust-blogs.opml

Some manual tweaks to the JSON might be needed.

About

Read Rust allows you to keep up with articles about the Rust programming language.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published