The tech stack for this project consists of:
- Rails 5.2 Back end
- or Phoenix 1.6 Back end
- esbuild
- graphQL
- React Front end
To use the Phoenix back end set the environment variables as follows:
- BACKEND_URL=http://localhost:4000
- BACKEND_LANGUAGE=elixir
To use the Rails back end set the environment variables as follows:
- BACKEND_URL=http://localhost:5001
- BACKEND_LANGUAGE=ruby
View the README in the server-phoenix directory.
MRI 2.6.9
You can either install the deps directly on your box or you can use the Docker support.
Prequisites:
-
libpq
- Ubuntu: sudo apt install libpq-dev
- OSX: brew install libpq && brew link --force libpq
-
libsqlite3
- Ubuntu: sudo apt install sqlite3 libsqlite3-dev
- OSX: brew install sqlite3 && brew link --force sqlite3
-
asdf OR nvm
- OSX/Ubuntu (asdf): https://asdf-vm.com/guide/getting-started.html#_1-install-dependencies
- OSX/Ubuntu (nvm): https://github.com/nvm-sh/nvm
-
freedesktop mime database
- Ubuntu: should work out of the box. https://github.com/mimemagicrb/mimemagic#dependencies
- OSX: brew install shared-mime-info
-
Depending on whether asdf or nvm worked for you:
asdf install
OR add the following to your ~/.zshrc after the configuration details for nvm to pin the nodejs version:autoload -U add-zsh-hook load-nvmrc() { if [[ -f .nvmrc && -r .nvmrc ]]; then nvm use elif [[ $(nvm version) != $(nvm version default) ]]; then echo "Reverting to nvm default version" nvm use default fi } add-zsh-hook chpwd load-nvmrc load-nvmrc
-
gem install bundler:2.2.32
-
gem install pg -v '1.1.3' --source 'https://rubygems.org/'
-
gem install sqlite3 -v '1.3.13' --source 'https://rubygems.org/'
-
gem install foreman
-
bundle install
-
yarn install
-
cp .env.sample .env
-- dotenv loads variables from a .env in your project's root directory. Fill in env vars where applicable -
Configure Redis:
OSX:
brew install redis
redis-server &
redis-cli CONFIG SET dir /tmp/
redis-cli CONFIG SET dbfilename temp.rdb
redis-cli ping # Should respond with PONG
rake db:setup
Ubuntu:
- Update system
sudo apt update
- Install redis server
sudo apt install redis-server
- Update configuration
sudo sh -c 'echo "supervised systemd" >> /etc/redis/redis.config'
- Restart running service
sudo systemctl restart redis.service
- Configure and verify redis
redis-cli CONFIG SET dir /tmp/ redis-cli CONFIG SET dbfilename temp.rdb redis-cli ping # Should respond with PONG rake db:setup
foreman start -f Procfile.development
- http://localhost:3000
-
Install Docker and docker-compose
-
cp .env.local.sample .env
-- fill in env vars where applicable -
Sign up for a free OpenWeather API key
Note: the free API key has a daily limit of 1000 requests
docker-compose build
docker-compose up
- http://localhost:3000
NOTE: cypress tests depend on latest rake db:seed
and a server running locally
-
Command prints detected errors, stylistic/formatting issues, and bugs
-
yarn run lint
-
Executes yarn run lint, and makes suggested changes
-
yarn run lint --fix
-
Runs test script as defined by the package
-
yarn run test
-
Runs cypress tests
-
yarn run cy:run
-
Opens cypress test interface
-
yarn run cy:open
-
Ruby-specific code style checker, reports and automaticaly fixes errors
-
bundle exec rubocop
-
While in server-phoenix, dumps the GraphQL schema
-
mix absinthe.schema.json --schema HeliosWeb.Schema --pretty ../app/javascript/
- have the docker image running in one terminal tab (
docker-compose up
) - in a second tab run
docker-compose exec web bundle exec rails console
- if it gives any errors, try the following command:
docker-compose run web bundle exec rake app:update:bin
- if it gives any errors, try the following command:
There are a number of integrations used within the Helios app. A more detailed desctipition of these integrations including how to get started using them can be found here
export PATH=<node path>
export PATH=<rails path>
-
RAILS_ENV=production \ SECRET_KEY_BASE=<some secret> \ RAILS_SERVE_STATIC_FILES=1 \ rails s
https://app.zeplin.io/project/5ad8bfb98c928b070d6e1589
We have switched our client's default fetchPolicy to network-only, preferring to have a loading state prior to fetching the most up to date data.
Use the admin interface to navigate models and edit their parameters. Can be used to alter the displayed wifi and bathroom codes, rearrange and adjust widget screen time, or even delete a traffic cam from view.
- Accessible through http://localhost:3000/admin
- user email: [email protected]
- password: password