Skip to content
Permalink
Browse files

website: replace rest-backend website-backend

  • Loading branch information...
markus2330 committed Aug 17, 2019
1 parent d301ece commit c9050bfa8b26529446e5fee836742af9804f8f4b
@@ -228,7 +228,7 @@ These notes are of interest for people maintaining packages of Elektra:
For this release, please keep `ENABLE_OPTIMIZATIONS` turned off.
Currently the flag increases memory usage, without being faster.
- add `TARGET_TOOL_DATA_FOLDER` for installation of tool data
(for rest-backend and rest-frontend)
(for website-backend and rest-frontend)

The following files are new:

@@ -101,8 +101,8 @@ other versions of 3+.

After installing the dependencies, we are ready to build the applications.
To do so, we can follow the steps explained in the [build guide](/doc/COMPILE.md).
Make sure to include the two tools `rest-backend` and `rest-frontend`, e.g. by
using the arguments `-DTOOLS="ALL;rest-backend;rest-frontend"`.
Make sure to include the two tools `website-backend` and `rest-frontend`, e.g. by
using the arguments `-DTOOLS="ALL;website-backend;rest-frontend"`.

After building Elektra and the applications, we can use `make install` to install
them. Further information and troubleshooting can be found in the
@@ -116,7 +116,7 @@ but some settings have to be set manually afterwards.
### Backend

After the installation, the configuration specification of the backend has to be mounted
with the command `kdb mount-rest-backend-config`. You can check if the mounting was successful
with the command `kdb mount-website-backend-config`. You can check if the mounting was successful
by issuing `kdb mount`. There should be an entry in the list with a path like
`spec/sw/elektra/restbackend/#0` and a similar one without the leading `spec`.
If you do not see this mount points, have a look at the mount script in the tool_exec
@@ -189,7 +189,7 @@ The parameters that need to be changed in order for the frontend to work correct

As last step we need to run the applications:

- First we start the backend server with `kdb run-rest-backend`. To ensure the backend is accessible, you can use `curl http://localhost:8080/version` (change port to your setting), which should show you some version information in JSON format.
- First we start the backend server with `kdb run-website-backend`. To ensure the backend is accessible, you can use `curl http://localhost:8080/version` (change port to your setting), which should show you some version information in JSON format.
- Although the frontend was compiled during installation already, we want to have a freshly built homepage and use `kdb build-rest-frontend` to do so.
- Then we run the frontend analogously with `kdb run-rest-frontend`. It should now be reachable at the configured port.

@@ -199,7 +199,7 @@ If everything went smooth, both applications should now be online and reachable.

Both applications can be stopped with a simple command:

- Backend: `kdb stop-rest-backend`
- Backend: `kdb stop-website-backend`
- Frontend: `kdb stop-rest-frontend`

## Additional Tasks
@@ -247,7 +247,7 @@ As web server we use Debian Jessie’s Apache2.
Several domains are used for different tasks, whereas only two are relevant for
the here described service:

- `restapi.libelektra.org` for the API provided by the `rest-backend`
- `restapi.libelektra.org` for the API provided by the `website-backend`
- `www.libelektra.org` for the website and frontend provided by the `rest-frontend`

The server redirects requests on port 80 (non-SSL) to 443 using a very simple
@@ -317,7 +317,7 @@ For the `restapi.libelektra.org` domain we use an SCGI setup:

### Rest-Backend

The `rest-backend` itself is configured normally as described in the configuration
The `website-backend` itself is configured normally as described in the configuration
section above, but with CppCMS using SCGI instead of HTTP as API variant.
This requires setting the keys

@@ -24,7 +24,7 @@ LD_FLAGS='-Wl,-z,now -Wl,-z,relro'
cmake -DENABLE_ASAN=ON -DBUILD_FULL=OFF -DBUILD_SHARED=ON -DBUILD_STATIC=OFF -DBUILD_DOCUMENTATION=OFF \
-DCMAKE_INSTALL_PREFIX="${INSTALL_PATH}" \
-DPLUGINS='ALL;-EXPERIMENTAL;-fstab;-ruby;-lua;-python;-xerces;-yamlcpp;-python2;file;camel;-dbus' \
-DTOOLS='kdb;rest-backend;rest-frontend' \
-DTOOLS='kdb;website-backend;rest-frontend' \
-DCMAKE_C_FLAGS="$C_FLAGS" \
-DCMAKE_CXX_FLAGS="$C_FLAGS" \
-DCMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \
@@ -64,7 +64,7 @@ ulimit -c unlimited
# place for core dumps (name by: echo "core_%t_%p" > /proc/sys/kernel/core_pattern)
cd ${INSTALL_PATH}

PID_FILE=$(kdb sget /sw/elektra/restbackend/#0/current/cppcms/daemon/lock /run/elektra-rest-backend.pid)
PID_FILE=$(kdb sget /sw/elektra/restbackend/#0/current/cppcms/daemon/lock /run/elektra-website-backend.pid)
ps -ef
printf "Old PID was: "
@@ -79,7 +79,7 @@ echo "The backend should running on $IP:$PORT"
netstat -tlpen
# then start the backend; succeed if it was not started before..
kdb stop-rest-backend || /bin/true
kdb stop-website-backend || /bin/true
# cleanup /tmp files from build
find /tmp -mindepth 1 -user $(id -u) -delete || true
@@ -93,7 +93,7 @@ done
kdb set '/sw/elektra/restbackend/#0/current/cppcms/daemon/enable' '1'
# now start again
kdb run-rest-backend
kdb run-website-backend
printf "New PID is: "
cat ${PID_FILE} || /bin/true
@@ -75,7 +75,7 @@ RUN ldconfig \
&& cmake -DENABLE_ASAN=ON -DBUILD_FULL=OFF -DBUILD_SHARED=ON \
-DBUILD_STATIC=OFF -DBUILD_DOCUMENTATION=OFF \
-DPLUGINS="ALL;-EXPERIMENTAL;-fstab;-ruby;-lua;-python;-xerces;-yamlcpp;-python2;file;camel;yajl" \
-DTOOLS="kdb;rest-backend" \
-DTOOLS="kdb;website-backend" \
-DCMAKE_C_FLAGS="$C_FLAGS" \
-DCMAKE_CXX_FLAGS="$C_FLAGS" \
-DCMAKE_EXE_LINKER_FLAGS="-Wl,-z,now -Wl,-z,relro" \
@@ -106,9 +106,9 @@ RUN apt-get update && apt-get install -y \
&& rm -rf /var/lib/apt/lists/*

# prepare
# asan errors in mount-rest-backend-config and run-rest-backend
# asan errors in mount-website-backend-config and run-website-backend
RUN kdb global-mount \
&& kdb mount-rest-backend-config || /bin/true \
&& kdb mount-website-backend-config || /bin/true \
&& kdb set -N system /sw/elektra/restbackend/#0/current/backend/jwt/encryption/secret `pwgen -1cns 30` \
&& kdb set -N system /sw/elektra/restbackend/#0/current/cppcms/service/api "http" \
&& kdb set -N system /sw/elektra/restbackend/#0/current/cppcms/service/ip "0.0.0.0" \
@@ -118,5 +118,5 @@ RUN kdb global-mount \
&& kdb set '/sw/elektra/restbackend/#0/current/cppcms/logging/level' 'debug'

ENTRYPOINT ["kdb"]
CMD ["run-rest-backend"]
CMD ["run-website-backend"]
EXPOSE 8080
@@ -34,10 +34,10 @@ else ()
configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/mount-config.sh" "${CMAKE_CURRENT_BINARY_DIR}/mount-${tool}-config")
configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/README.md" "${CMAKE_CURRENT_BINARY_DIR}/README.md")

file (GLOB rest-backend_HDRS *.hpp)
add_headers (rest-backend_HDRS)
add_cppheaders (rest-backend_HDRS)
add_toolheaders (rest-backend_HDRS)
file (GLOB website-backend_HDRS *.hpp)
add_headers (website-backend_HDRS)
add_cppheaders (website-backend_HDRS)
add_toolheaders (website-backend_HDRS)

include_directories (${CMAKE_CURRENT_SOURCE_DIR})
include_directories (${CMAKE_CURRENT_BINARY_DIR})
@@ -46,11 +46,11 @@ else ()
include_directories (${LIBJWT_INCLUDE_DIR})
include_directories (${OPENSSL_INCLUDE_DIRS})

file (GLOB rest-backend_SRCS *.cpp)
file (GLOB website-backend_SRCS *.cpp)
file (GLOB main_SRC *main.cpp)
list (REMOVE_ITEM rest-backend_SRCS ${main_SRC})
list (REMOVE_ITEM website-backend_SRCS ${main_SRC})

add_library (tmp_${tool} OBJECT ${rest-backend_SRCS})
add_library (tmp_${tool} OBJECT ${website-backend_SRCS})
add_library (tmp_${tool}_main OBJECT main.cpp)
add_executable (${tool} $<TARGET_OBJECTS:tmp_${tool}> $<TARGET_OBJECTS:tmp_${tool}_main>)
target_link_libraries (${tool}
@@ -5,8 +5,8 @@
> Note: If you need a REST Service that provides get and set of
> local configuration, you actually want [/src/tools/web/elektrad]
This document aims to provide information about Elektra’s `rest-backend` feature.
`rest-backend` offers a RESTful server to search, store and convert configuration snippets.
This document aims to provide information about Elektra’s `website-backend` feature.
`website-backend` offers a RESTful server to search, store and convert configuration snippets.
It also offers authentication methods to restrict access to manipulative methods.
A detailed description of the implemented API can be found in the
[API description](/doc/api_blueprints/snippet-sharing.apib).
@@ -92,7 +92,7 @@ In detail, the options (without the base key `@config_root@`) are:

### Configure as Service

To configure the rest-backend as service, it is possible to use `systemd` on most systems.
To configure the website-backend as service, it is possible to use `systemd` on most systems.

1. Create a new service file with the following command
(and make sure the paths of `ExecStart` match your installation of Elektra):
@@ -116,9 +116,9 @@ To configure the rest-backend as service, it is possible to use `systemd` on mos
```
2. Reload the configuration of `systemctl` with `systemctl daemon-reload`.
3. Enable the rest-backend service with `systemctl enable @tool@.service`, a symbolic link should be created.
3. Enable the website-backend service with `systemctl enable @tool@.service`, a symbolic link should be created.
4. Make sure the service is enabled with `systemctl is-enabled @tool@.service`.
5. Restart the rest-backend service with `systemctl restart @tool@.service`.
5. Restart the website-backend service with `systemctl restart @tool@.service`.
If everything went fine, the service should be reachable and `systemctl status @tool@.service`
should print information about the running service (PID, etc).
@@ -139,7 +139,7 @@ An extensive tutorial describing the installation and configuration can be found
### Compiling
Compile Elektra as normal as per the [COMPILE document](https://master.libelektra.org/doc/COMPILE.md),
but make sure to include the `rest-backend` tool using the `-DTOOLS` flag.
but make sure to include the `website-backend` tool using the `-DTOOLS` flag.
For instance:
`-DTOOLS=ALL` or `-DTOOLS=@tool@`
@@ -1,5 +1,5 @@
[@config_default_profile@]
mountpoint = rest-backend.ini
mountpoint = website-backend.ini

[@config_default_profile@/backend/api/description/raw]
check/type = string
@@ -3,7 +3,7 @@
## Introduction

This document aims to provide information about Elektra’s `@tool@`,
which is the frontend of the `rest-backend` allowing for search and sharing of configuration snippets.
which is the frontend of the `website-backend` allowing for search and sharing of configuration snippets.
Besides that functionality, the frontend also contains the Elektra website.

## Design and Structure
@@ -248,7 +248,7 @@
obj:*/ld-2.19.so
}
{
rest-backend loadEnabledFormats jni plugin
website-backend loadEnabledFormats jni plugin
Memcheck:Leak
match-leak-kinds: all
fun:malloc

0 comments on commit c9050bf

Please sign in to comment.
You can’t perform that action at this time.