Skip to content

SC4S Development Setup Using PyCharm

Ryan Faircloth edited this page Jan 14, 2020 · 3 revisions

Our developers standard tools include PyCharm on MacOSX with a commercial license. This is not REQUIRED but does make for a great developer workflow. This workflow can be adapted to alternate development tools an operating systems. In particular Linux Desktops

  • Create an account on github.com
  • Create a disposable Splunk base user ID and password

Install tools

Setup local repo

  • Login to github.com and fork the repository
  • Browse to https://github.com/splunk/splunk-connect-for-syslog
  • Fork the repository by clicking “Fork” in the top right hand portion of the screen
  • Select the account to fork TO, generally this will be your personal account
  • Select the Green Clone button
  • Select Git Desktop
  • Pick a local location for the repository we will use this location in pyCharm
  • From the branch menu choose develop

Setup the IDE

  • Open pyCharm
  • Click the Open button or choose open from the File Menu
  • Navigate to the location of the project saved via GitDesktop and click open
  • From the PyCharm menu choose preferences or press Command + ,
  • Navigate to Project → Project interpreter
  • Find the terminal tab
  • Run cp .env.template .env
  • Edit .env
  • Return to the editor and locate .env update the RH_ORG and RH_ACTIVATION entries with the values you acquired above
  • Update the splunkbase username and password using your disposable id and password created above
  • Run the script ./test-with-compose.sh this will build the image initially and setup required docker volumes
  • Click the gear icon in the top right hand side of the screen
  • Click Add
  • Click Docker Compose
  • If this is the first time using Docker with pycharm click new then Select “Docker for Mac” and click Ok Setup as follows
  • Server “Docker”
  • Configuration FIles ./docker-compose.yml
  • Service test
  • Click Ok and Click Ok Again
  • Setup local unit tests
  • Click Add Configuration near the top right of the window
  • Click the “+” icon in the top left
  • Find Python Tests then select pytest
  • Configure as follows
  • Target Script path
  • Target Path = tests
  • Python Interpreter (this is tricky) find default for project
  • Click the “+” Icon under before launch activate…
  • Select Run External Tool
  • Click the “+” icon again
  1. Name Docker Compose
  2. Program docker-compose
  3. Arguments build
  • Click OK and OK again
  • Verify setup by clicking the play button near the top right
  • Note if all tests fail quickly there is a timing issue where tests run prior to SC4S just run the tests again