Skip to content
This repository has been archived by the owner on May 13, 2018. It is now read-only.

Latest commit

 

History

History
138 lines (107 loc) · 4.86 KB

README.md

File metadata and controls

138 lines (107 loc) · 4.86 KB

RecruitxBackend

This project has been moved into Labs and if you want to contribute, you can go to Labs on the cloud from OKTA and you can get the access to the repo and CI

Dev Setup

Erlang and Elixir

Using asdf Package Manager

  • Install asdf (the package manager) that will be used to handle multiple versions of erlang and elixir.

Note: brew installation is not working as expected :(

rm -rf ~/.asdf && git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.3.0

# if you are using bash
echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bash_profile
echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.bash_profile

# if you are using zsh
echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.zshrc
echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.zshrc
  • Use ~/.tool-versions file to specify the version of elixir and erlang needs to used system level. asdf can be used to setup project specific tool versions also (please refer this)

brew install autoconf , if autoconf is not present already.

echo "elixir 1.5.2" >> ~/.tool-versions
echo "erlang 20.2" >> ~/.tool-versions
  • Install
asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang.git
asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git
asdf install

Note: The versions of tools installed can be found in .asdf/installs/

Checking Installation

  • To check the erlang version execute:

    erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().'  -noshell

    You should get "20" as the output.

  • To check the elixir version execute:

    elixir -v

    You should get "Elixir 1.5.2" as the output.

Postgres

  • Download and install Postgress App from here.

  • Add Postgres binaries to PATH

  # if using bash
  echo "export POSTGRES_PATH=\"/Applications/Postgres.app/Contents/Versions/latest\"" >> ~/.bash_profile
  echo "export PATH=\$PATH:\$POSTGRES_PATH/bin" >> ~/.bash_profile
  # if using zsh
  echo "export POSTGRES_PATH=\"/Applications/Postgres.app/Contents/Versions/latest\"" >> ~/.zshrc
  echo "export PATH=\$PATH:\$POSTGRES_PATH/bin" >> ~/.zshrc
  • Create default user
createuser -s postgres
  • Once this is present, create a user with the correct role/permissions using the following psql invocation:
psql -U postgres -c "CREATE ROLE \"recruitx\" LOGIN CREATEDB;"

Other Dependencies

You have to set following environment variables

export API_KEY="your api key"
export AWS_DOWNLOAD_URL="download url"
export AWS_BUCKET="recruitx-feedback-image"

export AWS_ACCESS_KEY_ID="AWS_ACCESS_KEY"
export AWS_SECRET_ACCESS_KEY="AWS_SECRET_ACCESS"
export JIGSAW_URL="JIGSAW_URL"
export JIGSAW_TOKEN="JIGSAW_TOKEN"

export SMTP_PORT="smtp port"
export DEFAULT_FROM_EMAIL_ADDRESS="Your email address"

## Space separated list of Email addresses ##
export DEFAULT_TO_EMAIL_ADDRESSES="email addresses"
export CONSOLIDATED_FEEDBACK_RECIPIENT_EMAIL_ADDRESSES="email addressess"
export WEEKLY_SIGNUP_REMINDER_RECIPIENT_EMAIL_ADDRESSES="email addressess"
export WEEKLY_STATUS_UPDATE_RECIPIENT_EMAIL_ADDRESSES="email addresses"
export TW_CHENNAI_EMAIL_ADDRESS="email addresses"
export QR_CODE_URL="QR_CODE_URL"
export APK_URL="APK_URL"
export LOGO_URL="LOGO_URL"

export OKTA_PREVIEW="OKTA_PREVIEW"
export OKTA_API_KEY="API_KEY"

export MONTHLY_STATUS_UPDATE_RECIPIENT_EMAIL_ADDRESSES="email address"
export QUARTERLY_STATUS_UPDATE_RECIPIENT_EMAIL_ADDRESSES="email address"

export MONTHLY_STATUS_UPDATE_RECIPIENT_EMAIL_ADDRESSES="email address"
export QUARTERLY_STATUS_UPDATE_RECIPIENT_EMAIL_ADDRESSES="email address"

export EMAIL_POSTFIX="@company.com"

To start your Phoenix app:

  • Install dependencies with mix deps.get
  • Create, migrate and seed your database with mix ecto.setup
  • Drop, Create, migrate and seed your database with mix ecto.reset
  • Seed the database with mix ecto.seed
  • Start Phoenix endpoint with mix phoenix.server. Now you can visit localhost:4000 from your browser.
  • To run whatever's necessary before committing: mix commit
  • Run all espec tests with mix coveralls.html
  • Run unit tests with mix espec --exclude integration
  • Run integration tests with mix espec spec/integration/*

Coding style

  • In general, follow these guidelines
  • Use 2 spaces instead of tabs for all indentation
  • Run the credo hex package to find issues (credo is a static code analyzer)
mix credo --strict