Skip to main content

Welcome!

Welcome to the team! We're excited to have you on the team and we're looking forward to working with you. You should have received a document outling your onboarding plan.

This README goes over dev environment setup and basic system components that you need to know to complete your first ticket (referenced in your onboarding plan). Feel free to ask your onboarding buddy if you have questions about any of the following.

Development Environment Setup#

Note if you are using public dotfiles, ensure that temfiles (like atom/recovery) are included in your .gitignore file to ensure sensitive information isn't exposed publically.

Homebrew#

If not installed, install homebrew

brew install git mysql@8.0 postgresql@16 imagemagick@6 redis node rbenv v8@3.15 cmake elasticsearch@6 yarn watchman nvmbrew link --force imagemagick@6

If you're using Apple silicon:#

As of November 2021, not all software used at Thanx has native support for Apple silicon. Rosetta is an emulator that runs x86_64-compiled binaries on Apple's ARM processors.

  • Enable Rosetta on your machine: /usr/sbin/softwareupdate --install-rosetta --agree-to-license
  • Install an x86_64 version of Homebrew by prefixing the Brew installation command with arch -x86_64 (ie. arch -x86_64 /bin/bash -c "$(curl...)
  • Alias this version of Homebrew to ibrew (Intel brew) by placing the following in your rc file: alias ibrew='arch -x86_64 /usr/local/bin/brew'

Since macOS 10.15 Catalina, Apple uses zsh by default. The rc file for zsh is .zshrc which can be found in the home directory. On a brand new machine, this file might be absent and you can create one instead. touch ~/.zshrc

Elasticsearch#

Standard Installation#

To install the x86_64 version of Elasticsearch 6 using ibrew, run:

ibrew install elasticsearch@6

Alternative Installation Method#

If you encounter an error stating Error: elasticsearch@6 has been disabled because it is not supported upstream!, follow these manual installation steps:

  1. Download Elasticsearch 6.8.23 from here.
  2. Extract the tarball and place the folder in a directory of your choice.
  3. To run Elasticsearch globally, add the following to your rc file:
    # Replace /path/to/ with the actual pathexport PATH="/path/to/elasticsearch-6.8.23/bin:$PATH"

Troubleshooting Common Issues#

To debug Elasticsearch build issues, you can run it by executing elasticsearch in the terminal.

Uninstalling Incompatible Versions#

If an incompatible version (like Elasticsearch 7.*) is installed, perform these steps to revert to version 6:

brew services stop elasticsearchbrew remove elasticsearch
# Remove remaining files (NOTE: you will need to recreate lost data)rm -rf /usr/local/var/lib/elasticsearch/
# Replace <account> with your home accountrm -rf /usr/local/var/log/elasticsearch/elasticsearch_<account>.logrm -rf /usr/local/var/elasticsearch/plugins/rm -rf /usr/local/etc/elasticsearch/
# Reinstall Elasticsearch (or follow the manual method above)brew install elasticsearch@6brew services start elasticsearch@6
Configuring PATH#

To prioritize Elasticsearch 6 in your system's PATH, add the following to your rc file:

export PATH="/usr/local/opt/elasticsearch@6/bin:$PATH"
Fixing Port and Single-Node Configuration#

Adjust your local Elasticsearch configuration for the correct port and to reduce memory usage in elasticsearch.yml:

# /usr/local/etc/elasticsearch/elasticsearch.ymlhttp.port: 9200discovery.type: single-node # reduces memory use
Resolving X-Pack and Machine Learning Errors#

If encountering issues with X-Pack on non-supported platforms, add the following to your elasticsearch.yml file:

# /usr/local/etc/elasticsearch/elasticsearch.ymlxpack.ml.enabled: false
Java Configuration#

Ensure Java is correctly installed and configured:

echo $JAVA_HOME

If blank, install Java and set JAVA_HOME in your rc file accordingly. You can install using Homebrew like shown below or you can follow the step-by-step guide here. Just make sure to set the JAVA_HOME path correctly.

Brew Installation:

brew install openjdk@17
export JAVA_HOME=$(brew --prefix openjdk@17)/libexec/openjdk.jdk/Contents/Home

Example output after configuring JAVA_HOME:

❯ echo $JAVA_HOME/opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home❯ java -versionopenjdk version "17.0.11" 2024-04-16OpenJDK Runtime Environment Homebrew (build 17.0.11+0)OpenJDK 64-Bit Server VM Homebrew (build 17.0.11+0, mixed mode, sharing)For additional assistance with Java installation on macOS, refer to this step-by-step guide.

App Installs#

  • Chrome
  • Slack
  • 1Password

Optional

  • Visual Studio Code
  • iTerm2
  • Sequel Ace (MySQL database management)
  • XCode / Android Studio (mobile development)
  • GitHub Desktop (GUI for Git)
  • Docker Desktop (use the Apple silicon-specific version if needed)

Ruby#

As of this update, we are on Ruby 2.7.5. You can use either rbenv or rvm to install and manage ruby.

rbenv

rbenv initrbenv install 2.7.5# Then add the following to your rc file:echo 'eval "$(rbenv init -)"' >> ~/.zshrc # or ~/.bashrc

rvm

curl -sSL https://get.rvm.io | bash -s stablervm install ruby-2.7.5# Run: `ruby -v` in the terminal, you should see ruby 2.7.5If a different version is shown, run: `rvm use ruby-2.7.5 --default`

Additionally you'll want to install the following gems:

gem install bundler

Setting credentials for Sidekiq Enterprise:#

Here at thanx, we use sidekiq enterprise for background processing. Credentials required for installing the sidekiq-ent gem has to be set for bundler by running the following command. The credentials have been redacted and can be found in 1Password under Sidekiq Enterprise.

bundle config --global enterprise.contribsys.com xxxxxxxx:xxxxxxxx

Once you finish installing thanx-cli mentioned here. Run thanx doctor to confirm that the credentials were set successfully.

Additional Functionality#

puma-dev can be used to spin up rack servers. Follow the instructions in the README to install and setup puma-dev.

This is only required to test some of our repos which uses subdomain routing.

To work offline, you can do add 127.0.0.1 subdomain.host.tld to your /etc/hosts file.

Binstubs#

rbenv binstubs

You can use

bundle install --binstubs .bundle/bin

and have the .bundle/bin relative path at the front of your PATH.

Npm Packages#

npm install -g bowernpm install -g grunt-cli

Start Services#

The following services are used by your local environments.

brew services start mysqlbrew services start postgresqlbrew services start redis

Whitelist your IP#

In order to be able to connect via console to the Thanx platform, you'll need to add your network's IP to the platform's security groups.

  1. Determine your local IP - one option is to whatismyipaddress.com
  2. Add your IP to the Thanx IP whitelist in CIDR format "X.X.X.X/32", # Yourname Home You might already be assigned an Onboarding ticket outlining the necessary changes that needs to be made here. Please check with your reporting manager if you are unable to find the ticket.
  3. Once merged, the Terraform change will need to be applied before the security group is updated to include your IP.

Note that if your IP is not static, this may need to be updated occasionally.

Basics#

Now that the basic prerequisites are installed, you can start pulling down our repos. Set up a work folder on your computer. (Example: ~/development/thanx).

Next go to Thanx Github and fork + clone all the repos below that have had activity in the past week into that directory. Thoroughly read each repositories README, and follow the setup section to get set up.

Additional Steps#

  • Play around with the merchant dashboard to get familiar with the product. You can find the username password in 1Password. https://merchant.thanxstaging.com

  • Get familiar with Git, visit General/Git to learn more best practices.

  • Install thanx-cli on your laptop

  • Add your name and username to the thanx remotes command by cloning and branching the project, making the relevant changes to the remotes hash https://github.com/thanx/thanx-cli/blob/master/commands/remotes/root.go,and opening a pull request from your branch to main/master branch. You might already be assigned an Onboarding ticket outlining the necessary changes that needs to be made here. Check with your reporting manager if you are unable to find the ticket.

  • We rely heavily on Sidekiq for background processing. Here is a nice article that explains Sidekiq well. After looking at this, the workers in thanx-core will start to make a lot of sense.

  • Update / re-organize the notes in this repository to add any information that's missing. This will be used for future onboarding team members, so please contribute!