214 views
 owned this note
Setup of wiki-like website on CERN infrustructure === [TOC] Setup of MkDocs === 1. Asked to create a PaaS official website via https://webservices.web.cern.ch/webservices/ (suggestion: make it public on the internet) 3. Created a simple public gitlab project (https://gitlab.cern.ch/dgamba/ebeamweb) 4. From the [openshift administration tool](https://openshift.cern.ch/console/project/e-beam/catalog) of the PaaS website I could then create a MkDocs application, linked to the above gitlab project (*do not forget the .git at the end*) 5. basically that's it. ### Adding webhook This allows trigger a re-build of the website after a "push" on the gitlab repository: 1. in "builds" configuration look for the right url ![](https://codimd.web.cern.ch/uploads/upload_d3280767f5a8e4f5eeb6c79439981300.png) 3. paste into your gitlab configuration ![](https://codimd.web.cern.ch/uploads/upload_51b1fa91f67d188bcaca992e7e7f0e2d.png) ### Adding support for latex 1. activate mymdownx.arithmatex extension that is available by default in mkdocs container provided by CERN 2. I sugesst also to activate admonition extension (and eventually other pymdownx extensions) for a nicer website. 3. All this is done by adding the following lines in your mkdocs.yml configuration file: ``` markdown_extensions: - pymdownx.arithmatex - admonition extra_javascript: - 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML' ``` ::: warning if you want to add **local** MathJs, then you need to: 1. download to your repository the latest version of MathJax. `` git clone https://github.com/mathjax/MathJax.git `` 2. add everything inside your *docs* folder, e.g. under `` docs/js/MathJax-2.7.5 `` 3. replace the *extra_javascript:* configuration as following: ``` extra_javascript: - 'js/MathJax-2.7.5/MathJax.js?config=TeX-MML-AM_CHTML' ``` ::: ### Using different branch 1. Edit your "build" YAML configuration file on openshift: ![](https://codimd.web.cern.ch/uploads/upload_aa26c7a7b1276be5c4c3386eff21be36.png) ### Run it as local server It is very unconvenient to edit your pages on gitlab website or even locally, then pusshing them to git, and let the OpenShift server recompile the website for you. Better you: 1. clone your git repository locally 2. run mkdocs locally 1. ``pip install mkdocs `` 2. ``pip install mkdocs-material`` 3. ``mkdocs serve`` (to be executed inside your local git repository) 3. connect your local website: http://127.0.0.1:8000 Setup of wikis.js === :::danger Not working instructions at the moment! :( ::: 1. created e-group "E-BEAM_web" to administer web, databases, etc. 1. created DB "ebeamwebdb" via [dbondemand](https://resources.web.cern.ch/resources/Manage/DbOnDemand/Resources.aspx) - it requirese to be subscribed to e-group "dbondemand-users" in order to be allowed to create a new DB - I have choosen postgreSQL for no particular reason - It is now available/configurable [here](https://dbod.web.cern.ch/instance.zul?instance=ebeamwebdb) - At set-up, I could get access to it via lxplus with: ``psql -h dbod-gb023 -p 6600 -U admin`` with the provided default password "changeme" - Password change with ``ALTER ROLE admin WITH PASSWORD 'xxxx';`` - Create new DB for website: ``CREATE DATABASE ebeamdb;`` - Create new user and grant all privileges: ``CREATE ROLE ebeamuser WITH PASSWORD 'ELENA-LEIR-AD-HLLHC'; `` ``GRANT ALL PRIVILEGES ON DATABASE ebeamdb TO ebeamuser;`` 1. requested a PaaS Web Application website for testing "[test-wikis](http://cern.ch/test-wikis)". See [link](http://information-technology.web.cern.ch/services/PaaS-Web-App) for more info about PaaS Web Applications 1. It can be administrated via [link](https://openshift-dev.cern.ch/console/project/test-wikis/overview) 1. Added storage ("wikis-storage") - useless! 2. Deployed image as "Image Name" as "requarks/wiki:beta" which automatically finds the image Issues: - impossible to start image... - Download openshift CLI - See https://cern.service-now.com/service-portal/article.do?n=KB0004358 - Which finally points you to download the latest release of [this]( https://github.com/openshift/origin/releases/tag/v3.11.0) - login token can be found on top-right of WEB interface ![](https://codimd.web.cern.ch/uploads/upload_b70b64b573ffe00bba62892c25c9ae3f.png) - NOTE: it is not going to be a real CLI: you will execute your commands again in the same terminal via ``./oc <mycommand>``