Skip to content

Commit

Permalink
Big improvement naming images.
Browse files Browse the repository at this point in the history
  • Loading branch information
juanjmerono committed Feb 25, 2017
1 parent d277080 commit 03d8a81
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 61 deletions.
46 changes: 34 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,26 @@ You have to follow a few steps and wait until Codefresh do the work and show you

# Configuration

- Create a codefresh account (if you don't have one already).
Create a codefresh.io account (if you don't have one already), and follow this steps to get your own test sakai server up and running.

- Add Service
- Choose this repo as URL and choose use existing codefresh.yml file.
- Configure launching settings (see next section).
- Build your server.
- Choose this repo as URL and choose use existing `./codefresh.yml` file.
- Configure build settings (see next section).
- Build/launch your server image.

# Build Settings

# Launch Settings
You can build many different sakai images ready to run at any moment. You just have to set some variables in `launch settings` option:

- Set variables to configure the test server you want to run:
- REPO_OWNER=sakaiproject,myfork,<any_github_account>
- REPO_OWNER=sakaiproject,myfork,<any_github_account> (with sakai source code :D)
- REPO_NAME=sakai
- REPO_REVISION=branch,hash_value,...
- SAKAI_DATABASE=mariadb,mysql,oracle //Choose the database you want to use in your environment
- BINARY_RELEASE=11.0,11.1,11.2,... // Choose a release and don't build the code just test binary release (fast)
- MYSQL_VERSION=mysql:5.6.27,mariadb:5.5.54,..
- ORACLE_VERSION=oracle-xe-11g,oracle-12c
- TOMCAT_IMAGE=tomcat:8.0.41-jre8,... // Choose tomcat version you want to use
- SAKAI_DB_DRIVER=mariadb,mysql,oracle //Choose the database driver you want to use in your environment
- BINARY_RELEASE=11.0,11.1,11.2,... // Choose a release and don't build the code just test binary releases (fast)
- DB_IMAGE=mysql,mariadb,sakaiproject/oracle // Choose the database docker image
- DB_VERSION=5.6.27,5.5.54,oracle-xe-11g,oracle-12c
- SAKAI_TAG=<anystring> // Use this to tag your new sakai image, master, 11.3, PRxxx, ...

# Advanced Configuration

Expand All @@ -41,9 +45,27 @@ Look at the PR for the fork and branch, something like somefork/sakai:SAK-XXXX.

- REPO_OWNER=somefork
- REPO_REVISION=SAK-XXXX
- SAKAI_DATABASE=mysql
- SAKAI_TAG=PRXXXX

Launch the build and wait.

# I Want to launch a previous image

You can run again any build you already create, for example, if you build a Sakai 11.3 from binary, and you want to run it again, just launch the image, you don't have to rebuild it is just a tag.

- Create a composition in codefresh.io
- Choose from this repo docker-compose.yml file
- Set the variables in the composition to match your goal.
- Launch.

# Want to test some special sakai property

Sakai images are build with all its default properties. If you want to run some property you must to create a new image, but don't worry you could create one based on a previous build.
For example you can test some property in a previous 11.3 sakai build.

- Set EXPERIMENTAL_PROPS variable to the URL with the property file you want to use.
- Set SAKAI_BASE_TAG to the image tag you want to use as base image to add the new properties.
- Set SAKAI_TAG to the tag you want to use to name the new image.
- Build.
- Then launch the image created.

80 changes: 34 additions & 46 deletions codefresh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ steps:
condition:
all:
notBinaryRelease: '"${{BINARY_RELEASE}}" == ""'
notSakaiExperimental: '"${{SAKAI_BASE_TAG}}" == ""'

binary_release:
title: Download Sakai Binary Release
Expand Down Expand Up @@ -60,7 +61,8 @@ steps:
condition:
all:
existsMasterPassword: '"${{MASTER_PASSWORD}}" != ""'
oracleDatabase: '"${{SAKAI_DATABASE}}" == "oracle"'
oracleDatabase: '"${{SAKAI_DB_DRIVER}}" == "oracle"'
notSakaiExperimental: '"${{SAKAI_BASE_TAG}}" == ""'

build_wait:
title: Build Wait For Database Code
Expand All @@ -72,9 +74,13 @@ steps:
commands:
- cp ./maven/settings.xml /root/.m2/settings.xml
- cp ./maven/settings-security.xml /root/.m2/settings-security.xml
- mvn -f wait -P${{SAKAI_DATABASE}} clean install
- mvn -f wait -P${{SAKAI_DB_DRIVER}} clean install
- mkdir -p tomcat/target/lib/
- cp wait/target/*.jar tomcat/target/lib/
when:
condition:
all:
notSakaiExperimental: '"${{SAKAI_BASE_TAG}}" == ""'
build_code:
title: Build Sakai Code Skiping Tests
Expand All @@ -87,30 +93,40 @@ steps:
- cp ./maven/settings.xml /root/.m2/settings.xml
- cp ./maven/settings-security.xml /root/.m2/settings-security.xml
- rm -rf ${{main_clone}}/tomcat/target
- mvn -DskipTests=true -P${{SAKAI_DATABASE}} clean install sakai:deploy
- mvn -DskipTests=true -P${{SAKAI_DB_DRIVER}} clean install sakai:deploy
when:
condition:
all:
noSkipBuild: '"${{PIPELINE_SKIP}}" != "build"'
noSkipAll: '"${{PIPELINE_SKIP}}" != "all"'
notBinaryRelease: '"${{BINARY_RELEASE}}" == ""'
notSakaiExperimental: '"${{SAKAI_BASE_TAG}}" == ""'

build_dockerfile:
title: Build Dockerfile
description: Create dockerfile to build Sakai image
image: arkban/alpine-aws-wget:latest
working_directory: ${{main_clone}}
commands:
- echo 'FROM ${{TOMCAT_IMAGE}}' > ./tomcat/Dockerfile
- echo '' >> ./tomcat/Dockerfile
- cat ./tomcat/dockerfile_base >> ./tomcat/Dockerfile

build_database_image:
title: Building Database Image For Oracle
description: Build the database image in case you want to use Oracle
type: build
working_directory: ${{main_clone}}/oracle/
dockerfile: ${{ORACLE_VERSION}}
image_name: sakaiproject/oracle
tag: ${{ORACLE_VERSION}}
dockerfile: ${{DB_VERSION}}
image_name: ${{DB_IMAGE}}
tag: ${{DB_VERSION}}
metadata:
set:
- database: ${{SAKAI_DATABASE}}
- oracle_version: ${{ORACLE_VERSION}}
- database: ${{DB_IMAGE}}
- version: ${{DB_VERSION}}
when:
condition:
all:
oracleDatabase: '"${{SAKAI_DATABASE}}" == "oracle"'
oracleDatabase: '"${{SAKAI_DB_DRIVER}}" == "oracle"'
notSakaiExperimental: '"${{SAKAI_BASE_TAG}}" == ""'

build_image:
title: Building Docker Sakai Image
Expand All @@ -119,50 +135,22 @@ steps:
working_directory: ${{main_clone}}/tomcat/
dockerfile: Dockerfile
image_name: ${{REPO_OWNER}}/${{REPO_NAME}}
tag: ${{REPO_REVISION}}${{BINARY_RELEASE}}
tag: ${{SAKAI_TAG}}
metadata:
set:
- binary_release: ${{BINARY_RELEASE}}
- repo: ${{REPO_OWNER}}/${{REPO_NAME}}
- revision: ${{REPO_REVISION}}
when:
condition:
all:
noSkipAll: '"${{PIPELINE_SKIP}}" != "all"'
- tag: ${{SAKAI_TAG}}

launch_mysql_composition:
title: Launch Sakai Server Composition MySQL/MariaDB
description: Run Sakai composition
type: launch-composition
composition: docker-compose.yml
composition_variables:
- DATABASE_TYPE=${{SAKAI_DATABASE}}
- DATABASE_IMAGE=${{MYSQL_VERSION}}
- DATABASE_PORT=3306
- DATABASE_COMMAND=-C utf8
- SAKAI_IMAGE=${{REPO_OWNER}}/${{REPO_NAME}}:${{REPO_REVISION}}${{BINARY_RELEASE}}
environment_name: '${{CF_REPO_NAME}}_${{CF_BRANCH}}'
entry_point: sakai
when:
condition:
any:
mysqlDatabase: '"${{SAKAI_DATABASE}}" == "mysql"'
mariaDbDatabase: '"${{SAKAI_DATABASE}}" == "mariadb"'

launch_oracle_composition:
title: Launch Sakai Server Composition Oracle
launch_sakai_composition:
title: Launch Sakai Server Composition
description: Run Sakai composition
type: launch-composition
composition: docker-compose.yml
composition_variables:
- DATABASE_TYPE=${{SAKAI_DATABASE}}
- DATABASE_IMAGE=sakaiproject/oracle:${{ORACLE_VERSION}}
- DATABASE_PORT=1521
- DATABASE_COMMAND=./entrypoint.sh
- SAKAI_IMAGE=${{REPO_OWNER}}/${{REPO_NAME}}:${{REPO_REVISION}}${{BINARY_RELEASE}}
- DATABASE_TYPE=${{SAKAI_DB_DRIVER}}
- DATABASE_IMAGE=${{DB_IMAGE}}:${{DB_VERSION}}
- SAKAI_IMAGE=${{REPO_OWNER}}/${{REPO_NAME}}:${{SAKAI_TAG}}
environment_name: '${{CF_REPO_NAME}}_${{CF_BRANCH}}'
entry_point: sakai
when:
condition:
all:
oracleDatabase: '"${{SAKAI_DATABASE}}" == "oracle"'
5 changes: 3 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ services:
database:
image: $DATABASE_IMAGE
ports:
- $DATABASE_PORT
- 1521
- 3306
environment:
- MYSQL_ROOT_PASSWORD=
- MYSQL_ALLOW_EMPTY_PASSWORD="yes"
- MYSQL_USER=sakai
- MYSQL_PASSWORD=sakai
- MYSQL_DATABASE=sakai
command: $DATABASE_COMMAND
command: --character-set-server=utf8
sakai:
image: $SAKAI_IMAGE
ports:
Expand Down
2 changes: 2 additions & 0 deletions oracle/entrypoint_orcl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
./entrypoint.sh
3 changes: 3 additions & 0 deletions oracle/oracle-12c
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Dockerfile
FROM sath89/oracle-12c
ADD init.sql /docker-entrypoint-initdb.d/
ADD entrypoint_orcl.sh /entrypoint_orcl.sh
ENTRYPOINT ["/entrypoint_orcl.sh"]
CMD [""]
3 changes: 3 additions & 0 deletions oracle/oracle-xe-11g
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Dockerfile
FROM sath89/oracle-xe-11g
ADD init.sql /docker-entrypoint-initdb.d/
ADD entrypoint_orcl.sh /entrypoint_orcl.sh
ENTRYPOINT ["/entrypoint_orcl.sh"]
CMD [""]
1 change: 0 additions & 1 deletion tomcat/Dockerfile → tomcat/dockerfile_base
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
FROM tomcat:8.0.41-jre8

COPY ./target/webapps/ /usr/local/tomcat-base/webapps/
COPY ./target/components/ /usr/local/tomcat-base/components/
Expand Down

0 comments on commit 03d8a81

Please sign in to comment.