Skip to content

Commit bced04c

Browse files
committed
Split up exsiting docker image in mulitple containers (mysql, php-apache, npm) (opensourcepos#616)
Add company_name to searchable fields in Takings overview (opensourcepos#594) Change tests to use elementBy instead of wait functions
1 parent 6d0ed7c commit bced04c

16 files changed

+133
-368
lines changed

.dockerignore

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
node_modules
2+
bower_components
3+
tmp
4+
application/config/email.php
5+
application/config/database.php
6+
*.patch
7+
patches/
8+
.idea/
9+
git-svn-diff.py
10+
*.bash
11+
.swp
12+
.buildpath
13+
.project
14+
.settings/*
15+
*.swp
16+
*.rej
17+
*.orig
18+
*~
19+
*.~
20+
*.log
21+
application/sessions/*

.travis.yml

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
sudo: false
22

3-
language: node_js
4-
5-
node_js:
6-
- "4.1"
7-
83
services:
94
- docker
105

116
before_install:
12-
- docker build -t jekkos/opensourcepos .
13-
- docker run -d jekkos/opensourcepos
7+
- docker-compose build
8+
- docker-compose up -d
149

1510
script:
16-
- docker exec -t -i $(docker ps | tail -n 1 | cut -d' ' -f1) /bin/sh -c "while ! curl http://localhost/index.php | grep username; do sleep 1; done; cd app && grunt mochaWebdriver:test"
11+
- docker-wait opensourcepos_php_1
1712

1813
after_success:
1914
- docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"

Dockerfile

+11-28
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,19 @@
1-
FROM ubuntu:utopic
1+
FROM php:5-apache
22
MAINTAINER jekkos
33
RUN sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
44
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
5-
mysql-client \
6-
mysql-server \
7-
apache2 \
8-
libapache2-mod-php5 \
9-
pwgen python-setuptools \
10-
vim-tiny \
11-
php5-mysql \
125
php5-gd \
13-
php5-apcu \
14-
nodejs \
15-
npm \
16-
curl \
17-
software-properties-common \
18-
python \
19-
git
20-
RUN easy_install supervisor
6+
php5-apcu
217

22-
COPY ./docker/foreground.sh /etc/apache2/foreground.sh
23-
COPY ./docker/supervisord.conf /etc/supervisord.conf
24-
RUN chmod 755 /etc/apache2/foreground.sh
8+
RUN a2enmod rewrite
9+
RUN docker-php-ext-install mysql mysqli
2510

11+
WORKDIR /app
2612
COPY . /app
27-
RUN ln -s /usr/bin/nodejs /usr/bin/node
28-
RUN cd app && npm install
29-
RUN npm install -g grunt-cli
30-
RUN ln -s /usr/local/bin/grunt /usr/bin/grunt
3113

32-
RUN ln -fs /app/* /var/www/html
33-
COPY ./docker/start_container.sh /start_container.sh
34-
RUN chmod 755 /start_container.sh
35-
EXPOSE 80 3306
36-
CMD ["/bin/bash", "/start_container.sh"]
14+
RUN cp application/config/database.php.tmpl application/config/database.php && \
15+
sed -i -e "s/\(localhost\)/web/g" test/ospos.js && \
16+
sed -i -e "s/\(user.*\?=.\).*\(.\)$/\1'${MYSQL_USERNAME}'\2/g" application/config/database.php && \
17+
sed -i -e "s/\(password.*\?=.\).*\(.\)$/\1'${MYSQL_PASSWORD}'\2/g" application/config/database.php && \
18+
sed -i -e "s/\(database.*\?=.\).*\(.\)$/\1'${MYSQL_DB_NAME}'\2/g" application/config/database.php && \
19+
sed -i -e "s/\(hostname.*\?=.\).*\(.\)$/\1'${MYSQL_HOST_NAME}'\2/g" application/config/database.php

Dockerfile.test

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM digitallyseamless/nodejs-bower-grunt:5
2+
MAINTAINER jekkos
3+
4+
apt-get install curl
5+
6+
COPY Gruntfile.js .
7+
COPY package.json .
8+
COPY test .
9+
RUN npm install
10+
11+
CMD ['while ! curl web/index.php | grep username; do sleep 1; done; && grunt mochaWebdriver:test']

application/models/Sale.php

+2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public function search($search, $filters, $rows = 0, $limit_from = 0, $sort = 's
5656
$this->db->like('last_name', $search);
5757
$this->db->or_like('first_name', $search);
5858
$this->db->or_like('CONCAT(customer.first_name, " ", last_name)', $search);
59+
$this->db->or_like('company_name', $search);
5960
$this->db->group_end();
6061
}
6162
}
@@ -196,6 +197,7 @@ public function get_search_suggestions($search, $limit = 25)
196197
$this->db->like('last_name', $search);
197198
$this->db->or_like('first_name', $search);
198199
$this->db->or_like('CONCAT(first_name, " ", last_name)', $search);
200+
$this->db->or_like('company_name', $search);
199201
$this->db->order_by('last_name', 'asc');
200202

201203
foreach($this->db->get()->result_array() as $result)

database/database.sql

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
USE ospos;
12
-- >> This file is autogenerated from tables.sql and constraints.sql. Do not modify directly << --
23
--
34
-- Table structure for table `ospos_app_config`

docker-compose.test.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
version: '2'
2+
3+
volumes:
4+
ospos:
5+
driver: local
6+
7+
services:
8+
test:
9+
build:
10+
context: .
11+
dockerfile: Dockerfile.test
12+
php:
13+
build:
14+
context: .
15+
dockerfile: Dockerfile
16+
links:
17+
- mysql
18+
ports:
19+
- "80:80"
20+
volumes:
21+
- ospos:/var/www/html
22+
- ospos:/app
23+
environment:
24+
- MYSQL_USERNAME=admin
25+
- MYSQL_PASSWORD=pointofsale
26+
- MYSQL_DB_NAME=ospos
27+
- MYSQL_HOST_NAME=mysql
28+
29+
mysql:
30+
image: mysql:5.7
31+
environment:
32+
- MYSQL_ROOT_PASSWORD=pointofsale
33+
- MYSQL_DATABASE=ospos
34+
- MYSQL_USER=admin
35+
- MYSQL_PASSWORD=pointofsale
36+
ports:
37+
- "3306:3306"
38+
volumes:
39+
- ./database/database.sql:/docker-entrypoint-initdb.d/database.sql

docker-compose.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
version: '2'
2+
3+
volumes:
4+
ospos:
5+
driver: local
6+
7+
services:
8+
php:
9+
build:
10+
context: .
11+
dockerfile: Dockerfile
12+
links:
13+
- mysql
14+
ports:
15+
- "80:80"
16+
volumes:
17+
- ospos:/var/www/html
18+
- ospos:/app
19+
environment:
20+
- MYSQL_USERNAME=admin
21+
- MYSQL_PASSWORD=pointofsale
22+
- MYSQL_DB_NAME=ospos
23+
- MYSQL_HOST_NAME=mysql
24+
25+
mysql:
26+
image: mysql:5.7
27+
environment:
28+
- MYSQL_ROOT_PASSWORD=pointofsale
29+
- MYSQL_DATABASE=ospos
30+
- MYSQL_USER=admin
31+
- MYSQL_PASSWORD=pointofsale
32+
ports:
33+
- "3306:3306"
34+
volumes:
35+
- ./database/database.sql:/docker-entrypoint-initdb.d/database.sql

docker/foreground.sh

-9
This file was deleted.

docker/start_container.sh

-19
This file was deleted.

docker/supervisor.conf

-147
This file was deleted.

0 commit comments

Comments
 (0)