Skip to content
This repository was archived by the owner on Jan 30, 2024. It is now read-only.

Commit 1e4fe05

Browse files
committed
[FEATURE] Move testing environment to docker
1 parent ae02bfd commit 1e4fe05

File tree

20 files changed

+137
-258
lines changed

20 files changed

+137
-258
lines changed

.travis.yml

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
sudo: false
1+
sudo: required
22
language: ruby
3+
services:
4+
- docker
35
cache: bundler
46
rvm:
57
- 2.2
@@ -8,7 +10,15 @@ rvm:
810
- 2.5
911

1012
before_install:
13+
# Set file permission for local ssh private key
14+
- chmod 600 config/docker/ssh/vagrant
15+
- docker-compose up -d
16+
- # Force root user permissions for authorized keys. Prevent error at ssh connection.
17+
- docker-compose exec webapp chown root:root /root/.ssh/authorized_keys
18+
- ssh root@localhost -p 5001 -i config/docker/ssh/vagrant -o StrictHostKeyChecking=no 'exit'
1119
- gem install bundler --no-document
1220

1321
script:
1422
- bundle exec rubocop
23+
- bundle exec cucumber features/apache.feature:3 || true
24+
- cd tmp/aruba/ && bundle install --gemfile Gemfile && bundle exec --gemfile Gemfile cap dev apache:htaccess

Berksfile

-3
This file was deleted.

Berksfile.lock

-47
This file was deleted.

Dockerfile

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM rastasheep/ubuntu-sshd:16.04
2+
# Install locales
3+
RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \
4+
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
5+
ENV LANG en_US.utf8
6+
7+
# Create test user and group
8+
RUN adduser 'test-user' --no-create-home --gecos "" --disabled-login
9+
RUN groupadd 'test-group'
10+
RUN usermod -aG 'test-group' 'test-user'
11+
12+
RUN apt-get update && apt-get install -y \
13+
apache2-utils \
14+
mysql-client \
15+
# Need for gem "dkdeploy-test_environment". Use commands like "sudo rm ..."
16+
sudo \
17+
# Need for gem "dkdeploy-test_environment".
18+
less \
19+
rsync
20+
21+
RUN mkdir -p /var/www
22+

README.md

+1-5
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,9 @@ The complete list of the dkdeploy constants you find in `/lib/capistrano/dkdeplo
6666

6767
rvm (v1.29.x) with installed Ruby 2.2.
6868

69-
Add the virtual box alias to your `hosts` file
70-
71-
192.168.156.180 dkdeploy-core.test
72-
7369
### Running tests
7470

75-
1. Starting the local box (`vagrant up --provision`)
71+
1. Starting the local docker (`docker-compose up -d`)
7672
2. Checking coding styles (`rubocop`)
7773
3. Running BDD cucumber tests (`cucumber`)
7874

Vagrantfile

-54
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[mysqld]
22
# configure mysql to produce log with slow queries
3-
# log-output = /var/log/mysql-default/
3+
# log-output = /var/log/mysql/
44
slow_query_log = 1
55
# log file - needs to match :mysql_slow_log in deploy.rb of fixture
6-
slow_query_log_file = /var/log/mysql-default/slow-queries.log
6+
slow_query_log_file = /var/log/mysql/slow-queries.log

config/docker/ssh/authorized_keys

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key

config/docker/ssh/vagrant

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
-----BEGIN RSA PRIVATE KEY-----
2+
MIIEogIBAAKCAQEA6NF8i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kCD3lVdl8L4cw9BVpKrJCs1c5taGjDgdInQKBgHm/fVvv96bJxc9x1tffXAcj
19+
3OVdUN0UgXNCSaf/3A/phbeBQe9xS+3mpc4r6qvx+iy69mNBeNZ0xOitIjpjBo2+
20+
dBEjSBwLk5q5tJqHmy/jKMJL4n9ROlx93XS+njxgibTvU6Fp9w+NOFD/HvxB3Tcz
21+
6+jJF85D5BNAG3DBMKBjAoGBAOAxZvgsKN+JuENXsST7F89Tck2iTcQIT8g5rwWC
22+
P9Vt74yboe2kDT531w8+egz7nAmRBKNM751U/95P9t88EDacDI/Z2OwnuFQHCPDF
23+
llYOUI+SpLJ6/vURRbHSnnn8a/XG+nzedGH5JGqEJNQsz+xT2axM0/W/CRknmGaJ
24+
kda/AoGANWrLCz708y7VYgAtW2Uf1DPOIYMdvo6fxIB5i9ZfISgcJ/bbCUkFrhoH
25+
+vq/5CIWxCPp0f85R4qxxQ5ihxJ0YDQT9Jpx4TMss4PSavPaBH3RXow5Ohe+bYoQ
26+
NE5OgEXk2wVfZczCZpigBKbKZHNYcelXtTt/nP3rsCuGcM4h53s=
27+
-----END RSA PRIVATE KEY-----

config/vm/cookbooks/dkdeploy-core/metadata.rb

-10
This file was deleted.

config/vm/cookbooks/dkdeploy-core/recipes/default.rb

-66
This file was deleted.

docker-compose.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
version: '3'
2+
services:
3+
webapp:
4+
build: '.'
5+
ports:
6+
- '5001:22'
7+
depends_on:
8+
- db
9+
volumes:
10+
- mysql-log:/var/log/mysql
11+
- ./config/docker/ssh/authorized_keys:/root/.ssh/authorized_keys
12+
db:
13+
image: mysql:5.7
14+
restart: always
15+
ports:
16+
- '5002:3306'
17+
environment:
18+
MYSQL_ROOT_PASSWORD: ilikerandompasswords
19+
MYSQL_DATABASE: dkdeploy_core
20+
volumes:
21+
- ./config/docker/mysql/conf:/etc/mysql/conf.d
22+
- mysql-log:/var/log/mysql
23+
volumes:
24+
mysql-log:

0 commit comments

Comments
 (0)