This is a mono-repo pulling together three older repositories: cacophony-api, cacophony-browse, and integration-tests
cacophony-api
is a node server that is accessed through a RESTful API. This allows uploading, processing and retrieving media collected for The Cacophony
Project.
Project | cacophony-web |
---|---|
Platform | Linux |
Requires | |
Previous names | Full Noise |
Licence | Affero General Public License |
Download and install the latest release from Github.
For development and testing purposes it is easiest to run cacophony-api using Docker. To do this:
- Ensure your user account is set up to run commands as root using
sudo
. - Ensure the Docker is installed (
sudo apt install docker.io
and docker-compose (https://docs.docker.com/compose/install/) on Ubuntu) - Run either
npm run dev
(if npm is installed) ordocker-compose build && docker-compose up --force-recreate
.
This will build and then run a Docker container which includes all the services needed to run the server.
Once the container is running, you can start a bash session inside
the container with npm run dev:bash
or docker-compose exec server bash
.
To start psql to query the database in base use the alias psqltest
See Cypress Tests for details on running the cypress tests.
API documentation can be generated by running npm run apidoc
. The
resulting documentation ends up in the apidoc
directory.
The API server also serves up the generated API documentation at it's root URL.
These are run automatically when you start the server.
To create a new database migration file: npm run new-migration <name>
To make the project build fast on our build servers (and your computer) we use a base docker image that contains nodejs, postgis, minio and most of our js dependencies. The code for building this server is in the folder docker-base
Releases are created using travis and git and saved on Github. Follow our release instructions to create a new release.
This is a web interface for querying with and interacting with Cacophony Project recordings using the project's API. It is based on the Vue framework and uses Vuex for state management.
# enter browse package
cd browse
# install dependencies
npm install
# create config file
cp dev-config.js.TEMPLATE dev-config.js
# now edit the config file to point to correct API server
# serve with hot reload at localhost:8080
npm run dev
# build for staging & production with minification
npm run release
For detailed explanation on how things work, consult the docs for vue-loader.
Please follow the Vue style guide for all development: https://vuejs.org/v2/style-guide/#ad
The project is configured to use eslint and prettier. Please ensure your development setup included a recent version of prettier. Pull requests will be checked to ensure there are no code formatting or eslint issues.
To run eslint:
npm run lint
To run eslint and automatically fix issues:
npm run lint:fix
- Ensure all changes have been merged and are pulled into the local copy.
- Tag the release (starting with a "v"), e.g.:
git tag -a v1.2.3 -m "1.2.3 release"
- Push the tag to Github, e.g.:
git push origin v1.2.3
- TravisCI will run the tests, create a release package and create a Github Release
The /srv/cacophony/cacophony-browse directory in the release package should be served by a web server.
Sample configuration for the Caddy web server:
# Update the host and port to match desired
http://localhost:9000 {
gzip
root /srv/cacophony/cacophony-browse
rewrite {
ext !.jpg !.png !.svg !.js
to /index-prod.html # or index-staging.html
}
}
Sample config for Nginx:
server {
root /srv/cacophony/cacophony-browse;
index index-prod.html;
server_name browse.cacophony.org.nz;
location / {
try_files $uri $uri/ /index-prod.html;
}
}
Note: you may also need to add a correct mime-type for WebAssembly (*.wasm)