Commit e0abb6f2 authored by Chris Croome's avatar Chris Croome

GitLab stages use fresh Docker containers!

parent b9a75623
Pipeline #3487 failed with stages
in 92 minutes and 3 seconds
stages:
- build
- test
- deploy
- run
- clean
before_script:
......@@ -19,26 +17,15 @@ before_script:
- echo "${SSH_PRIVATE_KEY}" | tr -d '\r' | ssh-add -
- echo "${SSH_KNOWN_HOSTS}" > /root/.ssh/known_hosts && chmod 644 /root/.ssh/known_hosts
build:
stage: build
run:
stage: run
script:
- ansible-playbook --extra-vars "hostname=localhost" -i "localhost," -c local build.yml -v
- ansible-playbook --extra-vars "hostname=localhost" -i "localhost," -c local run.yml -v
artifacts:
paths:
- debs/
expire_in: 1 week
test:
stage: test
script:
- ansible-playbook --extra-vars "hostname=localhost" -i "localhost," -c local test.yml -v
deploy:
stage: deploy
script:
- ansible-playbook --extra-vars "hostname=localhost" -i "localhost," -c local deploy.yml -v
when: manual
clean:
stage: clean
script:
......
......@@ -2,13 +2,13 @@
This repo contains GitLab CI to install Ansible and copy a GPG secret file to the Docker container and then run three Ansible playbooks, `build.yml`, `test.yml` and `deploy.yml`.
The build playbook download source debs for PHP, set the file descriptors limit to a higher value and then rebuilds and signs them and create a apt repo layout.
The build role download source debs for PHP, set the file descriptors limit to a higher value and then rebuilds and signs them and create a apt repo layout.
The test playbook then installs the debs that have benn built to thest that they can be installed without errors.
The test role then installs the debs that have benn built to thest that they can be installed without errors.
The deploy playbook rsync's the files to the apt repo.
The deploy role rsync's the files to the apt repo.
The variables in `build.yml` and `deploy.yml` would need changing if these playbooks are used elsewhere.
The variables in `run.yml` would need changing if these playbooks are used elsewhere.
# PHP File Descriptors Limit
......@@ -30,6 +30,40 @@ Filename: src/SMTP.php
Line Number: 1124
```
Our shared hosting servers use a lot of file descriptors, for example this total number of open file handles of any sort:
```bash
lsof | wc -l
181379```
The file descriptors in kernel memory:
```bash
sysctl fs.file-nr
fs.file-nr = 6688 0 1633852
```
Where 6688 is the number of allocated file handles, 0 is the number of unused-but-allocated file handles and 1633852 is the system-wide maximum number of file handles.
Display the maximum number of open file descriptors:
```bash
cat /proc/sys/fs/file-max
1633852
```
Set the maximum number of open file descriptors:
```
sysctl -w fs.file-max=1633852
```
Add the following line to `/etc/sysctl.conf` to ensure that this persists across reboots:
```
fs.file-max = 1633852
```
# Environment variables
The following environmental variables are set in GitLab CI / CD Settings for this project:
......
---
- name: Deploy
hosts: "{{ hostname }}"
vars:
php_ssh_user_and_domain: deb@webarch4.co.uk
roles:
- deploy
---
- name: Build
- name: Build test and deploy
hosts: "{{ hostname }}"
vars:
php_sockets: 4096
php_sockets: 10240
php_version: 7.0
php_distro: stretch
php_repo_domain: deb.webarch.net
php_release_name: Webarchitects Co-operative Debian Packages
php_release_email: deb@webarch.net
php_gpg_id: EB612F9FE81381F8F3E58874495739F6CAA6F12D
php_ssh_user_and_domain: deb@webarch4.co.uk
roles:
- build
- test
- deploy
---
- name: Test
hosts: "{{ hostname }}"
vars:
php_version: 7.0
roles:
- test
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment