From 4d0b3cbc4d2679234ef46b153a07b1966b083708 Mon Sep 17 00:00:00 2001 From: Sergey Yakubov <sergey.yakubov@desy.de> Date: Thu, 1 Apr 2021 11:15:10 +0200 Subject: [PATCH] update --- docs/site/docs/getting-started.md | 27 ------- docs/site/docs/getting-started.mdx | 114 +++++++++++++++++++++++++++++ docs/site/docs/test.md | 49 ------------- docs/site/docusaurus.config.js | 6 +- docs/site/sidebars.js | 3 +- docs/site/src/css/custom.css | 10 ++- docs/site/src/theme/CodeBlock.tsx | 5 +- 7 files changed, 130 insertions(+), 84 deletions(-) delete mode 100644 docs/site/docs/getting-started.md create mode 100644 docs/site/docs/getting-started.mdx delete mode 100644 docs/site/docs/test.md diff --git a/docs/site/docs/getting-started.md b/docs/site/docs/getting-started.md deleted file mode 100644 index a11c4f0db..000000000 --- a/docs/site/docs/getting-started.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -title: Getting Started -slug: / ---- - -## Step 1: Start ASAPO services - -If you already have a running ASAPO and know the endpoint, you can skip to the step 2 - -<details><summary>Expand</summary> -<div> - -```shell link="getting_started/start_asapo_container.sh" title="start_asapo_container.sh" -``` - -</div> -</details> - -## Step 2: Start your Docusaurus site - -Run the development server in the newly created `my-website` folder: - -Open `docs/getting-started.md` and edit some lines. The site reloads automatically and display your changes. - -## That's it! - -Congratulations! You've successfully run and modified your Docusaurus project. diff --git a/docs/site/docs/getting-started.mdx b/docs/site/docs/getting-started.mdx new file mode 100644 index 000000000..7fc0273e7 --- /dev/null +++ b/docs/site/docs/getting-started.mdx @@ -0,0 +1,114 @@ +--- +title: Getting Started +slug: / +--- + + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +## Step 1: Start ASAPO services {#step-1} + +If you already have running ASAPO services and know the endpoint, you can skip to the [step 2](#step-2). + +Otherwise, for testing purposes one can start ASAPO services in a standalone mode (this is not recommended for production deployment). + + +The easiest way is to use a Docker container. +So, make sure Docker is installed and you have necessary permissions to use it. +Please note that this will only work on a Linux machine. Also please note that ASAPO needs some ports to be available. You can check the list +[here](https://stash.desy.de/projects/ASAPO/repos/asapo/browse/deploy/asapo_services/scripts/asapo.auto.tfvars.in?at={ASAPO_VERSION}#37). + +Now, depending on how your Docker daemon is configured (if it uses a +unix socket or a tcp port for communications) + you can use pick corresponding script below, adjust and execute it to start ASAPO services. + +<Tabs + defaultValue="unix" + values={[ + { label: 'Docker with unix socket (default)', value: 'unix', }, + { label: 'Docker with tcp (used on FS machines)', value: 'tcp', }, + ] +}> +<TabItem value="unix"> + +```shell link="getting_started/start_asapo_socket.sh" title="start_asapo_socket.sh" +``` + +</TabItem> + +<TabItem value="tcp"> + +```shell link="getting_started/start_asapo_tcp.sh" title="start_asapo_tcp.sh" +``` + +</TabItem> +</Tabs> + +at the end you should see + +<p className="green-text"><strong>Apply complete! Resources: 19 added, 0 changed, 0 destroyed.</strong></p> + +which means ASAPO services successfully started. Your ASAPO endpoint for API calls will be **localhost:8400**. + +### Create data directories + +Next, you need to create directories where ASAPO will store the data +(the structure matches the one used at DESY experiments). +Since we are going to use beamline `test` and beamtime `asapo_test` in following examples, +we must create two folders, one for the beamline filesystem and one for the core file system: + +```shell +ASAPO_HOST_DIR=/var/tmp/asapo # the folder used in step 1 +mkdir -p $ASAPO_HOST_DIR/global_shared/online_data/test/current/raw +mkdir -p $ASAPO_HOST_DIR/global_shared/data/test_facility/gpfs/test/2019/data/asapo_test +``` + +:::note ASAP::O in production mode + +We have a running instance for processing data collected during beamtimes. Please get in touch with FS-SC group for more information. + +::: + +## Step 2: Install client libraries {#step-2} + +Now you can install Python packages or C++ libraries for ASAPO Producer and Consumer API (you need to be in DESY intranet to access files). + +<Tabs + defaultValue="python-pip" + values={[ + { label: 'Python - pip', value: 'python-pip', }, + { label: 'Python - packages', value: 'python-packages', }, + { label: 'C++ packages', value: 'cpp', }, + ] +}> +<TabItem value="python-pip"> + +```shell link="getting_started/install_python_clients_pip.sh" +``` + +</TabItem> +<TabItem value="python-packages"> + +```shell link="getting_started/install_python_clients_pkg.sh" +``` + +</TabItem> +<TabItem value="cpp"> + +```shell link="getting_started/install_cpp_clients.sh" +``` + +</TabItem> +</Tabs> + + +Run the development server in the newly created `my-website` folder: + +Open `docs/getting-started.md` and edit some lines. The site reloads automatically and display your changes. + +## Step 3: Produce a message {#step-34} + +## Step 4: Consume a message {#step-34} + +## Step 5: Clean-up diff --git a/docs/site/docs/test.md b/docs/site/docs/test.md deleted file mode 100644 index c6cae533d..000000000 --- a/docs/site/docs/test.md +++ /dev/null @@ -1,49 +0,0 @@ -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -@ASAPO_VERSION@ - -<Tabs - defaultValue="js" - values={[ - { label: 'JavaScript', value: 'js', }, - { label: 'JavaScript', value: 'js2', }, - { label: 'Python', value: 'py', }, - { label: 'Java', value: 'java', }, - ] -}> -<TabItem value="js"> - -```jsx {1} link="getting_started/build.sh" snippetTag="#snippet1" title="/src/components/HelloCodeTitle.js" -``` - -</TabItem> - -<TabItem value="js2"> - -```jsx {1} link="./assets/build.sh" snippetTag="#snippet2" title="/src/components/HelloCodeTitle.js" -``` - -</TabItem> - -<TabItem value="py"> - -```py -def hello_world(): - print 'Hello, world!' -``` - -</TabItem> -<TabItem value="java"> - -```java -class HelloWorld { - public static void main(String args[]) { - System.out.println("Hello, World"); - } -} -``` - -</TabItem> -</Tabs> - diff --git a/docs/site/docusaurus.config.js b/docs/site/docusaurus.config.js index 93cdb774e..b77aafe05 100644 --- a/docs/site/docusaurus.config.js +++ b/docs/site/docusaurus.config.js @@ -2,7 +2,7 @@ module.exports = { title: 'ASAP::O', tagline: 'High performance distributed streaming platform', - url: 'https://asapo.desy.de', + url: 'http://asapo.desy.de', baseUrl: '/', onBrokenLinks: 'warn', onBrokenMarkdownLinks: 'warn', @@ -33,11 +33,11 @@ module.exports = { items: [ { label: 'C++', - href: 'http://os-46-asapo-docs.desy.de/cpp/', + href: 'http://asapo.desy.de/cpp/', }, { label: 'Python', - href: 'http://os-46-asapo-docs.desy.de/python/', + href: 'http://asapo.desy.de/python/', }, ], }, diff --git a/docs/site/sidebars.js b/docs/site/sidebars.js index e1cde346a..a40242a6d 100644 --- a/docs/site/sidebars.js +++ b/docs/site/sidebars.js @@ -1,16 +1,15 @@ module.exports = { docs: [ + 'getting-started', { type: 'category', label: 'Docusaurus Tutorial', items: [ - 'getting-started', 'create-a-page', 'create-a-document', 'create-a-blog-post', 'markdown-features', 'thank-you', - 'test', ], }, ], diff --git a/docs/site/src/css/custom.css b/docs/site/src/css/custom.css index e27e24d7c..e54c937c4 100644 --- a/docs/site/src/css/custom.css +++ b/docs/site/src/css/custom.css @@ -45,4 +45,12 @@ .navbar .navbar__link[href*=stash]:before { background-image: url('/static/img/bitbucket.svg'); -} \ No newline at end of file +} + +details { + margin-bottom: 20px; +} + +.green-text { + color: #32CD32; +} diff --git a/docs/site/src/theme/CodeBlock.tsx b/docs/site/src/theme/CodeBlock.tsx index 907c98674..4ee78be9a 100644 --- a/docs/site/src/theme/CodeBlock.tsx +++ b/docs/site/src/theme/CodeBlock.tsx @@ -10,7 +10,8 @@ const initialFetchResult = 'loading...'; const noteStyle: React.CSSProperties = { textAlign: 'right', - fontSize: '.8em' + fontSize: '.8em', + marginTop: '-20px' } export interface State { @@ -39,7 +40,7 @@ async function fetchCode (url: string,snippetTag:string, state: State,setFetchRe } let body = (await res.text()).split('\n') - const fromLine = body.indexOf(snippetTag+" start") + 1 || 1; + const fromLine = body.indexOf(snippetTag+" start") + 1 || 0; const toLine = body.indexOf(snippetTag+ " end",fromLine) -1 || undefined; body = body.slice(fromLine, (toLine || fromLine) + 1) -- GitLab