-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatic build handle (pre-Docker image) (#45)
* make image from dockerfile scratch * # This is a combination of 7 commits. # This is the 1st commit message: WIP docker-compose https://onoblog.com/cakephp2-docker-scratch/ docker-compose --build prepare env # This is the commit message #2: Update site.conf # This is the commit message #3: Create docker alias forr docker-compose commadline # This is the commit message #4: Docker phpenv version # The commit message #5 will be skipped: # version docker-compose # The commit message #6 will be skipped: # docker-compose update # The commit message #7 will be skipped: # Update install-docker-compose.sh * WIP docker-compose https://onoblog.com/cakephp2-docker-scratch/ docker-compose --build Update site.conf Create docker alias forr docker-compose commadline Docker phpenv version Homebrew composer Update TravisCI-OSX-PHP 7.0 off <= composer symphony php version mismatch * composer, which check * latest hhvm package * Docker @ CircleCi * config environment * php lang 1st container mysql 2nd image in docker * wip docker test cake * -v log * composer configure * Clients mariadb composer configure * Local Test scripts Install guidelines
- Loading branch information
Showing
26 changed files
with
920 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# PHP CircleCI 2.0 configuration file | ||
# | ||
# Check https://circleci.com/docs/2.0/language-php/ for more details | ||
# | ||
version: 2 | ||
jobs: | ||
build: | ||
environment: | ||
DB: Mysql | ||
# a host alias or IP address | ||
MYSQL_SERVICE_HOST: 192.168.99.100 | ||
MYSQL_SERVICE_PORT: 3306 | ||
TEST_MYSQL_SERVICE_HOST: 192.168.99.100 | ||
TEST_MYSQL_SERVICE_PORT: 3306 | ||
DATABASE_NAME: phpcms | ||
DATABASE_SERVICE_NAME: MYSQL | ||
#(optional) | ||
#WEBHOOK_URL: <discordapp-url> | ||
# Persistent connection credentials | ||
DATABASE_USER: root | ||
# overrides docker-compose-alias.sh -p=<password> | ||
DATABASE_PASSWORD: pdocker | ||
# Just add TEST_DATABASE_USER and TEST_DATABASE_PASSWORD | ||
TEST_DATABASE_USER: ubuntu | ||
# overrides docker-compose-alias.sh -t=<password> | ||
TEST_DATABASE_PASSWORD: ptest | ||
# CakePHP generated | ||
#CAKEPHP_SECRET_TOKEN: <secret-token> | ||
#CAKEPHP_SECRET_SALT: <secret-salt> | ||
#CAKEPHP_SECURITY_CIPHER_SEED: <cipher-seed> | ||
# Generated by ./configure.sh -h | ||
GET_HASH_PASSWORD: ${GET_HASH_PASSWORD} | ||
docker: | ||
# Specify the version you desire here | ||
- image: circleci/php:7.1-node-browsers | ||
environment: | ||
DOCKER_OS_NAME: linux | ||
DOCKER_PHP_VERSION: 7.1 | ||
|
||
# Specify service dependencies here if necessary | ||
# CircleCI maintains a library of pre-built images | ||
# documented at https://circleci.com/docs/2.0/circleci-images/ | ||
# Using the RAM variation mitigates I/O contention | ||
# for database intensive operations. | ||
# - image: circleci/mysql:5.7-ram | ||
- image: circleci/mysql:5.7 | ||
container_name: mysql | ||
environment: | ||
MYSQL_ALLOW_EMPTY_PASSWORD: yes | ||
MYSQL_ROOT_PASSWORD: 'pdocker' | ||
MYSQL_DATABASE: phpcms | ||
|
||
steps: | ||
- checkout | ||
- run: git submodule update --init --recursive | ||
|
||
- run: sudo apt update # PHP CircleCI 2.0 Configuration File# PHP CircleCI 2.0 Configuration File sudo apt install zlib1g-dev libsqlite3-dev | ||
- run: sudo docker-php-ext-install zip | ||
- run: sudo apt-get install mariadb-client | ||
|
||
# Download and cache dependencies | ||
- restore_cache: | ||
keys: | ||
# "composer.lock" can be used if it is committed to the repo | ||
- v1-dependencies-{{ checksum "composer.lock" }} | ||
# fallback to using the latest cache if no exact match is found | ||
- v1-dependencies- | ||
|
||
- run: composer install -n --prefer-dist | ||
|
||
- save_cache: | ||
key: v1-dependencies-{{ checksum "composer.lock" }} | ||
paths: | ||
- ./app/Vendor/ | ||
|
||
- run: ./test-cake.sh -v --docker -p=$DATABASE_PASSWORD -t=$TEST_DATABASE_PASSWORD #| grep Test | ||
# Installing and Using docker-compose | ||
- run: | ||
name: Install Docker Compose | ||
command: | | ||
curl -L https://github.com/docker/compose/releases/download/1.19.0/docker-compose-`uname -s`-`uname -m` > ~/docker-compose | ||
chmod +x ~/docker-compose | ||
sudo mv ~/docker-compose /usr/local/bin/docker-compose | ||
- setup_remote_docker: # (2) | ||
docker_layer_caching: true # (3) | ||
|
||
# use a primary image that already has Docker (recommended) | ||
# build and push Docker image | ||
# (4) | ||
- run: | | ||
TAG=0.1.$CIRCLE_BUILD_NUM | ||
./docker-compose-alias.sh -dns=b23prodtm.info -p=$DATABASE_PASSWORD -t=$TEST_DATABASE_PASSWORD up -d --build | ||
docker login -u $DOCKER_USER -p $DOCKER_PASS | ||
docker push b23dkr/myphpcms:$TAG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule TravisCI-OSX-PHP
updated
4 files
+10 −14 | .travis.yml | |
+1 −1 | build/handle_osx_pkg.sh | |
+1 −1 | build/handle_windows_pkg.sh | |
+0 −5 | build/prepare_osx_env.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
FROM php:7.0-apache | ||
|
||
RUN apt-get update -yqq \ | ||
&& apt-get install -yqq --no-install-recommends \ | ||
git \ | ||
zip \ | ||
unzip \ | ||
&& rm -rf /var/lib/apt/lists | ||
|
||
# Enable PHP extensions | ||
RUN docker-php-ext-install pdo_mysql mysqli | ||
|
||
# Install composer | ||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer | ||
|
||
# Add cake and composer command to system path | ||
ENV PATH="${PATH}:/var/www/html/lib/Cake/Console" | ||
ENV PATH="${PATH}:/var/www/html/app/Vendor/bin" | ||
|
||
# COPY apache site.conf file | ||
COPY docker/apache/site.conf /etc/apache2/sites-available/000-default.conf | ||
|
||
# Copy the source code into /var/www/html/ inside the image | ||
COPY . /var/www/html/ | ||
|
||
# Set default working directory | ||
WORKDIR /var/www/html/app | ||
|
||
# Create tmp directory and make it writable by the web server | ||
RUN mkdir -p \ | ||
tmp/cache/models \ | ||
tmp/cache/persistent \ | ||
&& chown -R :www-data \ | ||
tmp \ | ||
&& chmod -R 770 \ | ||
tmp | ||
|
||
# Enable Apache modules and restart | ||
RUN a2enmod rewrite \ | ||
&& service apache2 restart | ||
|
||
EXPOSE 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# INSTALLATION | ||
Docker :whale: is able to use web server containers in local (VM/Vbox) or remote (Cloud) machine cluster (Kubernetes). | ||
A typical install script could look like the following script, for instance edit a file : | ||
|
||
#!/usr/bin/env bash | ||
|
||
cd myphpcms | ||
git pull | ||
git submodule update --init --recursive | ||
./docker-compose-alias.sh -dns=domain.com -S -p=sqlrootpassword -t=testpassword -v $* | ||
cd .. | ||
|
||
If you saved the file as _startup.sh_ In bash follows : ```startup.sh --build -d up``` You can add more docker-compose parameters as arguments. | ||
Docker builds up a new container and pushes it in registry. | ||
It will eventually run the container as the startup script succeeds. | ||
|
||
## Circle CI, Docker Local testing | ||
The current project is a full php with mariadb container for the Docker Virtual Machine (VM) manager, or Docker-CE, or even a ```Dockerfile``` compatible container interface. We choose Circle CI because it's able to achieve full remote tests with docker :whale: before we deploy to a Cloud Provider, Kubernetes Cluster, OpenShift, etc. | ||
|
||
A local test may only run with a complete local Virtual Host (Vbox) configuration. See the requirements below. | ||
|
||
### Simple Docker compose tests | ||
To use the built-in CakePHP 2 interface to test with Docker Compose YAML run the test script as follows : | ||
|
||
test-cake.sh --docker | ||
|
||
### Requirements | ||
- Broadband Internet access to the Worldwide Web, to download the packages and container images dependencies from the remote Docker registries. | ||
- The [VBoxmanager](https://www.virtualbox.org/wiki/Downloads) package. | ||
- The Docker VM described with the Dockerfile. >:whale: [Get Started](https://docs.docker.com/machine/get-started/) application. | ||
- The docker:docker user SSH remote access enabled (Ask the system administrator to enable Remote Session Accounts with Password authentification in /etc/ssh/sshd_config) | ||
- The CircleCI Client installed in ```$PATH```. [CLI Configuration](https://circleci.com/docs/2.0/local-cli/#section=configuration) shell command line : | ||
|
||
curl -fLSs https://circle.ci/cli | bash | ||
|
||
Once everything is installed, please reboot your system. | ||
|
||
### Make local tests with CircleCI CLI | ||
- Enable Docker VM on your system (a virtual Host is instancied) | ||
- Shell command line : ```circleci local execute``` | ||
|
||
### Startup | ||
Everyting is ready to launch a container in real cluster environment. The process is described further. [Kubespray with Ansible and Kubernetes cluster](https://github.com/b23prodtm/kubesrpay). | ||
|
||
### License | ||
Copyright 2016 www.b23prodtm.info | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
* [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
Oops, something went wrong.