Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The following is how to download the Altibase docker image with the docker pull command.

Code Block
themeEmacs
languagebash
# docker pull altibase/altibaseUsing default tag: latest
latest: Pulling from altibase/altibase
aeb7866da422: Pull complete
749a3f8d8b66: Pull complete
...
f061f1a62f9a: Pull complete
Digest: sha256:089a461f2b033d2c63c04d75cba78fe8e2ca9a75352e195f0199a17532305d17
Status: Downloaded newer image for altibase/altibase:latest
docker.io/altibase/altibase:latest
 
# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
ubuntu              18.04               cf0f3ca922e0        4 days ago          64.2MB
...
altibase/altibase   latest              3f217948f26d        10 months ago       1.06GB

...

The name of the Docker file is Dockerfile, and the path of Dockerfile must be designated at the time of build.

Code Block
themeEmacs
languagebash
FROM ubuntu:18.04MAINTAINER ALTIBASE
  
RUN sed -e '56 i\root\t\t soft\t nofile\t\t 1048576 \nroot\t\t hard\t nofile\t\t 1048576 \nroot\t\t soft\t nproc\t\t unlimited \nroot\t\t hard\t nproc\t\t unlimited \n' -i /etc/security/limits.conf; \
echo "vm.swappiness = 1" >> /etc/sysctl.conf; \
echo "kernel.sem = 20000 32000 512 5029" >> /etc/sysctl.conf;
 
WORKDIR /home/altibase
  
COPY set_altibase.env /home/altibase
COPY docker-entrypoint.sh /home/altibase
COPY ./altibase_home /home/altibase/altibase_home
  
EXPOSE 20300 30300 30310
ENTRYPOINT ["/bin/bash", "/home/altibase/docker-entrypoint.sh"]

...

  1. example of docker-entrypoint.sh

    Code Block
    themeEmacs
    languagebash
    #!/bin/bash. ./set_altibase.env
    #export ALTIBASE_MEM_MAX_DB_SIZE=${MEM_MAX_DB_SIZE}
    export FILE=${FILE}
    if [[ "${USER_ID}" == "" ]]
    then
       USER_ID=sys
       USER_PASSWD=manager
    fi
    function db_create()
    {
    ADMIN="${ALTIBASE_HOME}/bin/isql -u sys -p MANAGER -sysdba -noprompt"
            ${ADMIN} << EOF
    startup process;
    CREATE DATABASE mydb INITSIZE=${DB_SIZE}M NOARCHIVELOG CHARACTER SET ${DB_CHARSET} NATIONAL CHARACTER SET ${NATIONAL_CHARSET};
    shutdown abort;
    quit
    EOF
    }
    function db_start_daemon()
    {
    altibase -n
    }
    function set_replication_port_no()
    {
        if [[ "${MODE}" == "replication" ]]
        then
            cd $ALTIBASE_HOME/conf
            sed -e "s/REPLICATION_PORT_NO                   = 0/REPLICATION_PORT_NO                   = $SLAVE_REP_PORT/g" altibase.properties > temp.file
            mv temp.file altibase.properties
            cd $HOME
        else
            if [[ "${MASTER_REP_PORT}" != "" ]]
            then
                cd $ALTIBASE_HOME/conf
                sed -e "s/REPLICATION_PORT_NO                   = 0/REPLICATION_PORT_NO                   = $MASTER_REP_PORT/g" altibase.properties > temp.file
                mv temp.file altibase.properties
                cd $HOME
            fi
        fi
    }
    if [[ "${MODE}" == "daemon" ]]
    then
        if [[ ! -f "${ALTIBASE_HOME}/dbs/system001.dbf" ]]
        then
            set_replication_port_no
            echo "run altibase with db create"
            db_create
            if [[ ! -f "${FILE}" ]]
            then
                echo "run altibase without script"
            else
                echo "run altibase with create object"
                is -silent -u ${USER_ID} -p ${USER_PASSWD} -f ${FILE}
               server stop
            fi
            db_start_daemon
        else
            if [[ ! -f "${FILE}" ]]
            then
                echo "run altibase without script"
            else
                echo "run altibase with create object"
                is -silent -u ${USER_ID} -p ${USER_PASSWD} -f ${FILE}
                server stop
            fi
            echo "run altibase without db create"
            db_start_daemon
        fi
    elif [[ "${MODE}" == "isql" ]]
    then
        set_replication_port_no
        if [[ ! -f "${ALTIBASE_HOME}/dbs/system001.dbf" ]]
        then
            db_create
            server start
            isql -u ${USER_ID} -p ${USER_PASSWD} -s localhost
        else
            server start
            isql -u ${USER_ID} -p ${USER_PASSWD} -s localhost
        fi
    elif [[ "${MODE}" == "shell" ]]
    then
        set_replication_port_no
        if [[ ! -f "${ALTIBASE_HOME}/dbs/system001.dbf" ]]
        then
            db_create
            server start
            if [[ ! -f "${FILE}" ]]
            then
                /bin/bash
            else
                is -silent -f ${FILE}
                /bin/bash
            fi
        else
            server start
            if [[ ! -f "${FILE}" ]]
            then
                /bin/bash
            else
                isql -silent -u ${USER_ID} -p ${USER_PASSWD} -s localhost -f ${FILE}
                /bin/bash
            fi
        fi
    elif [[ "${MODE}" == "replication" ]]
    then
         set_replication_port_no
        if [[ ! -f "${ALTIBASE_HOME}/dbs/system001.dbf" ]]
        then
            db_create
            server start
            if [[ ! -f "${FILE}" ]]
            then
                /bin/bash
            else
                is -silent -f ${FILE}
                /bin/bash
            fi
        else
            server start
            if [[ ! -f "${FILE}" ]]
            then
                /bin/bash
            else
                isql -silent -u ${USER_ID} -p ${USER_PASSWD} -s localhost -f ${FILE}
                /bin/bash
            fi
        fi
    fi



  2. Example of set_altibase.env

    Code Block
    themeEmacs
    languagebash
    set +u    ## if unbound variable error is occured.export HOSTNAME=`hostname`
    export LOGNAME=$LOGNAME
    
    WHOAMI="who am i"
    export JAVA_HOME=
    
    #############
    # BASE PATHs
    #############
    if [ "$BASE_PATH" == "" ]; then export BASE_PATH=$PATH; fi
    if [ "$BASE_LIB_PATH" == "" ]; then export BASE_LIB_PATH=$LD_LIBRARY_PATH; fi
    if [ "$BASE_CLASSPATH" == "" ]; then export BASE_CLASSPATH=$CLASSPATH; fi
    export PATH=$BASE_PATH
    export LD_LIBRARY_PATH=$BASE_LIB_PATH
    export CLASSPATH=$BASE_CLASSPATH
    
    #############
    # BASIC
    #############
    export HOSTNAME=`hostname`
    export OS=`uname`
    #########################################################
    # PROMPT
    #########################################################
    export PS1="\[\033[31m\]\u@\h:\w\$ \[\033[0m\]"
    umask 0000
    export LANG=C
    
    ################################
    # OS: LINUX ES60+
    ################################
    export OS_NAME=linux
    export PATH=/usr/local/bin:/usr/bin:/bin:/sbin:$PATH
    export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib:$LD_LIBRARY_PATH
    
    ## JAVA ##
    export PATH=${JAVA_HOME}/bin:${PATH}
    export CLASSPATH=${JAVA_HOME}/lib:${JAVA_HOME}/jre/lib:$CLASSPATH
    
    #############
    # ALTIBASE
    #############
    
    export MALOC_ARENA_MAX=4
    
    export ALTIBASE_HOME=/home/altibase/altibase_home
    export ALTIBASE_NLS_USE=MS949
    export ALTIBASE_PORT_NO=20300  #20300,41001
    export ALTIBASE_MSG=${HOME}/altimsg
    
    export ALTIBASE_LINKER_SQLLEN_SIZE=4 # SET 8 for rp5470
    
    export DB_SIZE=10 #init Memory DB Size (Mbyte)
    #export MEM_MAX_DB_SIZE=4G
    export DB_CHARSET=MS949
    export NATIONAL_CHARSET=UTF8
    
    #############
    # PATHS
    #############
    #aPath=.:$HOME/app/scripts/bin
    aPath=.:$HOME/app/bin
    aPath=$aPath:${ALTIBASE_HOME}/bin
    export PATH=$aPath:$UNIXODBC_HOME/bin:${PATH}
    
    aLibPath=.
    aLibPath=$aLibPath:${ALTIBASE_HOME}/lib
    export LD_LIBRARY_PATH=$aLibPath:${LD_LIBRARY_PATH}
    export LD_LIBRARY_PATH_64=${LD_LIBRARY_PATH}
    export SHLIB_PATH=${LD_LIBRARY_PATH}
    export CLASSPATH=.:${ALTIBASE_HOME}/lib/Altibase.jar:${CLASSPATH}
    
    alias ls='ls -CF'
    alias ll='ls -l'
    alias lsd='ls -d */'
    alias plist='ps -ef | grep $LOGNAME'

...

More information about OPTIONS can be found here.

 

Code Block
themeEmacs
languagebash
# docker build -t altitest:0.0 ./Sending build context to Docker daemon  721.7MB
Step 1/12 : FROM  ubuntu:18.04
 ---> cf0f3ca922e0
Step 2/12 : MAINTAINER JEONG
 ---> Running in 20b8a511ef81
Removing intermediate container 20b8a511ef81
 ---> f7b43fc90f83
Step 3/12 : RUN useradd -d /home/altibase -s /bin/bash -m altibase; sed -e '56 i\altibase\t\t soft\t nofile\t\t 1048576 \naltibase\t\t hard\t nofile\t\t 1048576 \naltibase\t\t soft\t nproc\t\t unlimited \naltibase\t\t hard\t nproc\t\t unlimited \n' -i /etc/security/limits.conf; echo "vm.swappiness = 1" >> /etc/sysctl.conf; echo "kernel.sem = 20000        32000   512     5029" >> /etc/sysctl.conf;
 ---> Running in 88b3e8fa9508
Removing intermediate container 88b3e8fa9508
 ---> dc1994514a5f
Step 4/12 : COPY set_altibase.env /home/altibase
 ---> a039fabb1003
Step 5/12 : COPY docker-entrypoint.sh /home/altibase
 ---> 3ee3d3eda79b
Step 6/12 : COPY altibase_home /home/altibase/altibase_home
 ---> bafec9edb96b
Step 7/12 : RUN chown -R altibase:altibase /home/altibase/*
 ---> Running in f1913e2d7e32
Removing intermediate container f1913e2d7e32
 ---> e4d56135882f
Step 8/12 : USER altibase
 ---> Running in a1e4f2b96ee3
Removing intermediate container a1e4f2b96ee3
 ---> aad721f27620
Step 9/12 : WORKDIR /home/altibase
 ---> Running in 4081c1fcc20a
Removing intermediate container 4081c1fcc20a
 ---> b8f3497fc294
Step 10/12 : ENV MODE shell
 ---> Running in 9167fee80677
Removing intermediate container 9167fee80677
 ---> af201a060152
Step 11/12 : EXPOSE 20300 30300
 ---> Running in ff0db6b12515
Removing intermediate container ff0db6b12515
 ---> 7a1727561c45
Step 12/12 : ENTRYPOINT ["/bin/bash", "/home/altibase/docker-entrypoint.sh"]
 ---> Running in 1eeccd7174e9
Removing intermediate container 1eeccd7174e9
 ---> 275b96f6ba53
Successfully built 275b96f6ba53
Successfully tagged altitest:0.0