Skip to content

First Release Portus and Portusctl Build From Source (Debian-based)

Latest
Compare
Choose a tag to compare
@Jean-Baptiste-Lasselle Jean-Baptiste-Lasselle released this 11 Mar 01:42
· 3 commits to master since this release
46bb9ea

Foreword

Portus is a Ruby On Rails application.

As such, The initial OpenSUSE Dev Team designed it to be run using an application server, puma : pretty much the analog of a Jee Server, but for Rails.

I designed this build process, following those two principles :

  • I transposed this Opensuse Leap-based Dockerfile , to a Debian based stack, able to run the whole of the bundler commands of Portus' build process : note that because of the transposition work, this image is extremely fat, and future release will certainly get rid of a lot. So this image is not production-grade (c'ant be used in a heavy load pipelines, or for portus production grade deployments).
  • I want to build and run Portus, like any other Ruby On Rails application, and with state-of-the-art best practices.

The build process consist essentially of dependency resolution, and "bundling", using a standard Ruby package manager, called bundler

Building portus from source

  • execute :
export WORK_FOLDER=~/.buildfromsrc.portus
export SSH_URI_TO_THIS_RECIPE_GIT=git@github.com:pokusio/portus-build-from-source.git
export HTTP_URI_TO_THIS_RECIPE_GIT=https://github.com/pokusio/portus-build-from-source.git
export THIS_RELEASE=0.0.1

# git clone $SSH_URI_TO_THIS_RECIPE_GIT $WORK_FOLDER
git clone $HTTP_URI_TO_THIS_RECIPE_GIT $WORK_FOLDER

cd ${WORK_FOLDER}

git checkout $THIS_RELEASE
export WORK_FOLDER=~/.buildfromsrc.portus
export SSH_URI_TO_THIS_RECIPE_GIT=git@github.com:pokusio/portus-build-from-source.git
export HTTP_URI_TO_THIS_RECIPE_GIT=https://github.com/pokusio/portus-build-from-source.git
export THIS_RELEASE=0.0.1

docker-compose build portus_frontend_buildfromsrc
# So we wait until building frontend has completed :
docker-compose up -d portus_frontend_buildfromsrc && docker-compose logs -f portus_frontend_buildfromsrc
echo "Now result of the build of frontend is in [$(pwd)/oci/portus-image-def/built-portus/]"
ls -allh $(pwd)/oci/portus-image-def/built-portus/

# --------------------------------------------
# Now we free disk space so we can
# build on as small a machine as possible.
# [$(pwd)/oci/portus-image-def/built-portus/]
# survives this clean up
#
docker-compose down --rmi all && docker system prune -f --all && docker system prune -f --volumes

echo "Result of the build of frontend in [$(pwd)/oci/portus-image-def/built-portus/] survives the disk space cleanup"
ls -allh $(pwd)/oci/portus-image-def/built-portus/

echo "Now building an OCI image in which The Portus Ruby On Rails app is built, and in which we can start Portus"
docker-compose build portus


echo "Now running The Portus Ruby On Rails app inside a container from the OCI built image containing Portus built and ready-to-run"
docker-compose up -d portus && docker-compose logs -f portus
  • Now, the /init script is waiting for database to be reachable,
  • So open a new shell session, change directory to the directory where your docker-compose.yml is, and execute this :
export WORK_FOLDER=~/.buildfromsrc.portus
cd $WORK_FOLDER

docker-compose exec -T portus bash -c 'bundler exec "pumactl -F /srv/Portus/config/puma.rb start"'
# docker exec -it portus-build-from-source_portus_1 bash -c 'bundler exec "pumactl -F /srv/Portus/config/puma.rb start"'
  • You just started Portus, and it is just complaining about a few things, like you don't have a database. And inideed, there isno database, but you tested Portus actually starts. So when you use this image in your usual docker-compose.yml , Portus will find the database.

Building portusctl from source

  • Build and run :
docker-compose down --rmi all && docker-compose up -d portusctl && docker-compose logs -f portusctl

PORTUSCTL_CPU_ARCH=$(cat .env |grep GOLANG_CPU_ARCH|awk -F '=' '{print $2}')
PORTUSCTL_OS=$(cat .env |grep GOLANG_OS|awk -F '=' '{print $2}')

echo "And now you have portusctl executable, built for ${PORTUSCTL_OS} on ${PORTUSCTL_CPU_ARCH} CPU arch. available here : "

ls -all portusctl/portusctl

./portusctl/portusctl --version
./portusctl/portusctl --help

The Bourne Identity

All commits and releases until the present (release) were signed by me, the author, Jean-Baptiste Lasselle :

keybase id jblasselle