Sunny Chan blogs Can you see the Logic in my Madness?

Blog server moved to Rocky Linux 9

by Sunny Chan


Posted on Wednesday March 01, 2023 at 03:38am in Linux


The blog server has been migrated to Rocky Linux 9 - as Centos 7 is end of life soon. Containers makes migration pretty easy - it's just as simple as moving the config files over!


Blog software updated with containers

by Sunny Chan


Posted on Sunday March 07, 2021 at 12:44pm in Linux


Another upgrade recently - I used to run the blog with a tomcat instance directly installed in the OS but I have just containerized it with podman. I used Tomcat docker image and basically mapped the existing data files from my home directory into the container and it pretty much works.

The more challenging part is to convince systemctl to start the blog container every time the system restarts. I use podman as my container runtime as it allows running the container in the user namespace instead of root, which makes it more secure. However it seems that running as user namespace makes it difficult to setup systemctl due to issues with podman. You should follow the advise in this podman bug if you are having trouble:

  • Set Requires/After to user@<uid>.service to ensure all the user environment is setup before systemctl starts the blog container
  • You will need to run "loginctl enable-linger" for the user (see the issue comment)

Once it is all set it works like a treat. Now I can move my blog to any vps hosts that support docker container without dependent on the whole OS setup


Roller with https

by Sunny Chan


Posted on Wednesday July 25, 2018 at 12:40am in Linux


I have just migrated my roller to use https, and just for those who will need to do it later, you will need to make roller to replace all the URL with https. To do this, add the following to roller-custom.properties:


weblog.absoluteurl.[blog name]=https://someurl/roller


where blog name is the name of your blog, displayed at the top when you get into the configuration page. 


Updated OpenJDK-build docker image

by Sunny Chan


Posted on Tuesday September 12, 2017 at 06:31am in Linux


Since I have started my new job I have quite a bit of opportunity to do a bit of Docker deployment. So I have spend some time to update my docker image for openjdk build.


What's new:




  1. The image is now based on latest CentOS 7 (Oracle builds with Oracle Linux which is basically rebranded RHEL/Centos)

  2. It now has a docker build file, git hub repo and automatic build on Docker hub

  3. The default start up will now be user openjdk, and you could mount your data directory as home.

  4. I have put nano, git and hg in the image for your convience


This image will be able to build latest JDK8 and JDK9 source code.  



Here is an example on how to build an image 


#notice that you need :Z at the end of mount so that it fixes up selinux
#If you use default userid you can just mount your home dir (xxx = your id on host).
sudo docker run --rm -it -v /home/xxx:/home/openjdk:Z sunnythepooh/openjdk-build-docker:latest bash

[openjdk@8a4bc8214db2 ~]$ hg clone http://hg.openjdk.java.net/jdk9/jdk9
destination directory: jdk9
requesting all changes
adding changesets
adding manifests
adding file changes
added 2628 changesets with 4461 changes to 468 files
updating to branch default
322 files updated, 0 files merged, 0 files removed, 0 files unresolved
[openjdk@8a4bc8214db2 jdk9]$ bash get_source.sh
WARNING: Mercurial version 2.6.3 or later is recommended. /usr/bin/hg is version 2.6.2
# Repositories: corba jaxp jaxws langtools jdk hotspot nashorn
corba: hg clone http://hg.openjdk.java.net/jdk9/jdk9/corba corba
jaxp: hg clone http://hg.openjdk.java.net/jdk9/jdk9/jaxp jaxp
corba: requesting all changes
jaxp: requesting all changes
jaxp: adding changesets
corba: adding changesets
corba: adding manifests
jaxp: adding manifests
corba: adding file changes
jaxp: adding file changes
corba: added 876 changesets with 5451 changes to 2597 files
corba: updating to branch default
corba: 1201 files updated, 0 files merged, 0 files removed, 0 files unresolved
jaxws: hg clone http://hg.openjdk.java.net/jdk9/jdk9/jaxws jaxws
jaxws: requesting all changes
jaxws: adding changesets
jaxws: adding manifests
jaxws: adding file changes
jaxws: added 801 changesets with 21839 changes to 10824 files
jaxws: updating to branch default
jaxws: 3760 files updated, 0 files merged, 0 files removed, 0 files unresolved
langtools: hg clone http://hg.openjdk.java.net/jdk9/jdk9/langtools langtools
langtools: requesting all changes
langtools: adding changesets
langtools: adding manifests
jaxp: added 1153 changesets with 14751 changes to 8449 files
jaxp: updating to branch default
jaxp: 3352 files updated, 0 files merged, 0 files removed, 0 files unresolved
jdk: hg clone http://hg.openjdk.java.net/jdk9/jdk9/jdk jdk
jdk: requesting all changes
jdk: adding changesets
langtools: adding file changes
jdk: adding manifests
langtools: added 4174 changesets with 38097 changes to 11847 files
langtools: updating to branch default
langtools: 9464 files updated, 0 files merged, 0 files removed, 0 files unresolved
hotspot: hg clone http://hg.openjdk.java.net/jdk9/jdk9/hotspot hotspot
hotspot: requesting all changes
hotspot: adding changesets
hotspot: adding manifests
hotspot: adding file changes
jdk: adding file changes
hotspot: added 12824 changesets with 78616 changes to 15832 files
hotspot: updating to branch default
hotspot: 9078 files updated, 0 files merged, 0 files removed, 0 files unresolved
nashorn: hg clone http://hg.openjdk.java.net/jdk9/jdk9/nashorn nashorn
nashorn: requesting all changes
nashorn: adding changesets
nashorn: adding manifests
nashorn: adding file changes
nashorn: added 1928 changesets with 14563 changes to 4181 files
nashorn: updating to branch default
nashorn: 3293 files updated, 0 files merged, 0 files removed, 0 files unresolved
jdk: added 17287 changesets with 152446 changes to 50650 files
jdk: updating to branch default
jdk: 27295 files updated, 0 files merged, 0 files removed, 0 files unresolved
# Repositories: . corba jaxp jaxws langtools jdk hotspot nashorn
.: cd . && hg pull -u
corba: cd corba && hg pull -u
jaxp: cd jaxp && hg pull -u
jaxws: cd jaxws && hg pull -u
langtools: cd langtools && hg pull -u
jdk: cd jdk && hg pull -u
hotspot: cd hotspot && hg pull -u
nashorn: cd nashorn && hg pull -u
corba: pulling from http://hg.openjdk.java.net/jdk9/jdk9/corba
.: pulling from http://hg.openjdk.java.net/jdk9/jdk9
jdk: pulling from http://hg.openjdk.java.net/jdk9/jdk9/jdk
hotspot: pulling from http://hg.openjdk.java.net/jdk9/jdk9/hotspot
nashorn: pulling from http://hg.openjdk.java.net/jdk9/jdk9/nashorn
jaxws: pulling from http://hg.openjdk.java.net/jdk9/jdk9/jaxws
langtools: pulling from http://hg.openjdk.java.net/jdk9/jdk9/langtools
jaxp: pulling from http://hg.openjdk.java.net/jdk9/jdk9/jaxp
jaxws: searching for changes
jaxws: no changes found
hotspot: searching for changes
hotspot: no changes found
nashorn: searching for changes
nashorn: no changes found
corba: searching for changes
corba: no changes found
.: searching for changes
.: no changes found
langtools: searching for changes
langtools: no changes found
jaxp: searching for changes
jaxp: no changes found
jdk: searching for changes
jdk: no changes found
[openjdk@be86432ef9b0 jdk9]$ bash ./configure
Running generated-configure.sh
configure: Configuration created at Mon Sep 11 16:04:08 UTC 2017.
configure: configure script generated at timestamp 1496926402.
checking for basename... /usr/bin/basename
checking for bash... /usr/bin/bash
checking for cat... /usr/bin/cat
checking for chmod... /usr/bin/chmod
checking for cmp... /usr/bin/cmp
checking for comm... /usr/bin/comm
checking for cp... /usr/bin/cp
checking for cut... /usr/bin/cut
checking for date... /usr/bin/date
checking for gdiff... no
checking for diff... /usr/bin/diff
checking for dirname... /usr/bin/dirname
checking for echo... /usr/bin/echo
checking for expr... /usr/bin/expr
checking for file... /usr/bin/file
checking for find... /usr/bin/find
checking for head... /usr/bin/head
checking for gunzip... /usr/bin/gunzip
checking for pigz... no
checking for gzip... /usr/bin/gzip
checking for ln... /usr/bin/ln
checking for ls... /usr/bin/ls
checking for mkdir... /usr/bin/mkdir
checking for mktemp... /usr/bin/mktemp
checking for mv... /usr/bin/mv
checking for nawk... no
checking for gawk... /usr/bin/gawk
checking for printf... /usr/bin/printf
checking for rm... /usr/bin/rm
checking for rmdir... /usr/bin/rmdir
checking for sh... /usr/bin/sh
<!--------------------- MANY LINES LATER --------------------->
====================================================
A new configuration has been successfully created in
/home/openjdk/jdk9/build/linux-x86_64-normal-server-release
using default settings.

Configuration summary:
* Debug level: release
* HS debug level: product
* JDK variant: normal
* JVM variants: server
* OpenJDK target: OS: linux, CPU architecture: x86, address length: 64
* Version string: 9-internal+0-adhoc..jdk9 (9-internal)

Tools summary:
* Boot JDK: openjdk version "1.8.0_141" OpenJDK Runtime Environment (build 1.8.0_141-b16) OpenJDK 64-Bit Server VM (build 25.141-b16, mixed mode) (at /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.141-1.b16.el7_3.x86_64)
* Toolchain: gcc (GNU Compiler Collection)
* C Compiler: Version 4.8.5 (at /usr/bin/gcc)
* C++ Compiler: Version 4.8.5 (at /usr/bin/g++)

Build performance summary:
* Cores to use: 8
* Memory limit: 11783 MB
[openjdk@be86432ef9b0 jdk9]$ make images
Building target 'images' in configuration 'linux-x86_64-normal-server-release'
Compiling 8 files for BUILD_TOOLS_LANGTOOLS
Creating hotspot/variant-server/tools/adlc/adlc from 13 file(s)
Creating support/modules_libs/java.base/libjsig.so from 1 file(s)
Compiling 2 files for BUILD_JVMTI_TOOLS
<!------------------------------------- MANY LINES LATER ----------------------------------------->
----- Build times -------
Start 2017-09-10 16:55:14
End 2017-09-10 17:04:50

00:09:36 TOTAL
-------------------------
Finished building target 'images' in configuration 'linux-x86_64-normal-server-release'

#You should be able to find the build under build/

[openjdk@192f7c9052ff jdk9]$ build/linux-x86_64-normal-server-release/images/jdk/bin/java -version
openjdk version "9-internal"
OpenJDK Runtime Environment (build 9-internal+0-adhoc..jdk9)
OpenJDK 64-Bit Server VM (build 9-internal+0-adhoc..jdk9, mixed mode)




 


ClearOS 6 non-privileged user root access

by Sunny Chan


Posted on Wednesday October 17, 2012 at 11:16pm in Linux


Just to save myself searching for this information again:


In ClearOS 6 (a CentOS clone with nicer WebUI), user cannot access shells and by default you can't modify the settings within the WebUI. In order to enable user shell login, you will need to install "app-shell-extension-core.noarch" package.