Skip to content
Snippets Groups Projects
Commit c16d2970 authored by Sergey Yakubov's avatar Sergey Yakubov
Browse files

added versioning for site

parent bd2225a1
Branches
Tags
No related merge requests found
Showing
with 251 additions and 21 deletions
......@@ -3,7 +3,7 @@ function(cleanup varname)
SET( ${varname} ${out} PARENT_SCOPE)
endfunction()
execute_process(COMMAND git describe --tags --abbrev=0
execute_process(COMMAND git describe --tags --abbrev=0 master
OUTPUT_VARIABLE ASAPO_TAG
WORKING_DIRECTORY ..)
string(STRIP ${ASAPO_TAG} ASAPO_TAG)
......@@ -20,6 +20,7 @@ execute_process(COMMAND git rev-parse --short=10 HEAD
string(STRIP ${ASAPO_VERSION_COMMIT} ASAPO_VERSION_COMMIT)
if (${BRANCH} STREQUAL "master")
SET (ASAPO_VERSION_IN_DOCS ${ASAPO_TAG})
SET (ASAPO_VERSION ${ASAPO_TAG})
SET (ASAPO_VERSION_COMMIT "")
SET (ASAPO_VERSION_DOCKER_SUFFIX "")
......@@ -37,6 +38,10 @@ else()
SET (ASAPO_WHEEL_VERSION ${ASAPO_VERSION})
endif()
string(REGEX REPLACE "\\.0([0-9]+)\\."
".\\1." ASAPO_WHEEL_VERSION_IN_DOCS
${ASAPO_VERSION_IN_DOCS})
message("Asapo Version: " ${ASAPO_VERSION})
message("Python Asapo Version: " ${PYTHON_ASAPO_VERSION})
message("Asapo commit: " ${ASAPO_VERSION_COMMIT})
......@@ -3,6 +3,10 @@ project(ASAPO)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules/ ${PROJECT_SOURCE_DIR}/CMakeIncludes/)
set (ASAPO_VERSION_IN_DOCS 21.06.0)
#set (ASAPO_EXAMPLES_DIR .)
set (ASAPO_EXAMPLES_DIR frozen_versions/21.06.0)
#protocol version changes if one of the microservice API's change
set (ASAPO_CONSUMER_PROTOCOL "v0.4")
set (ASAPO_PRODUCER_PROTOCOL "v0.3")
......
......@@ -2,9 +2,18 @@ configure_files(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} true)
configure_files(${CMAKE_CURRENT_SOURCE_DIR}/blog ${CMAKE_CURRENT_BINARY_DIR}/blog)
configure_files(${CMAKE_CURRENT_SOURCE_DIR}/docs ${CMAKE_CURRENT_BINARY_DIR}/docs)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/static DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/versioned_docs DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/versioned_sidebars DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/src DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/plugins DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/examples DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
configure_files(${CMAKE_CURRENT_SOURCE_DIR}/examples/getting_started ${CMAKE_CURRENT_BINARY_DIR}/examples/getting_started)
add_custom_target(
site ALL
COMMAND
......
......@@ -32,14 +32,14 @@ unix socket or a tcp port for communications)
}>
<TabItem value="unix">
```shell content="getting_started/start_asapo_socket.sh"
```shell content="@ASAPO_EXAMPLES_DIR@/getting_started/start_asapo_socket.sh"
```
</TabItem>
<TabItem value="tcp">
```shell content="getting_started/start_asapo_tcp.sh"
```shell content="@ASAPO_EXAMPLES_DIR@/getting_started/start_asapo_tcp.sh"
```
</TabItem>
......@@ -84,19 +84,19 @@ Now you can install Python packages or C++ libraries for ASAPO Producer and Cons
}>
<TabItem value="python-pip">
```shell content="getting_started/install_python_clients_pip.sh" snippetTag="#snippet1"
```shell content="@ASAPO_EXAMPLES_DIR@/getting_started/install_python_clients_pip.sh" snippetTag="#snippet1"
```
</TabItem>
<TabItem value="python-packages">
```shell content="getting_started/install_python_clients_pkg.sh"
```shell content="@ASAPO_EXAMPLES_DIR@/getting_started/install_python_clients_pkg.sh"
```
</TabItem>
<TabItem value="cpp">
```shell content="getting_started/install_cpp_clients.sh"
```shell content="@ASAPO_EXAMPLES_DIR@/getting_started/install_cpp_clients.sh"
```
</TabItem>
......@@ -116,7 +116,7 @@ Now you can install Python packages or C++ libraries for ASAPO Producer and Cons
Now you can write a Producer client (API documentation [here](http://asapo.desy.de/python/producer.html)).
```shell content="getting_started/python/produce.py"
```shell content="@ASAPO_EXAMPLES_DIR@/getting_started/python/produce.py"
```
Execute it with python3
......@@ -131,12 +131,12 @@ $ python3 produce.py
Now you can write a Producer client (API documentation [here](http://asapo.desy.de/cpp/producer)).
```shell content="getting_started/cpp/produce.cpp"
```shell content="@ASAPO_EXAMPLES_DIR@/getting_started/cpp/produce.cpp"
```
Compile e.g. using CMake and execute. You might need to point cmake (with CMAKE_PREFIX_PATH) to asapo installation and curl library if installed to non-standard location.
```shell content="getting_started/cpp/CMakeLists.txt" snippetTag="#producer"
```shell content="@ASAPO_EXAMPLES_DIR@/getting_started/cpp/CMakeLists.txt" snippetTag="#producer"
```
```
......@@ -173,7 +173,7 @@ A consumer data that reads the message ingested during step 3. Note that a token
Complete API documentation [here](http://asapo.desy.de/python/consumer.html)
```shell content="getting_started/python/consume.py"
```shell content="@ASAPO_EXAMPLES_DIR@/getting_started/python/consume.py"
```
Execute it with python3
......@@ -186,12 +186,12 @@ $ python3 consumer.py
<TabItem value="cpp">
```shell content="getting_started/cpp/consume.cpp"
```shell content="@ASAPO_EXAMPLES_DIR@/getting_started/cpp/consume.cpp"
```
Compile e.g. using CMake and execute. You might need to point cmake (with CMAKE_PREFIX_PATH) to asapo installation and curl library if installed to non-standard location.
```shell content="getting_started/cpp/CMakeLists.txt" snippetTag="#consumer"
```shell content="@ASAPO_EXAMPLES_DIR@/getting_started/cpp/CMakeLists.txt" snippetTag="#consumer"
```
```
......@@ -203,12 +203,12 @@ $ ./asapo-consume
<TabItem value="c">
```shell content="getting_started/c/consume.c"
```shell content="@ASAPO_EXAMPLES_DIR@/getting_started/c/consume.c"
```
Compile e.g. using Makefile and pkg-config (although we recommend CMake - see C++ section) and execute. This example assumes asapo is installed to /opt/asapo. Adjust correspondingly.
```shell content="getting_started/c/Makefile" snippetTag="#consumer"
```shell content="@ASAPO_EXAMPLES_DIR@/getting_started/c/Makefile" snippetTag="#consumer"
```
```
......@@ -234,7 +234,7 @@ stream deleted
Optionally, last step is to stop ASAPO services and remove files:
```shell content="getting_started/cleanup.sh"
```shell content="@ASAPO_EXAMPLES_DIR@/getting_started/cleanup.sh"
```
<br/><br/>
......
......@@ -46,6 +46,16 @@ module.exports = {
},
],
},
{
type: 'docsVersionDropdown',
//// Optional
position: 'right',
// Add additional dropdown items at the beginning/end of the dropdown.
dropdownItemsBefore: [],
dropdownItemsAfter: [],
dropdownActiveClassDisabled: true,
docsPluginId: 'default',
},
{
href: 'https://stash.desy.de/projects/ASAPO/repos/asapo/browse?at=@ASAPO_VERSION@/',
label: 'BitBucket',
......@@ -65,6 +75,12 @@ module.exports = {
{
docs: {
sidebarPath: require.resolve('./sidebars.js'),
versions: {
current: {
"label": "Develop",
"path": "next"
},
},
},
blog: {
showReadingTime: true,
......
......@@ -2,7 +2,7 @@
# you can also install Linux/Windows packages if you have root access (or install locally).
# take a look at http://nims.desy.de/extra/asapo/linux_packages/ or http://nims.desy.de/extra/asapo/windows10 for your OS. E.g. for Debian 10.7
wget http://nims.desy.de/extra/asapo/linux_packages/debian10.7/asapo-dev-@ASAPO_VERSION@-debian10.7.x86_64.deb
sudo apt install ./asapo-dev-@ASAPO_VERSION@-debian10.7.x86_64.deb
wget http://nims.desy.de/extra/asapo/linux_packages/debian10.7/asapo-dev-21.06.0-debian10.7.x86_64.deb
sudo apt install ./asapo-dev-21.06.0-debian10.7.x86_64.deb
#!/usr/bin/env bash
pip3 install --user --trusted-host nims.desy.de --find-links=http://nims.desy.de/extra/asapo/linux_wheels asapo_producer=21.6.0
pip3 install --user --trusted-host nims.desy.de --find-links=http://nims.desy.de/extra/asapo/linux_wheels asapo_consumer==21.6.0
# you might need to update pip if the above commands error: pip3 install --upgrade pip
# if that does not work (abi incompatibility, etc) you may try to install source packages
# take a look at http://nims.desy.de/extra/asapo/linux_packages/ or http://nims.desy.de/extra/asapo/windows10 for your OS. E.g. for Debian 10.7
# wget http://nims.desy.de/extra/asapo/linux_packages/debian10.7/asapo_producer-21.06.0.tar.gz
# wget http://nims.desy.de/extra/asapo/linux_packages/debian10.7/asapo_consumer-21.06.0.tar.gz
# pip3 install asapo_producer-21.06.0.tar.gz
# pip3 install asapo_consumer-21.06.0.tar.gz
......@@ -2,7 +2,7 @@
# you can also install Linux/Windows packages if you have root access (or install locally).
# take a look at http://nims.desy.de/extra/asapo/linux_packages/ or http://nims.desy.de/extra/asapo/windows10 for your OS. E.g. for Debian 10.7
wget http://nims.desy.de/extra/asapo/linux_packages/debian10.7/python-asapo-producer_@ASAPO_VERSION@-debian10.7_amd64.deb
wget http://nims.desy.de/extra/asapo/linux_packages/debian10.7/python-asapo-consumer_@ASAPO_VERSION@-debian10.7_amd64.deb
sudo apt install ./python3-asapo-producer_@ASAPO_VERSION@-debian10.7_amd64.deb
sudo apt install ./python3-asapo_consumer_@ASAPO_VERSION@-debian10.7_amd64.deb
\ No newline at end of file
wget http://nims.desy.de/extra/asapo/linux_packages/debian10.7/python-asapo-producer_21.06.0-debian10.7_amd64.deb
wget http://nims.desy.de/extra/asapo/linux_packages/debian10.7/python-asapo-consumer_21.06.0-debian10.7_amd64.deb
sudo apt install ./python3-asapo-producer_21.06.0-debian10.7_amd64.deb
sudo apt install ./python3-asapo_consumer_21.06.0-debian10.7_amd64.deb
#!/usr/bin/env bash
set -e
ASAPO_HOST_DIR=/var/tmp/asapo # you can change this if needed, make sure there is enough space ( >3GB on disk)
NOMAD_ALLOC_HOST_SHARED=$ASAPO_HOST_DIR/container_host_shared/nomad_alloc
SERVICE_DATA_CLUSTER_SHARED=$ASAPO_HOST_DIR/asapo_cluster_shared/service_data
DATA_GLOBAL_SHARED=$ASAPO_HOST_DIR/global_shared/data
DATA_GLOBAL_SHARED_ONLINE=$ASAPO_HOST_DIR/global_shared/online_data
MONGO_DIR=$SERVICE_DATA_CLUSTER_SHARED/mongodb
ASAPO_USER=`id -u`:`id -g`
mkdir -p $NOMAD_ALLOC_HOST_SHARED $SERVICE_DATA_CLUSTER_SHARED $DATA_GLOBAL_SHARED $DATA_GLOBAL_SHARED_ONLINE
chmod 777 $NOMAD_ALLOC_HOST_SHARED $SERVICE_DATA_CLUSTER_SHARED $DATA_GLOBAL_SHARED $DATA_GLOBAL_SHARED_ONLINE
cd $SERVICE_DATA_CLUSTER_SHARED
mkdir -p fluentd grafana influxdb influxdb2 mongodb
chmod 777 *
docker run --privileged --rm -v /var/run/docker.sock:/var/run/docker.sock \
-u $ASAPO_USER \
--group-add `getent group docker | cut -d: -f3` \
-v $NOMAD_ALLOC_HOST_SHARED:$NOMAD_ALLOC_HOST_SHARED \
-v $SERVICE_DATA_CLUSTER_SHARED:$SERVICE_DATA_CLUSTER_SHARED \
-v $DATA_GLOBAL_SHARED:$DATA_GLOBAL_SHARED \
-e NOMAD_ALLOC_DIR=$NOMAD_ALLOC_HOST_SHARED \
-e TF_VAR_service_dir=$SERVICE_DATA_CLUSTER_SHARED \
-e TF_VAR_online_dir=$DATA_GLOBAL_SHARED_ONLINE \
-e TF_VAR_offline_dir=$DATA_GLOBAL_SHARED \
-e TF_VAR_mongo_dir=$MONGO_DIR \
-e TF_VAR_asapo_user=$ASAPO_USER \
-e ACL_ENABLED=true \
--name asapo --net=host -d yakser/asapo-cluster:21.06.0
sleep 15
docker exec asapo jobs-start -var elk_logs=false -var influxdb_version=1.8.4
#!/usr/bin/env bash
set -e
ASAPO_HOST_DIR=/var/tmp/asapo # you can change this if needed, make sure there is enough space ( >3GB on disk)
# change this according to your Docker configuration
DOCKER_ENDPOINT="127.0.0.1:2376"
DOCKER_TLS_CA=/usr/local/docker/certs/$USER/ca.pem
DOCKER_TLS_KEY=/usr/local/docker/certs/$USER/key.pem
DOCKER_TLS_CERT=/usr/local/docker/certs/$USER/cert.pem
NOMAD_ALLOC_HOST_SHARED=$ASAPO_HOST_DIR/container_host_shared/nomad_alloc
SERVICE_DATA_CLUSTER_SHARED=$ASAPO_HOST_DIR/asapo_cluster_shared/service_data
DATA_GLOBAL_SHARED=$ASAPO_HOST_DIR/global_shared/data
DATA_GLOBAL_SHARED_ONLINE=$ASAPO_HOST_DIR/global_shared/online_data
MONGO_DIR=$SERVICE_DATA_CLUSTER_SHARED/mongodb
ASAPO_USER=`id -u`:`id -g`
mkdir -p $NOMAD_ALLOC_HOST_SHARED $SERVICE_DATA_CLUSTER_SHARED $DATA_GLOBAL_SHARED $DATA_GLOBAL_SHARED_ONLINE
chmod 777 $NOMAD_ALLOC_HOST_SHARED $SERVICE_DATA_CLUSTER_SHARED $DATA_GLOBAL_SHARED $DATA_GLOBAL_SHARED_ONLINE
cd $SERVICE_DATA_CLUSTER_SHARED
mkdir -p fluentd grafana influxdb2 mongodb
chmod 777 *
docker run --privileged --userns=host --security-opt no-new-privileges --rm \
-u $ASAPO_USER \
-v $NOMAD_ALLOC_HOST_SHARED:$NOMAD_ALLOC_HOST_SHARED \
-v $SERVICE_DATA_CLUSTER_SHARED:$SERVICE_DATA_CLUSTER_SHARED \
-v $DATA_GLOBAL_SHARED:$DATA_GLOBAL_SHARED \
-e NOMAD_ALLOC_DIR=$NOMAD_ALLOC_HOST_SHARED \
-e TF_VAR_service_dir=$SERVICE_DATA_CLUSTER_SHARED \
-e TF_VAR_online_dir=$DATA_GLOBAL_SHARED_ONLINE \
-e TF_VAR_offline_dir=$DATA_GLOBAL_SHARED \
-e TF_VAR_mongo_dir=$MONGO_DIR \
-e TF_VAR_asapo_user=$ASAPO_USER \
-e ACL_ENABLED=true \
-v $DOCKER_TLS_CA:/etc/nomad/ca.pem \
-v $DOCKER_TLS_KEY:/etc/nomad/key.pem \
-v $DOCKER_TLS_CERT:/etc/nomad/cert.pem \
-e DOCKER_ENDPOINT=$DOCKER_ENDPOINT \
--name asapo --net=host -d yakser/asapo-cluster:21.06.0
sleep 15
docker exec asapo jobs-start -var elk_logs=false
#include "asapo/consumer_c.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
void exit_if_error(const char *error_string, const AsapoErrorHandle err) {
if (asapo_is_error(err)) {
char buf[1024];
asapo_error_explain(err, buf, sizeof(buf));
printf("%s %s\n", error_string, buf);
exit(EXIT_FAILURE);
}
}
int main(int argc, char* argv[]) {
AsapoErrorHandle err = asapo_new_handle();
AsapoMessageMetaHandle mm = asapo_new_handle();
AsapoMessageDataHandle data = asapo_new_handle();
const char *endpoint = "localhost:8400";
const char *beamtime = "asapo_test";
const char *token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjk1NzE3MTAyMTYsImp0aSI6ImMzaXFhbGpmNDNhbGZwOHJua20wIiwic3ViIjoiYnRfYXNhcG9fdGVzdCIsIkV4dHJhQ2xhaW1zIjp7IkFjY2Vzc1R5cGVzIjpbIndyaXRlIiwicmVhZCJdfX0.dkWupPO-ysI4t-jtWiaElAzDyJF6T7hu_Wz_Au54mYU";
const char * path_to_files = "/var/tmp/asapo/global_shared/data/test_facility/gpfs/test/2019/data/asapo_test"; //set it according to your configuration.
AsapoSourceCredentialsHandle cred = asapo_create_source_credentials(kProcessed,
beamtime,
"", "test_source", token);
AsapoConsumerHandle consumer = asapo_create_consumer(endpoint,
path_to_files, 1,
cred,
&err);
asapo_free_handle(&cred);
exit_if_error("Cannot create consumer", err);
asapo_consumer_set_timeout(consumer, 5000ull);
AsapoStringHandle group_id = asapo_consumer_generate_new_group_id(consumer, &err);
exit_if_error("Cannot create group id", err);
asapo_consumer_get_next(consumer, group_id, &mm, &data, "default",&err);
exit_if_error("Cannot get next record", err);
printf("id: %llu\n", (unsigned long long)asapo_message_meta_get_id(mm));
printf("file name: %s\n", asapo_message_meta_get_name(mm));
printf("file content: %s\n", asapo_message_data_get_as_chars(data));
// delete stream
asapo_consumer_delete_stream(consumer,"default", 1,1,&err);
exit_if_error("Cannot delete stream", err);
printf("stream deleted\n");
asapo_free_handle(&err);
asapo_free_handle(&mm);
asapo_free_handle(&data);
asapo_free_handle(&consumer);
asapo_free_handle(&group_id);
return EXIT_SUCCESS;
}
ASAPO_HOST_DIR=/var/tmp/asapo # you can change this if needed
docker exec asapo jobs-stop
docker stop asapo
rm -rf $ASAPO_HOST_DIR
cmake_minimum_required(VERSION 3.3)
project(asapo-client)
set(CMAKE_CXX_STANDARD 11)
# optionally use some other curl lib (e.g. static)
# set (CURL_LIBRARY /usr/local/lib/libasapo-curl.a)
# optionally linh gcc and stdc++ statically
# set (ASAPO_STATIC_CXX_LIBS ON)
# optionally link asapo as shared libs (ASAPO_STATIC_CXX_LIBS not used then)
# set (ASAPO_SHARED_LIBS ON)
#consumer snippet_start_remove
find_package (Asapo REQUIRED COMPONENTS Producer)
set(TARGET_NAME asapo-produce)
set(SOURCE_FILES produce.cpp)
add_executable(${TARGET_NAME} ${SOURCE_FILES})
target_link_libraries(${TARGET_NAME} imported::asapo-producer)
#consumer snippet_end_remove
#producer snippet_start_remove
find_package (Asapo REQUIRED COMPONENTS Consumer)
set(TARGET_NAME asapo-consume)
set(SOURCE_FILES consume.cpp)
add_executable(${TARGET_NAME} ${SOURCE_FILES})
target_link_libraries(${TARGET_NAME} imported::asapo-consumer)
#producer snippet_end_remove
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment