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

Fix pm2-process restart error #11

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 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
10 changes: 8 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,15 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt install docker
. /etc/os-release
echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/Release.key | sudo apt-key add -
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y install podman
python -m pip install --upgrade pip
pip install -r requirements.txt
ansible-galaxy install -r requirements.yml
- name: Test with molecule
run: |
molecule test
molecule test --all
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ coverage.xml
*.py,cover
.hypothesis/
.pytest_cache/
.vagrant

# Translations
*.mo
Expand Down
36 changes: 14 additions & 22 deletions .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,32 @@
# Based on ansible-lint config
extends: default

ignore: |
.github/

rules:
braces:
min-spaces-inside: 1
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 0
max-spaces-inside: 1
level: error
colons:
max-spaces-after: 1
max-spaces-after: -1
level: error
commas:
max-spaces-after: 1
level: error
comments:
require-starting-space: true
comments-indentation: enable
document-start:
present: true
max-spaces-after: -1
level: error
comments: disable
comments-indentation: disable
document-start: disable
empty-lines:
max: 2
max: 3
level: error
hyphens:
max-spaces-after: 1
level: error
indentation:
spaces: 2
indentation: disable
key-duplicates: enable
line-length:
max: 89
new-line-at-end-of-file: enable
trailing-spaces: enable
truthy: enable
line-length: disable
new-line-at-end-of-file: disable
new-lines:
type: unix
trailing-spaces: disable
truthy: disable
6 changes: 2 additions & 4 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,21 @@ express_system_wide_dependencies:
- git
- nodejs
- yarn
- nodejs-legacy
express_node_version: 10.x
express_node_version: 12.x

# app
express_env_name: "prod"
express_app_name: "{{ express_system_user }}"
express_codebase_path: "{{ express_system_user_home }}/app"
express_versioned_path: "{{ express_codebase_path }}-versioned"
express_checkout_path: "{{ express_versioned_path }}/{{ ansible_date_time['epoch'] }}"
express_app_path: "{{ express_checkout_path }}/server"
express_app_path: "{{ express_checkout_path }}"
express_log_path: "/var/log/{{ express_app_name }}"
express_service_name: "{{ express_system_user }}"
express_pm2_path: "/usr/bin/pm2"
express_max_versioned_folders: 10
express_package_json_paths:
- "{{ express_app_path }}"
- "{{ express_checkout_path }}"

# app settings
express_app_settings:
Expand Down
3 changes: 3 additions & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ galaxy_info:
- name: ubuntu
versions:
- all

# dependencies:
# - src: weareinteractive.pm2
24 changes: 0 additions & 24 deletions molecule/default/molecule.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
express_system_group: "www-data"
express_system_user_home: "/home/{{ express_system_user }}"
express_node_version: 10.x
express_git_url: "https://github.com/onaio/reveal-frontend"
express_git_version: "v0.4.0-rc11"
express_git_url: "https://github.com/onaio/reveal-express"
express_git_version: "v1.0.0"
express_app_settings:
NODE_ENV: "production"
NODE_ENV: "production"
SKIP_PREFLIGHT_CHECK: "true"
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@
loop:
- curl
- gpg-agent
- tmux
- vim
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def test_ensure_directories_are_present(host):


def test_check_env_file(host):
express_env_path = host.file("/home/express/app/server/.env")
express_env_path = host.file("/home/express/app/.env")
express_env_path.exists
assert "NODE_ENV" in express_env_path.content_string

Expand All @@ -71,6 +71,6 @@ def test_express_is_running(host):


def test_express_service_is_up(host):
express_service = host.service("express.service")
express_service = host.service("pm2-express.service")
assert express_service.is_running
assert express_service.is_enabled
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
*******
Docker driver installation guide
Podman driver installation guide
*******

Requirements
============

* Docker Engine
* Podman Engine

Install
=======
Expand All @@ -19,4 +19,4 @@ widely recommended `'--user' flag`_ when invoking ``pip``.

.. code-block:: bash

$ pip install 'molecule[docker]'
$ pip install 'molecule[podman]'
43 changes: 43 additions & 0 deletions molecule/ubuntu1804/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
dependency:
name: galaxy
driver:
name: podman
platforms:
- name: instance
image: geerlingguy/docker-ubuntu1804-ansible
pre_build_image: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
privileged: true
command: "/lib/systemd/systemd"
provisioner:
name: ansible
options:
vvv: True
log: True
playbooks:
prepare: ../resources/playbooks/prepare.yml
converge: ../resources/playbooks/converge.yml
verifier:
name: testinfra
directory: ../resources/tests/
scenario:
test_sequence:
- dependency
- lint
- cleanup
- destroy
- syntax
- create
- prepare
- converge
- side_effect
- verify
- cleanup
- destroy
# lint: |
# set -e
# yamllint .
# ansible-lint
# flake8
22 changes: 22 additions & 0 deletions molecule/ubuntu2004/INSTALL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
*******
Podman driver installation guide
*******

Requirements
============

* Podman Engine

Install
=======

Please refer to the `Virtual environment`_ documentation for installation best
practices. If not using a virtual environment, please consider passing the
widely recommended `'--user' flag`_ when invoking ``pip``.

.. _Virtual environment: https://virtualenv.pypa.io/en/latest/
.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site

.. code-block:: bash

$ pip install 'molecule[podman]'
42 changes: 42 additions & 0 deletions molecule/ubuntu2004/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
dependency:
name: galaxy
driver:
name: podman
platforms:
- name: instance
image: jgeusebroek/ubuntu2004-molecule
pre_build_image: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
privileged: true
command: "/lib/systemd/systemd"
provisioner:
name: ansible
log: True
playbooks:
prepare: ../resources/playbooks/prepare.yml
converge: ../resources/playbooks/converge.yml
verifier:
name: testinfra
directory: ../resources/tests/
scenario:
test_sequence:
- dependency
# - lint TODO - lint
- cleanup
- destroy
- syntax
- create
- prepare
- converge
# - idempotence TODO - idempotence
- side_effect
- verify
- cleanup
- destroy
# lint: |
# set -e
# yamllint .
# ansible-lint
# flake8
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
molecule[docker]==3.0.2
molecule[podman]==3.0.4
ansible-lint==4.2.0
yamllint==1.20.0
testinfra==4.1.0
Expand Down
2 changes: 2 additions & 0 deletions requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
- weareinteractive.pm2
Loading