Template of a C++ service that uses userver framework with PostgreSQL.
To create your own userver-based service follow the following steps:
- Press the green "Use this template button" at the top of this github page
- Clone the service
git clone your-service-repo && cd your-service-repo - Give a propper name to your service and replace all the occurences of "pg_service_template" string with that name
(could be done via
find . -not -path "./third_party/*" -not -path ".git/*" -not -path './build_*' -type f | xargs sed -i 's/pg_service_template/YOUR_SERVICE_NAME/g'). - Feel free to tweak, adjust or fully rewrite the source code of your service.
Makefile contains typicaly useful targets for development:
make build-debug- debug build of the service with all the assertions and sanitizers enabledmake build-release- release build of the service with LTOmake test-debug- does amake build-debugand runs all the tests on the resultmake test-release- does amake build-releaseand runs all the tests on the resultmake service-start-debug- builds the service in debug mode and starts itmake service-start-release- builds the service in release mode and starts itmakeormake all- builds and runs all the tests in release and debug modesmake format- autoformat all the C++ and Python sourcesmake clean-- cleans the object filesmake dist-clean- clean all, including the CMake cached configurationsmake install- does amake build-releaseand runs install in directory set in environmentPREFIXmake install-debug- does amake build-debugand runs install in directory set in environmentPREFIXmake docker-COMMAND- runmake COMMANDin docker environmentmake docker-build-debug- debug build of the service with all the assertions and sanitizers enabled in docker environmentmake docker-test-debug- does amake build-debugand runs all the tests on the result in docker environmentmake docker-start-service-release- does amake install-releaseand runs service in docker environmentmake docker-start-service-debug- does amake install-debugand runs service in docker environmentmake docker-clean-data- stop docker containers and clean database data
Edit Makefile.local to change the default configuration and build options.
The original template is distributed under the Apache-2.0 License and CLA. Services based on the template may change the license and CLA.