baw-server
The acoustic workbench server for storing and managing ecoacoustic data. Manages the structure and audio data. Provides an API for clients access.
Science Score: 36.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
✓Academic publication links
Links to: zenodo.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (13.9%) to scientific vocabulary
Keywords
Repository
The acoustic workbench server for storing and managing ecoacoustic data. Manages the structure and audio data. Provides an API for clients access.
Basic Info
Statistics
- Stars: 12
- Watchers: 12
- Forks: 4
- Open Issues: 267
- Releases: 5
Topics
Metadata Files
README.md
workbench-server
The ecoacoustics workbench server. Manages the structure and metadata for environmental audio data. Provides an API for client access.
(Previously known as baw-server)
Dependencies
This project's dev environment is managed by Docker. Please ensure the latest version of Docker Desktop is installed on your machine
Audio processing and other long-running tasks are performed using baw-workers.
Contributing
We're working on that.
Development requirements
Docker and docker-compose are required to run this application.
Windows
Install:
- Optionally: At least Windows 10 Version 2004
- Docker desktop
- a recent version (>3.4) with Docker Compose V2!
- WSL Version 2 (and add a default Ubuntu distro): https://docs.microsoft.com/en-us/windows/wsl/install-win10
- Enable the metadata flag for DrvFS mounts: https://docs.microsoft.com/en-us/windows/wsl/wsl-config#configure-per-distro-launch-settings-with-wslconf
- If you have issue with bind mount permissions, boot the container as the root
user and chown -R 1000 . to grant access to files
- Clear container logs with:
sudo find /mnt/wsl/docker-desktop-data/version-pack-data/community/docker/containers -name *.log -exec truncate -s 0 {} \;- warning: this can corrupt the docker logs, use with caution
MacOS
Install Docker Desktop.
MacOS users will need to export RERUN_FORCE_POLLING=true to disable
inotify polling for the rerun code reloading gem. This is because Docker Desktop for Mac does not support inotify through binds.
Linux
Install docker as normal.
Environment Setup
Clone this repo, then change directory to your cloned directory and on your host machine run
$ docker-compose up
This will prepare a complete development environment. To see what is involved in
the setup, look at the Dockerfile and bin/setup files.
You can stop the running containers using ctrl+c which is equivalent
to docker compose stop.
docker compose stopwill stop the containersdocker compose downwill stop containers, remove containers, and delete networks- images will not be deleted
- the primary application state (on the postgres volume) will not be removed
NOTE: changes in the Dockerfile will not be reflected in docker compose images or containers unless the compose project is destroyed or the containers are rebuilt.
Destroy or rebuild the docker environment
By default docker volume state is persisted between restarts of docker compose.
This means you can return to your previous development session easily. If,
however, you want to start from scratch you can remove state by doing one of
the following.
To start from scratch by removing all containers, images, and volumes:
$ docker-compose down --remove-orphans --volumes --rmi local
To rebuild the web service / baw-server image (e.g. to update dependencies)
but keep state from our volume:
$ docker-compose build
IDE
We recommend using VSCode and VSCode's remote container development mode, with the included workspace. When you open the baw-server.code-workspace with vscode it should ask you to open the workspace dev container with a prompt similar to this:

Development
If you're using VSCode's remote container development features you'll need to start the web server. See the command below.
Otherwise, Start by running, on your host machine:
$ docker-compose up
Web server
For the following commands:
- if you're using VSCode's remote container feature you can run these commands in the built in terminal
- if you're entering these commands from your host
- cd to this directory
- prefix commands with
docker compose web execto run the commands once off - if the service isn't started, use
docker compose web startto start it - use
docker compose web run xxxto run the web service and then run commandxxx docker compose exec web bashto enter an interactive session
Common tasks that you may need:
bundle installto install a new gemrails db:xxxto manipulate databaserails db:setup- does all of the belowrails db:create- create databaserails db:migrate- run migrationsrails db:seed- seed the database with default data
rails consoleto use the rails consolerails startto run a web serverpassenger-config restart-app /to restart passenger and hot-reload codetouch tmp/restart.txtto trigger a passenger reload before every request
Note: the binstubs in the bin folder automatically load bundler. You should not
need to use bundle exec.
Docker commands:
docker compose stopwill stop the containersdocker compose stop webstop web container so you can do something elsedocker compose exec bundle exec passenger start- the default action fordocker compose up- use
docker compose restart workers workers_test scheduler scheduler_testto restart rails apps in headless services- this is useful for installing a new gem in associated containers after updating the Gemfile (entrypoint.sh does the
bundle install)
- this is useful for installing a new gem in associated containers after updating the Gemfile (entrypoint.sh does the
When running the server in development or test modes, these configuration
files will be used:
config/settings/development.ymlconfig/settings/test.yml
They are based on config/settings/default.yml.
Workers
- run commands on the worker container
- e.g.
docker compose workers exec ...
- e.g.
- list worker commands:
baw-workers -Torbaw-workers(using the manually maintained binstub) - run a new worker:
baw-workers baw:worker:run - run a scheduler to process time-delayed tasks:
baw-workers baw:worker:run_scheduler
Debugging:
Insert a debugger statement where you would like the debugger to stop. Alternatively you can enter
a break point after the debugger starts.
shell
(host) > docker compose exec web bash
(container) > RAILS_ENV='test' rdbg --command -- /home/baw_web/baw-server/bin/rspec /home/baw_web/baw-server/spec/lib/modules/filter/query_spec.rb -e association
We've also defined a helper script to run the debugger:
shell
(container) > debug rspec /home/baw_web/baw-server/spec/lib/modules/filter/query_spec.rb -e association
More information here: https://github.com/ruby/debug
Tests
The tests are run using rspec:
bin/rspec
Tests can also be run with a specified seed using rspec:
rspec --seed <number>
There are some slower tests that do not always need to be run. These are marked
with the slow metadata and can be skipped with:
rspec --tag ~slow
Style
Use this style guide as a reference: https://github.com/rubocop-hq/ruby-style-guide.
Documentation
Generate API documentation with:
bin/generate_docs.sh
Other commands
These commands should be executed automatically but are listed because they are helpful to know.
- Create the test database:
rails db:create RAILS_ENV=test - Then migrate and seed the test database:
rails db:migrate db:seed RAILS_ENV=test - Prepare the local development database:
rails db:setup RAILS_ENV=development - Run rspec tests:
rspec - Run rspec tests and generate a HTML report:
rspec --format html --out rspec_results.html - Generate API documentation:
bin/generate_docs.sh
Production setup and deploying
Create production settings file config/settings/production.yml based on config/settings/default.yml.
Create staging settings file config/settings/staging.yml based on config/settings/default.yml.
We deploy using Ansible.
If you want to use background workers, you'll need to set up Redis. A basic redis setup is included with the docker-compose file.
Creating a release
git switch master && git pull- Set the GitHub auth token for docs generation:
export CHANGELOG_GITHUB_TOKEN=xxx
- Determine the next version name. Check the ./VERSION file for the current version.
- Run the
docker_build_and_push.ps1script with the next version as the first argument:- e.g.
./docker_build_and_push.ps1 6.1.0
- e.g.
Architecture
- Two main parts
- web server (Rails)
- job workers (under lib/gems/baw-workers)
- docker compose is used to run
- postgresql
- redis
- a single worker (for test and dev environments)
- a single scheduler (for test and dev environments)
- an instance of sftpgo
- an instance of PBS (for test and dev environments)
Credits
This project was originally created and maintained by @cofiem - all the amazing things it does are a credit to them.
Other major credits go to:
- @atruskie
- @peichins
- @Allcharles
- @JessieLOliver for design and user experience feedback
License
Apache License, Version 2.0
Owner
- Name: QUT Ecoacoustics Research Group
- Login: QutEcoacoustics
- Kind: organization
- Location: Brisbane, QLD, Australia
- Website: https://www.ecosounds.org
- Twitter: QUTEcoacoustics
- Repositories: 24
- Profile: https://github.com/QutEcoacoustics
The lab investigates the use of acoustic sensing technology for monitoring the environment
GitHub Events
Total
- Create event: 62
- Issues event: 139
- Watch event: 3
- Delete event: 16
- Issue comment event: 67
- Push event: 193
- Gollum event: 5
- Pull request review comment event: 119
- Pull request review event: 95
- Pull request event: 39
Last Year
- Create event: 62
- Issues event: 139
- Watch event: 3
- Delete event: 16
- Issue comment event: 67
- Push event: 193
- Gollum event: 5
- Pull request review comment event: 119
- Pull request review event: 95
- Pull request event: 39
Issues and Pull Requests
Last synced: 10 months ago
All Time
- Total issues: 108
- Total pull requests: 26
- Average time to close issues: about 1 year
- Average time to close pull requests: about 1 year
- Total issue authors: 7
- Total pull request authors: 6
- Average comments per issue: 0.24
- Average comments per pull request: 0.46
- Merged pull requests: 15
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 91
- Pull requests: 20
- Average time to close issues: 10 days
- Average time to close pull requests: 2 days
- Issue authors: 6
- Pull request authors: 4
- Average comments per issue: 0.21
- Average comments per pull request: 0.25
- Merged pull requests: 13
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- atruskie (64)
- hudson-newey (34)
- nellihol (3)
- Allcharles (3)
- peichins (2)
- wcornwell (1)
- Slade-AA (1)
Pull Request Authors
- atruskie (10)
- andrew-1234 (9)
- hudson-newey (3)
- cofiem (2)
- Copilot (1)
- Allcharles (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- actions/checkout v2 composite
- actions/upload-artifact v2 composite
- docker/build-push-action v2 composite
- docker/build-push-action v1.1.0 composite
- docker/login-action v1 composite
- docker/setup-buildx-action v1 composite
- stefanzweifel/git-auto-commit-action v4 composite
- ruby 3.1.1-slim-bullseye build
- aasm > 5 development
- active_storage_validations >= 0 development
- activerecord-cte >= 0 development
- acts_as_paranoid >= 0 development
- amazing_print >= 0 development
- annotate >= 0 development
- arel_extensions >= 2.1.0 development
- async >= 0 development
- async-http >= 0 development
- bcrypt ~> 3.1.9 development
- bootstrap-sass ~> 3.4.1 development
- bullet >= 0 development
- cancancan > 3 development
- coderay >= 0 development
- comfortable_mexican_sofa ~> 2.0.0 development
- config >= 0 development
- coveralls >= 0.8.23 development
- database_cleaner-active_record >= 0 development
- database_cleaner-redis >= 0 development
- debug >= 1.0.0 development
- devise ~> 4.8.1 development
- devise-i18n >= 0 development
- dotiw >= 0 development
- enumerize >= 0 development
- exception_notification >= 0 development
- factory_bot_rails >= 0 development
- faker >= 0 development
- falcon >= 0 development
- font-awesome-sass ~> 4.6.2 development
- github_changelog_generator >= 0 development
- haml ~> 5.1.2 development
- haml-rails ~> 2.0.1 development
- i18n-tasks ~> 0.9.31 development
- image_processing >= 0 development
- jquery-rails ~> 4.3 development
- json_spec ~> 1.1.4 development
- kaminari >= 0 development
- kramdown ~> 2.3.0 development
- kramdown-parser-gfm >= 0 development
- mini_magick >= 4.9.5 development
- nokogiri ~> 1.13.3 development
- notiffany ~> 0.1.0 development
- paperclip > 6.0.0 development
- passenger >= 0 development
- pg >= 0 development
- rack-cors ~> 1.1.1 development
- rack-mini-profiler >= 2.0.2 development
- rack-rewrite ~> 1.5.1 development
- rails_same_site_cookie >= 0 development
- rails_semantic_logger >= 4.10.0 development
- readapt >= 0 development
- recaptcha >= 0 development
- redis ~> 4.1 development
- rerun >= 0 development
- resque >= 0 development
- resque-job-stats >= 0 development
- resque-scheduler >= 0 development
- role_model ~> 0.8.1 development
- rspec >= 0 development
- rspec-benchmark >= 0 development
- rspec-collection_matchers >= 0 development
- rspec-its >= 0 development
- rspec-mocks >= 0 development
- rspec-rails ~> 6.0.0.rc1 development
- rspec_api_documentation ~> 4.8.0 development
- rswag-specs >= 0 development
- rubocop >= 0 development
- rubocop-rspec >= 0 development
- ruby-prof >= 0.17.0 development
- sass-rails >= 0 development
- shoulda-matchers ~> 4 development
- simple_form >= 0 development
- simplecov >= 0 development
- solargraph >= 0.45.0 development
- solargraph-rails >= 0.3.1 development
- sqlite3 >= 0 development
- super_diff >= 0 development
- test-prof >= 0 development
- timecop >= 0 development
- typeprof >= 0 development
- uuidtools ~> 2.1.5 development
- validates_timeliness ~> 6.0.0.alpha1 development
- webmock >= 0 development
- zeitwerk >= 2.3 development
- zonebie >= 0 development
- addressable >= 0
- bootsnap >= 0
- concurrent-ruby ~> 1
- concurrent-ruby-edge >= 0
- deep_sort >= 0
- descriptive-statistics >= 0
- dry-monads >= 0
- dry-struct >= 0
- dry-transformer >= 0
- dry-validation >= 0
- faraday > 2.0.1
- faraday-encoding >= 0
- faraday-parse_dates >= 0
- faraday-retry >= 0
- jwt >= 0
- memoist >= 0
- rswag-api >= 0
- rswag-ui >= 0
- tzinfo >= 0
- tzinfo-data >= 0
- 279 dependencies