Today I Learned is an open-source project by the team at Hashrocket that catalogues the sharing & accumulation of knowledge as it happens day-to-day. Posts have a 200-word limit, and posting is open to any Rocketeer as well as select friends of the team. We hope you enjoy learning along with us.
This site was open-sourced as a window into our development process, as well as to allow people to experiment with the site on their own and contribute to the project.
We originally implemented Tilex as hr-til, a Ruby on Rails app.
If you are creating your own version of the site, fork the repository.
Then install the Phoenix Dependencies as well as PostgreSQL.
Next, follow these setup steps (includes database seeds):
$ git clone https://github.com/hashrocket/tilex
$ cd tilex
$ mix deps.get
$ mix ecto.setup
$ cd ./assets
$ npm install
$ cd ..
$ mix phx.server
Now you can visit localhost:4000
from your browser.
To serve the app at a different port, include the PORT
environment
variable when starting the server:
$ PORT=4444 mix phx.server
To set environmental variables, copy the example file:
$ cp .env{.example,}
Then, set your variables and source them:
$ source .env
Authentication is managed by Omniauth and Google. See the omniauth-google-oauth2 README and Google Oauth 2 docs for setup instructions. To allow users from a domain, set those configurations in your environment:
# .env
export GOOGLE_CLIENT_ID="your-key.apps.googleusercontent.com"
export GOOGLE_CLIENT_SECRET="yoursecret"
export HOSTED_DOMAIN="your-domain.com"
Once set, visit localhost:4000/admin
and log
in with an email address from your permitted domain.
Tilex creates a new user on the first authentication, and then finds that same user on subsequent authentications.
Wallaby relies on ChromeDriver; install it (OSX):
$ brew install chromedriver
Run the tests with:
$ mix test
These are the Tilex deployed instances:
- Staging: https://tilex-staging.herokuapp.com
- Production: https://til.hashrocket.com
Database migrations require telling Heroku how many pools to use. Here's an example:
$ heroku run "POOL_SIZE=2 mix ecto.migrate"
Please see CONTRIBUTING for more information.
This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct. Please see CODE OF CONDUCT for more information.
We love seeing forks of Today I Learned in production! Please consult USAGE for guidelines on appropriate styling and attribution.
Tilex is released under the MIT License. Please see LICENSE for more information.
Tilex is supported by the team at Hashrocket, a multidisciplinary design and development consultancy. If you'd like to work with us or join our team, don't hesitate to get in touch.