Skip to content

How to build the complete website locally

Steve Sam Jacob edited this page May 7, 2024 · 4 revisions

Setting Up Website(Complete Build)

(Ensure you have bs4 and lxml installed already. If shown "Bs4 not found error", try this command: pip install beautifulsoup4 --break-system-packages)

  1. Ensure that you're using node 16 using nvm use 16 and ensure python version is 3.11

  2. Uninstall gem using gem uninstall uglifier

  3. In docs_part_1.sh, comment out lines 15-19: #comment out this below two line in local during build # ln -s "$(which node)" /usr/bin/node # ln -s "$(which npm)" /usr/bin/npm

  4. Comment out the apt-get lines in scripts/build/build.sh and ruby_install.sh if you don't have apt-get on your lap.

  5. Also comment out lines 19-21 in ruby_install.sh ( Do this if you run into any rvm error when running the build script)

  6. The below is to ensure parse_blog_tags.py doesnt fail, dont have to run all the below commands if you’re running the full site.( Just until source command if you're running full site):

brew install [email protected]
brew upgrade [email protected]
echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
git checkout src/main/content/blog.html
./scripts/build/clone_blogs.sh
python3 scripts/build/parse_blog_tags.py
./scripts/jekyll_serve_dev.sh
  1. Run ./scripts/build/build.sh 

  2. If you don't already have a wlp driver, download and unzip the latest wlp driver from https://openliberty.io/start from All GA Features

  3. cd to wlp/bin, create defaultServer ./server create defaultServer

  4. Use the following server.xml, update the webApplication location to point to your openliberty.war location:

<featureManager>
        <feature>jaxrs-2.1</feature>
        <feature>jsonb-1.0</feature>
        <feature>concurrent-1.0</feature>
        <feature>cdi-2.0</feature>
        <feature>mpRestClient-1.3</feature>
        <feature>mpConfig-1.4</feature>
        <feature>transportSecurity-1.0</feature>
        <feature>mpOpenAPI-1.0</feature>
        <feature>beanValidation-2.0</feature>
        <feature>webCache-1.0</feature>
    </featureManager>

    <!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
    <httpEndpoint id="defaultHttpEndpoint"
                  httpPort="9080"``
                  httpsPort="9443" />

    <!-- Automatically expand WAR files and EAR files -->
    <applicationManager autoExpand="true"/>

    <!-- Default SSL configuration enables trust for default certificates from the Java runtime --> 
    <ssl id="defaultSSLConfig" trustDefaultCerts="true" />

    <cdi12 enableImplicitBeanArchives="false"/>

    <webApplication contextRoot="/" id="openlibertyio" location="/Users/aknguyen/Liberty/libertyGit/openliberty.io/target/openliberty.war"/>

    <!-- <webApplication contextRoot="/" id="start" location="/Users/aknguyen/libertyGit/start.openliberty.io/target/openliberty-starter-1.0-SNAPSHOT.war"/> -->

    <logging traceSpecification="io.openliberty.website.starter.*=all"></logging>

    <keyStore id="defaultKeyStore"/>
  1. Start defaultServer, run ./server run defaultServer

  2. Go to https://localhost:9443/ to see the local openliberty.io site

  3. To view the json data https://localhost:9443/api/builds/data

  4. To run junit test, under the root of your local openliberty.io git directory run mvn integration-test

Note You might run into some certificate issue then create retrieve-cert.sh file

#!/bin/sh
#
# usage: retrieve-cert.sh remote.host.name [port]
#
REMHOST=$1
REMPORT=${2:-443}
echo |\
openssl s_client -connect ${REMHOST}:${REMPORT} 2>&1 |\
sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'

then run

./retrieve-cert.sh public.dhe.ibm.com > dhe.pem
keytool -import -file dhe.pem -alias dheserver -keystore trust.jks -storepass Liberty

copy the trust.jks to /wlp/usr/servers/defaultServer/resources/security