Session Service
This service delivers several endpoints to create, load, change and delete sessions.
Requirements
Mandatory
The only requirement so far is Docker and Docker Compose.
Optional
Optionally you are able to run the whole environment in a virtual machine. Therefor you need:
Development
To get the development environment run you only need to follow the instructions under Docker Environment.
If you decided to run it on a virtual machine, then please do the steps in Vagrant Environment.
Docker Environment
Before you can start ensure that you have install all requirements. All
commands will be executed in the projects root folder.
Docker Compose Way
The easiest way is to use docker compose. You are able to launch every container with only one command:
docker-compose up -d
To work with go and the addional tools, you can access the container with:
docker-compose exec sessionservice ./docker-entrypoint
On the command line of the docker container you can now find all the projects data at:
cdproj
Docker Way
Now you can build the docker image by excuting:
docker build -t sessionservice .
Afterwards you can run the docker container by:
docker run -it -p 4000:4000 --name sessionservice -v /vagrant/:/workspace/src/github.com/rebel-l/sessionservice sessionservice
On the command line of the docker container you can now find all the projects data at:
cdproj
The Golang compiler should be able to execute from everywhere. You can check that by:
go version
To detach from the docker container you need just to press the keys Ctrl + p Ctrl + q.
To launch the Redis container execute the following:
docker run -it -p 6379:6379 --name redis -d redis redis-server --appendonly yes
Vagrant Environment
If you would like to have clean sandbox for everything a vagrant machine is maybe your choice.
Therefor you need to ensure to have the optional requirements ready. Ensure that you
run all commands in the projects root folder.
To install all necessary packages just run composer:
composer install
Afterwards you are able to start the virtual machine:
vagrant up
Now you can connect with your favourite ssh tool to the virtual machine:
vagrant ssh
You can use the dns name 'session.dev' for connection.
You can switch to the project folder by:
cd /vagrant # or the alias 'cdproj'
On your virtual machine you can run your docker like described in the Docker Environment.
NodeJs setup (optional)
To run the newman (postman) tests you need NodeJs installed (see optional requirements above). To install the necessary
packages you need to run in the projects root folder:
npm install
Quality Assurance
For quality assurance Travis CI is connected with this repository. But before committing or
pushing anything to this repository you can quickly check everything by executing the build script:
./scripts/build.sh
There is also an acceptance test suite in the directory tests. These are postman tests which you can run (NodeJS is required)
by the following command:
./node_modules/.bin/newman run tests/sessionservice.postman_collection.json -e tests/Development.postman_environment.json
API Documentation
You find actual version of the API documentation in the /docs/indext.html file of this repository or as an online
version on Swagger hub.
The swagger file itself can be also found as YAML version in the /docs subfolder of this repository.
If the service is released you can also open http://servicedomain/docs/, e.g. on the vagrant development environment it is
http://session.dev:4000/docs/.