Skip to content

Add: Update ploy publish to include systemd files#41

Open
c-badilla-manta wants to merge 2 commits intomasterfrom
feature/support-systemd
Open

Add: Update ploy publish to include systemd files#41
c-badilla-manta wants to merge 2 commits intomasterfrom
feature/support-systemd

Conversation

@c-badilla-manta
Copy link
Copy Markdown

@c-badilla-manta c-badilla-manta commented Aug 22, 2024

Description of Changes

This change adds support for the creation of deb packages compatible with the systemd service manager.

To publish a deb package for systemd, you have to add the following new fields to the .ploy_publisher.ymlfile.

  • systemd_files: a list of paths where the systemd .service file is located
  • mnt_log_path (optional): This configuration is to declare where the service logs will be located. By default:/mnt/SERVICE_NAME
    Example:
systemd_files:
  - ../service-a/init/service-a.service
mnt_log_path: /mnt/service-a

Testing

Setup

  1. Clone the ploy code in a ubuntu server
  2. Run the following script to install the dependencies
gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
curl -sSL https://get.rvm.io | bash -s stable
source ~/.zshrc
rvm pkg install openssl
rvm install 2.4.1 --with-openssl-dir=$HOME/.rvm/usr
bash --login
rvm use 2.4.1
gem install bundler:2.2.17
bundle install
  1. Comment lines 14->16 in lib/ploy/publisher.rb file, to avoid publishing packages to S3.

Systemd

  1. Configure the .ploy_publisher.yml file adding the two new options:
  • systemd_files: a list of paths where the systemd .service file is located
  • mnt_log_path (optional): This configuration is to declare where the service logs will be located
    Example:
upstart_files:
  - ../service-a/init/service-a
systemd_files:
  - ../service-a/init/service-a.service
mnt_log_path: /mnt/service-a
  1. Execute the ploy publish command:
env RUBYLIB=./lib bundle exec bin/ploy publish PATH_TO_PLOY_PUBLISHER_YML
  1. The deb package will be stored in the current path.
  2. Copy the deb package to a ubuntu server with systemd service manager.
  3. Install the package with the following command
sudo dpkg -i DEB_PACKAGE
  1. Verify that the service is running:
systemctl status SERVICE_NAME

Upstart

  1. Configure the .ploy_publisher.yml file without the two new options:
  • systemd_files: a list of paths where the systemd .service file is located
  • mnt_log_path (optional): This configuration is to declare where the service logs will be located
    Example:
upstart_files:
  - ../service-a/init/service-a
  1. Execute the ploy publish command:
env RUBYLIB=./lib bundle exec bin/ploy publish PATH_TO_PLOY_PUBLISHER_YML
  1. The deb package will be stored in the current path.
  2. Copy the deb package to a ubuntu server with upstart service manager.
  3. Install the package with the following command
sudo dpkg -i DEB_PACKAGE
  1. Verify that the service is running:
service SERVICE_NAME status

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant