·
3 commits
to master
since this release
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
-basedDockerfile
, to a Debian based stack, able to run the whole of thebundler
commands ofPortus
' 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 otherRuby 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
- In the
docker-compose.yml
file, reset the value ofHTTP_URI_TO_PORTUS_PUBLIC_GIT_REPO
to a mirror of https://github.com/SUSE/Portus you have access to, or to https://github.com/SUSE/Portus directly. I mirror the portus source code, just in case it disappears from github.com . - then;, in the same folder and shell session, 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
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 testedPortus
actually starts. So when you use this image in your usualdocker-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 :
- You can find my PGP public key at https://keybase.io/jblasselle
- If you have a https://keybase.io account, you can find me with the keybase.io client, executing :
keybase id jblasselle
- Check that https://keybase.io verified that I am https://github.com/Jean-Baptiste-Lasselle , see https://gist.github.com/Jean-Baptiste-Lasselle/0086a48411842b88308888efbcd2b62f
- Check that https://github.com guarantees https://github.com/Jean-Baptiste-Lasselle is the owner of https://github.com/pokusio