To start this Phoenix application you have to:
- Create a database
PostgreSQL:
$ psql -U postgres
create role demo_app login password 'password';
create database demo_app owner demo_app encoding='UTF8' lc_collate='en_US.UTF-8' lc_ctype='en_US.UTF-8';
grant all on database demo_app to demo_app;
alter database demo_app owner to demo_app;
\q
Exercise: adapt this to MySQL.
Hint: you need to change the driver in mix.exs
and lib/demo_app/repo.ex
Google for the driver.
-
Install dependencies with
mix do deps.get, compile
-
Set the environment variables to access the database (check
lib/demo_app/repo.ex
)export DB_USER=demo_app export DB_PASSWORD=password export DB_HOST=localhost export DB_NAME=demo_app
-
Run the migrations with
mix ecto.migrate Repo
-
Seed the database with
mix run seed.exs
-
Start Phoenix router with
mix phoenix.start
-
Visit
localhost:4000
-
Login as an admin with admin@example.com / password or login as a user with user@example.com / password.
-
Follow the instructions inside the pages.
-
Fork it and make it better!
I'm working on it. See goshacmd/heroku-buildpack-elixir#13