Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add github actions #18

Merged
merged 6 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: CI
on:
push:
branches:
- master
pull_request:

jobs:
molecule:
name: Molecule
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Python 3
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install pipenv
run: pip3 install pipenv

- name: Create pipenv
run: pipenv install

- name: Run Molecule tests
run: pipenv run molecule test
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Release
on:
push:
tags:
- '*'

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Python 3
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install Ansible
run: pip3 install ansible-core

- name: Trigger a new import on Galaxy.
run: >-
ansible-galaxy role import --api-key ${{ secrets.GALAXY_API_KEY }}
$(echo ${{ github.repository }} | cut -d/ -f1) $(echo ${{ github.repository }} | cut -d/ -f2)
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

5 changes: 2 additions & 3 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ name = "pypi"
[packages]
ansible = "*"
molecule-docker = "*"
pytest-testinfra = "*"
yamllint = "*"
'molecule[docker]' = "*"
'molecule-plugins[docker]' = "*"

[dev-packages]

[requires]
python_version = "3.9"
python_version = "3.12"
980 changes: 536 additions & 444 deletions Pipfile.lock

Large diffs are not rendered by default.

8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Passenger NGINX

[![Build Status](https://travis-ci.org/jobscore/ansible-role-passenger-nginx.svg?branch=master)](https://travis-ci.org/jobscore/ansible-role-passenger-nginx)

Ansible Role for installing Passenger and NGINX for Ruby apps

## Requirements
Expand Down Expand Up @@ -98,8 +96,6 @@ Those values are used to configure their respective values in the [nginx.conf](/
roles:
- role: jobscore.ruby
- role: jobscore.passenger_nginx


```
``` yaml
Expand All @@ -115,15 +111,13 @@ Those values are used to configure their respective values in the [nginx.conf](/
passenger_max_pool_size 6;
passenger_min_instances 6;
passenger_pre_start {{ nginx_server_name }};
```
## License
[MIT](/LICENSE)
Author Information
------------------
This role was created by [Eric Magalhães](https://emagalha.es) while working for [JobScore Inc](https://jobscore.com).
This role was created by [Eric Magalhães](https://emagalha.es) and [Glauber Batista](https://glauberrbatista.dev) while working for [JobScore Inc](https://jobscore.com).
6 changes: 4 additions & 2 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
---
galaxy_info:
author: Eric Magalhães
author: Eric Magalhães and Glauber Batista
description: Ansible Role for installing Passenger and NGINX for Ruby apps
company: JobScore Inc
license: license (MIT)
namespace: jobscore
role_name: passenger_nginx

min_ansible_version: 1.2
min_ansible_version: 2.10
platforms:
- name: Ubuntu
versions:
- bionic
- focal
- jammy
galaxy_tags:
- ruby
- passenger
Expand Down
14 changes: 0 additions & 14 deletions molecule/default/Dockerfile.j2

This file was deleted.

16 changes: 0 additions & 16 deletions molecule/default/INSTALL.rst

This file was deleted.

1 change: 1 addition & 0 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- name: Ensure ruby is present
apt:
name: ruby-full
update_cache: true
roles:
- role: ansible-role-passenger-nginx
nginx_user: www-data www-data
Expand Down
28 changes: 23 additions & 5 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,34 @@ lint: |
yamllint .
platforms:
- name: bionic
image: ubuntu:bionic
image: geerlingguy/docker-ubuntu1804-ansible:latest
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
privileged: true
pre_build_image: true
- name: focal
image: ubuntu:focal
image: geerlingguy/docker-ubuntu2004-ansible:latest
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
privileged: true
pre_build_image: true
- name: jammy
image: geerlingguy/docker-ubuntu2204-ansible:latest
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
privileged: true
pre_build_image: true
provisioner:
name: ansible
lint:
name: ansible-lint
scenario:
name: default
verifier:
name: testinfra
lint:
name: flake8
name: ansible
14 changes: 0 additions & 14 deletions molecule/default/tests/test_default.py

This file was deleted.

40 changes: 40 additions & 0 deletions molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
- hosts: all
roles:
- role: ansible-role-passenger-nginx
nginx_server_name: www.example.com
nginx_vhost_config: |
server {
listen 80 default_server;
server_name {{ nginx_server_name }};
root {{ passenger_app_root }};

location @rubyapp {
passenger_enabled on;
passenger_app_env {{ passenger_app_env }};
}

location / {
try_files $uri $uri/index.html @rubyapp;
}
}
post_tasks:
- name: Check for nginx conf file
stat:
path: /etc/nginx/nginx.conf
register: nginx_conf_check

- name: Ensure nginx conf exists
fail:
msg: "The nginx conf file does not exist"
when: nginx_conf_check.stat.exists == False

- name: Check for passenger conf file
stat:
path: /etc/nginx/conf.d/mod-http-passenger.conf
register: passenger_conf_check

- name: Ensure passenger conf exists
fail:
msg: "The passenger conf file does not exist"
when: passenger_conf_check.stat.exists == False
19 changes: 11 additions & 8 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,29 @@
apt:
name:
- apt-transport-https
- ca-certificates
- curl
- dirmngr
- gnupg
- ca-certificates
- gnupg2
- lsb-release
- ubuntu-keyring
state: present

- name: Ensure Passenger APT key is present
apt_key:
keyserver: keyserver.ubuntu.com
id: 561F9B9CAC40B2F7
state: present
shell:
cmd: curl https://oss-binaries.phusionpassenger.com/auto-software-signing-gpg-key.txt | gpg --dearmor | tee /usr/share/keyrings/phusion-passenger.gpg >/dev/null
changed_when: false

- name: Ensure Passenger APT repo is present
- name: Ensure Passenger APT repo is configured
apt_repository:
repo: >
deb https://oss-binaries.phusionpassenger.com/apt/passenger
deb [signed-by=/usr/share/keyrings/phusion-passenger.gpg] https://oss-binaries.phusionpassenger.com/apt/passenger
{{ ansible_distribution_release }} main
state: present
update_cache: true

- name: Ensure Nginx and Passenger are present (Bionic +)
- name: Ensure Nginx and Passenger are present
apt:
name:
- nginx
Expand Down
Loading