Spike, see: https://www.pivotaltracker.com/n/projects/1519297
Before trying to run this web server, you need to do a few administrative steps with github.com to set up proper credentials.
Before trying to start this web server, you need to create GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET credentials. You will need these later when you create your .env file.
Note that the .env file is NOT saved to github, since it contains secret information. To do that, take these steps:
- Open this page in a new tab or window (keep this page of instructions open): https://github.com/settings/developers
- Click "register an application".
- Fill it in similar to the picture below
- The callback URL should be http://localhost:3000/users/auth/github/callback
To run this web server:
- Fork and/or clone this repo
- Ensure you have
postgresql
installed and running on localhost - Execute
bundle install
- If you have a problem installing
pg
, try runningsudo env ARCHFLAGS='-arch x86_64' gem install pg
- Create a file called
.env
in the project root,
- You can run
cp .env.example .env
- Populate the
GITHUB_CLIENT_ID
andGITHUB_CLIENT_SECRET
with your own Github App configurations (see instructions earlier in this README.md)
- If you are running this for the first time, run
rake db:create
- Execute
rake db:migrate
- Execute
rails s
- The rails server should now be running on http://localhost:3000
To set initial admin:
- First, sign into your application at http://localhost:3000
- On the command line in your project root, you can run
rake super_admin:help
to show all super_admin instructions
169-231-82-184:anacapa-github-prototype johndoe$ rake super_admin:help
to list all users rake super_admin:list_users
to list all admins rake super_admin:list_admins
to list all non-admins rake super_admin:list_non_admins
to make a user an admin rake super_admin:grant_admin_permission[< user's id >]
to revoke admin privleges rake super_admin:revoke_admin_permission[< user's id >]
- To make yourself an admin, first find yourself by running
rake super_admin:list_users
169-231-82-184:anacapa-github-prototype johndoe$ rake super_admin:list_users
+---------------------+----------+----+----------+
| email | name | id | is_admin |
+---------------------+----------+----+----------+
| [email protected] | John Doe | 1 | false |
+---------------------+----------+----+----------+
1 row in set
For syntax of how to grant or revoke admin privs, type rake super_admin:help
- Find the
id
corresponding to your user and runrake super_admin:grant_admin_permission[<what you found>]
169-231-82-184:anacapa-github-prototype johndoe$ rake super_admin:grant_admin_permission[1]
+---------------------+----------+----+----------+
| email | name | id | is_admin |
+---------------------+----------+----+----------+
| [email protected] | John Doe | 1 | true |
+---------------------+----------+----+----------+
1 row in set
169-231-82-184:anacapa-github-prototype johndoe$
- You should now see a link to "Admin Panel" when you sign in to your website.
If you have a postgres database console prompt:
\l
to list databases\dt
to list tables in current database\connect
database-name to change database