Skip to content

Commit

Permalink
Merge pull request #31 from verdaccio/28-does-not-start
Browse files Browse the repository at this point in the history
[#28] Verdaccio does not start.
  • Loading branch information
030 authored Dec 20, 2020
2 parents 16f0dc3 + ef72d9d commit db6d24f
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 98 deletions.
13 changes: 4 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
---
language: python
python:
- 3.8

services: docker

env:
Expand All @@ -19,17 +22,9 @@ before_install:
- curl https://gist.githubusercontent.com/geerlingguy/ce883ad4aec6a5f1187ef93bd338511e/raw/36612d28981d92863f839c5aefe5b7dd7193d6c6/travis-ci-docker-upgrade.sh | sudo bash # yamllint disable-line

install:
# Install test dependencies.
- pip install molecule docker

before_script:
# Use actual Ansible Galaxy role name for the project directory.
- cd ../
- mv ansible-$ROLE_NAME $ORG_NAME.$ROLE_NAME
- cd $ORG_NAME.$ROLE_NAME
- curl https://gist.githubusercontent.com/030/fa2454b56c525286b39d549583173d8e/raw/c9f9cf439339819958e13cad1d5b5f719217d427/ansible-ci-requirements.sh | sudo bash # yamllint disable-line rule:line-length

script:
# Run tests.
- molecule test

notifications:
Expand Down
16 changes: 9 additions & 7 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
---
verdaccio_version: ''
verdaccio_configdir: '/home/verdaccio/verdaccio'
verdaccio_datadir: '/home/verdaccio/verdaccio'
verdaccio_plugins: # Must be a list of name/version for the plugins
verdaccio: /usr/bin/verdaccio
verdaccio_version: ""
verdaccio_configdir: "/home/verdaccio/verdaccio"
verdaccio_datadir: "/home/verdaccio/verdaccio"
verdaccio_plugins: # Must be a list of name/version for the plugins
# For example:
# - name: verdaccio-ldap
# version: 4.2.0
# - name: verdaccio-groupnames
# version: 1.0.4-1
verdaccio_pluginsdir: "{{verdaccio_datadir}}/plugins"
verdaccio_web_title: 'Verdaccio'
verdaccio_systemd_state: started
verdaccio_web_title: "Verdaccio"
verdaccio_web_gravatar: false
verdaccio_web_sort_packages: asc
verdaccio_listen_address: 0.0.0.0
Expand All @@ -29,8 +31,8 @@ verdaccio_uplinks:

verdaccio_packages:
# Default packages using default parameters (bellow)
'@*/*':
'**':
"@*/*":
"**":
# Example with custom parameters:
# '@fortawesome/*':
# proxy:
Expand Down
1 change: 1 addition & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ dependencies:
- src: geerlingguy.nodejs
version: 5.1.1
name: geerlingguy.nodejs
become: true
10 changes: 10 additions & 0 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- name: Converge
hosts: all
become: true

vars:
nodejs_install_npm_user: root

roles:
- role: ansible-verdaccio
2 changes: 1 addition & 1 deletion molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ provisioner:
lint:
name: ansible-lint
playbooks:
converge: ${MOLECULE_PLAYBOOK:-playbook.yml}
converge: ${MOLECULE_PLAYBOOK:-converge.yml}
scenario:
name: default
verifier:
Expand Down
15 changes: 0 additions & 15 deletions molecule/default/playbook.yml

This file was deleted.

10 changes: 10 additions & 0 deletions molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
# This is an example playbook to execute Ansible tests.

- name: Verify
hosts: all
gather_facts: false
tasks:
- name: Example assertion
assert:
that: true
98 changes: 47 additions & 51 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,4 @@
---
- name: verdaccio installed
npm:
name: verdaccio
version: "{{ verdaccio_version | default(omit) }}"
global: true
notify: restart verdaccio

- name: verdaccio plugins installed
npm:
name: "{{ item.name }}"
version: "{{ item.version | default(omit) }}"
path: "{{ verdaccio_pluginsdir }}"
with_items: "{{ verdaccio_plugins }}"
when: verdaccio_plugins is not none

- name: verdaccio user created
user:
name: verdaccio

- name: resolve npm config path
command: npm config get prefix --no-update-notifier
register: npm_config_prefix_resolve
Expand All @@ -31,39 +12,54 @@
("FAILED" not in npm_config_prefix_resolve.stderr) and
(npm_config_prefix_resolve.stdout | length > 0)
- name: deploy verdaccio systemd unit
template:
src: verdaccio.service.j2
dest: /etc/systemd/system/verdaccio.service
mode: 0600
notify: systemd daemon-reload
- block:
- name: verdaccio installed
npm:
name: verdaccio
version: "{{ verdaccio_version | default(omit) }}"
global: true
notify: restart verdaccio

- name: verdaccio user created
user:
name: verdaccio

- name: deploy verdaccio systemd unit
template:
src: verdaccio.service.j2
dest: /etc/systemd/system/verdaccio.service
mode: 0600
notify: systemd daemon-reload

- name: verdaccio service enabled
systemd:
name: verdaccio
enabled: true
- name: verdaccio service enabled
systemd:
name: verdaccio
enabled: true
state: started

- name: verdaccio directories creation
file:
path: "{{ item }}"
state: directory
owner: verdaccio
mode: 0755
loop:
- "{{ verdaccio_datadir }}"
- "{{ verdaccio_configdir }}"
- name: verdaccio directories creation
file:
path: "{{ item }}"
state: directory
owner: verdaccio
mode: 0755
loop:
- "{{ verdaccio_datadir }}"
- "{{ verdaccio_configdir }}"

- name: config deployed
template:
src: config.j2
dest: "{{ verdaccio_configdir }}/verdaccio.yml"
owner: verdaccio
mode: 0600
notify: restart verdaccio
- name: config deployed
template:
src: config.j2
dest: "{{ verdaccio_configdir }}/verdaccio.yml"
owner: verdaccio
mode: 0600
notify: restart verdaccio
become: true

- name: install logrotate script
template:
src: logrotate.j2
dest: /etc/logrotate.d/verdaccio
owner: root
mode: 0644
- name: verdaccio plugins installed
npm:
name: "{{ item.name }}"
version: "{{ item.version | default(omit) }}"
path: "{{ verdaccio_pluginsdir }}"
with_items: "{{ verdaccio_plugins }}"
when: verdaccio_plugins is not none
14 changes: 0 additions & 14 deletions templates/logrotate.j2

This file was deleted.

2 changes: 1 addition & 1 deletion templates/verdaccio.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Description=verdaccio Service
Type=simple
User=verdaccio
WorkingDirectory={{ verdaccio_datadir }}
ExecStart={{ npm_config_prefix }}/bin/verdaccio -c {{ verdaccio_configdir }}/verdaccio.yml
ExecStart={{ verdaccio }} -c {{ verdaccio_configdir }}/verdaccio.yml

[Install]
WantedBy=multi-user.target

0 comments on commit db6d24f

Please sign in to comment.