- Postgresql 9.3 - DB
- NodeJS 0.10
- Redis - Sessions
- Mandrill - E-Mail
- TravisCI - CI
The first step is to clone the PrimerPeso source code to your local computer.
Open an empty terminal window and if you have not done so already clone bizwallet by running.
git clone [email protected]:codeforamerica/primerpeso.git
Now change directory into primerpeso's source code folder.
cd primerpeso
The second step is to install the dependencies and open source libraries primerpeso uses.
Simply run this command while in the primerpeso source code folder:
npm install
For the distro stable version, run:
sudo apt-get update
sudo apt-get install nodejs
There is a naming clonfict in ubuntu for the node.js package. Run the following to create a symlink to avoid issues.
ln -s /usr/bin/nodejs /usr/bin/node
For alternate install methods, please refer here.
After it's done your project should have a new folder called node_modules.
We are using PostgreSQL as our database management system. In order to run primerpeso you need to have a local version of PostgreSQL running on your computer.
We reccommend installing postgresapp. After installing it run this line to link the database to the psql
command:
echo "export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.3/bin" >> ~/.bash_profile
We need a new terminal window for this line to take effect. Go ahead and open a new window and change directory to the primerpeso folder.
Now open the Postgresapp. (You should have a black elephant on your computer's top bar) Note: If you have the elephant on the top bar Postgres is already running Note: You have to open Postgres every time you want to run the project.
We need to initialize the database so run this command in the terminal window:
psql -f config/init.sql
Now run this command to load some sample data into the database:
psql primerpeso < config/dump.sql
Install:
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib
Log in as the 'postgres' user, that is associated with the PostgreSQL Role:
sudo -i -u postgres
Copy the file config/dump.sql to a directory such as /tmp, where the postgres user has access to. Switch to that directory.
Logged in as the 'postgres' user, you can use the pg_dump tool to load some sample data into the database:
createdb primerpeso
pg_dump primerpeso < config/dump.sql
Make sure you have Homebrew installed and run this command in a terminal window:
brew install redis
Please refer to documentation here. In summary:
Download packagage and Redis tar ball:
sudo apt-get install build-essential
sudo apt-get install tcl8.5
wget http://download.redis.io/releases/redis-2.8.9.tar.gz
In desired directory, unzip, make and install:
tar xzf redis-2.8.9.tar.gz
cd redis-2.8.9
make
sudo make install
To run:
cd utils
sudo ./install_server.sh
We use environment variables to connect to our local database and tell bizwallet to run in "Development" mode. We specify these things in a special file named ".env" (Yes, with the period):
- Create an empty file named ".env"
touch .env
- Copy the contents of ".env_example" into it
cat .env_example > .env
- If you don't know your terminal username run
whoami
to find it - Open the ".env" file in a text editor.
- Find the "DATABASE_URL" variable, change the part where it says "username" into your terminal username
We use a tool called gulp to run the project. Let's install that now.
npm install -g gulp
Finally to run the project run this command:
gulp
Your project should be available at localhost:3737
In a new terminal window, change directory into the bizwallet folder
cd path/to/folder/primerpeso
After you change directory to the PrimerPeso folder, run this command:
gulp
pg_dump bizwallet --format=c --file=db_dump_a.tar.gz --no-owner
- From Heroku =
dropdb bizwallet; heroku pg:pull DATABASE_URL bizwallet; gulp migrate
- From Dump =
dropdb bizwallet; createdb bizwallet; pg_restore db_dump_a.tar.gz --clean --dbname=bizwallet --create
Some common issues that could give you errors when you run the project, and how to solve them
- New dependencies were added (run
npm install
) - Make sure you are in the primerpeso folder (run
cd path/to/primerpeso
) - @MrMaksimize or @chrisrodz broke something (ping us to fix it)