Motivote is a web client for Pollywog written in Angular.
Motivote requires an instance of Pollywog which is part of Motivote's configuration. As it is common with client-side JavaScript frameworks Motivote's configuration is baked into the deployable app and thus it is necessary to adjust the configuration before you build the app and deploy it on your server.
Motivote makes use of Angular environments. There is a default environment.ts
and a environment.prod.ts
for production which only differ
by the production flag being false or true.
To compile Motivote using your custom configuration you should copy the environment.ts
as a new file which you should name environment.pollywog.ts
. There is a configuration in the
angular.json
file for this custom environment. There is also a script buildpollywog
in the
package.json
which builds the Motivote app using this custom configuration.
The following properties currently exist and should be present in your environment configuration file:
- pollywogUrl: The base url to your Pollywog instance, should not have a slash at the end
- production: should be set to true, a default property in Angular apps
- version: points to the version constant and should not be changed
- Git (to clone the repository and checkout the latest version of Motivote)
- Npm (to compile Motivote)
- Docker (if you want to build a Motivote Docker image)
This instruction should work on Linux and Mac, and likely on Windows with Linux subsystem. If it does not, you will probably be able to figure out yourself how to rewrite the scripts.
- clone this repository:
git clone https://gitlab.com/christianpflugradt/motivote.git
- checkout the latest Motivote version
, e.g.
git checkout 1.5.0
- write the version you checked out into the source code:
./set-version.sh 1.5.0
(exemplary for the version you checked out) - create a configuration
environment.pollywog.ts
(see Configuration chapter) - compile Motivote:
./build-from-source.sh
You will find the distributable in the folder dist/main
.
This distributable contain an index.html along with some script files.
You can simply put it in a path inside your webserver root.
- build Motivote docker image:
docker build -t motivote .
- run Motivote docker container:
docker run -p 80:80 motivote
Please note that the base-href
property in the distributable's index.html
is currently set to /motivote/
which must correspond to the url suffix that your webserver associates
with this app. If you host Motivote as www.your-server-name.tld/motivote/
nothing has to be changed
but if you want to use let's say www.your-server-name.tld/myapps/motivote/
you need to update
the base-href to /myapps/motivote
or else the index.html
will not be able to include the script files.
You can change the base-href
either directly in the package.json
(which I recommend) or after building the app, in the distributable's index.html
.
Another thing you must pay attention to is CORS.
For local development you can use a browser plugin like "CORS Everywhere" for Firefox but for using
Motivote and Pollywog in production you must configure CORS in your webserver or make sure both
components run in the same domain on the same port. I recommend to do the latter and to put your Pollywog
instance behind a reverse proxy like Nginx. Simply run Pollywog on any port you like and configure
a proxy pass to route requests for www.your-server-name.tld/pollywog/
to the port
Pollywog is listening to.