unicorn failing to start on ubuntu 15.04 - ruby-on-rails

I'm following an installation tutorial for unicorn and nginx using this tutorial on ubuntu 15.04. Everything works until the section "Create Unicorn Init Script" where I create the init script, change the required variables, change the permissions and then run
sudo service unicorn_my_app start
Where I get an error that reads
Job for unicorn_my_app.service failed. See "systemctl status unicorn_my_app.service" and "journalctl -xe" for details
When I run
systemctl status unicorn_my_app.service
The output is:
● unicorn_my_app.service - LSB: starts the unicorn app server
Loaded: loaded (/etc/init.d/unicorn_my_app)
Active: failed (Result: exit-code) since Sun 2015-09-27 23:22:49 PDT; 1min 19s ago
Docs: man:systemd-sysv-generator(8)
Process: 26576 ExecStart=/etc/init.d/unicorn_my_app start (code=exited, status=127)
What is happening? why won't unicorn start?

Related

Unable to start jenkins in EC2-AWS linux server

I have installed java 1.8.* and set the JAVA_HOME path, and installed Jenkins from the official website as below in AWS EC2 Linux instance.
Java path: JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.amzn2.0.1.x86_64 and
PATH=$PATH:$HOME/bin:$JAVA_HOME:$MAVEN_HOME:$M2
Jenkins commands used for installation:
sudo wget -O /etc/yum.repos.d/jenkins.repo \
https://pkg.jenkins.io/redhat/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key
sudo yum upgrade
# Add required dependencies for the jenkins package
sudo yum install jenkins
sudo systemctl start jenkins
But jenkins failed to start. I don't have tomcat installed so port 8080 should be available. I have also set Java path at /etc/init.d/jenkins file
under section candidates="/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.amzn2.0.1.x86_64/bin/java"
started Jenkins as per above command, but the service was failing.
Error Description as below:
systemctl start jenkins
Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details.
systemctl status jenkins.service
jenkins.service - Jenkins Continuous Integration Server
Loaded: loaded (/usr/lib/systemd/system/jenkins.service; enabled; vendor preset: disabled)
Active: failed (Result: start-limit) since Wed 2022-12-21 10:15:02 UTC; 10s ago
Process: 20467 ExecStart=/usr/bin/jenkins (code=exited, status=1/FAILURE)
Main PID: 20467 (code=exited, status=1/FAILURE)
Unit jenkins.service entered failed state.
jenkins.service failed.
jenkins.service holdoff time over, scheduling restart.
Stopped Jenkins Continuous Integration Server.
start request repeated too quickly for jenkins.service
Failed to start Jenkins Continuous Integration Server.
Unit jenkins.service entered failed state.
jenkins.service failed.
request if anybody has solution for this, please do help with the resolution. Expecting service should start and running and at browser console I should get the Unlock Jenkins screen window.
Thanks

puma:restart cap production deploy service not found

Rails 7.0.4
Puma 6.0
I am so close to getting cap production deploy to work in production but I'm stuck on puma:restart
I have an active service on the server
deploy#reports:~/apps/R7-reporting-2022/current$ sudo systemctl status R7-reporting-2022_puma_production.service
[sudo] password for deploy:
● R7-reporting-2022_puma_production.service - Puma HTTP Server
Loaded: loaded (/etc/systemd/system/R7-reporting-2022_puma_production.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2022-11-06 19:24:32 UTC; 1h 3min ago
Main PID: 612 (puma)
Tasks: 10 (limit: 4575)
Memory: 177.7M
CPU: 2.258s
CGroup: /system.slice/R7-reporting-2022_puma_production.service
└─612 "puma 6.0.0 (unix:///home/deploy/apps/R7-reporting-2022/shared/tmp/sockets/R7-reporting-2022-puma.sock)" "" "" "" "" "" ">
Nov 06 19:24:32 reports systemd[1]: Started Puma HTTP Server.
When I run bundle exec cap production deploy I get the following error
00:24 puma:restart
01 /bin/systemctl --user restart R7-reporting-2022_puma_production
01 Failed to restart R7-reporting-2022_puma_production.service: Unit R7-reporting-2022_puma_production.service not found.
I'm wondering if the --user part of the command is what's causing the issue?
after further testing I can run the command without --user flag on the server.
/usr/bin/env /bin/systemctl restart R7-reporting-2022_puma_production
Multiple identities can be used for authentication:
1. user (user)
2. deploy user,,, (deploy)
Choose identity to authenticate as (1-2): 2
Password:
==== AUTHENTICATION COMPLETE ===```
I switched from puma to passenger using the following guide. Great instructions, simple implementation. Props to the writer.
Rails Deploy on Ubuntu using Capistrano

Trouble starting the redis server

I am using rails and want to run sidekiq and running sidekiq requires a Redis server to be installed. I installed Redis for my KDE Neon by following the instructions from the digital ocean. Here is the error that is displayed when I try to run sudo systemctl status redis :
redis.service - Redis In-Memory Data Store
Loaded: loaded (/etc/systemd/system/redis.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2021-03-24 17:24:12 IST; 6s ago
Process: 47334 ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf (code=exited, status=203/EXEC)
Main PID: 47334 (code=exited, status=203/EXEC)
Mar 24 17:24:12 maxagno3 systemd[1]: redis.service: Scheduled restart job, restart counter is at 5.
Mar 24 17:24:12 maxagno3 systemd[1]: Stopped Redis In-Memory Data Store.
Mar 24 17:24:12 maxagno3 systemd[1]: redis.service: Start request repeated too quickly.
Mar 24 17:24:12 maxagno3 systemd[1]: redis.service: Failed with result 'exit-code'.
Mar 24 17:24:12 maxagno3 systemd[1]: Failed to start Redis In-Memory Data Store.
Using redis-cli works fine. I assume when I first ran the command sudo systemctl disable redis it deleted the redis.service file. Since then I have uninstalled and installed the Redis but still, the error persists.
Quick help would greatly be appreciated.
The error your showing is hiding your originally error. Redis is basically in a reboot loop, which your error is eluding to. What you need to do is disable this restart functionality to get the underlining problem.
This can be done by doing the following:
Edit the /etc/systemd/system/redis.service
Edit the restart line to Restart=no. The possible options are no, on-success, on-failure, on-abnormal, on-watchdog, on-abort or always.
Edit the start limit interval to StartLimitInterval=0. This is normally set really high to prevent load from spiking by a service constantly restarting
Lastly reload your services for your changes to take affect. This is done by running systemctl daemon-reload
Once your service stops looping, you can try to manually start the service to get the actual error. If the error is too large you can look in your OS's general log greping specifically for Redis, or by running journalctl: journalctl -u redis.service
Hopefully this helps!
If you want clean and repeatable approach I suggest you to always use docker, especially for dev environment.
So starting docker redis as simple as:
docker run -d -p 6379:6379 --name my-redis redis

Error running auditd inside centos docker container: "Unable to set initial audit startup state to 'enable', exiting"

I'm trying to create a docker container with systemd enabled and install auditd on it.
I'm using the standard centos/systemd image provided in dockerhub.
But when I'm trying to start audit, it fails.
Here is the list of commands that I have done to create and get into the docker container:
docker run -d --rm --privileged --name systemd -v /sys/fs/cgroup:/sys/fs/cgroup:ro centos/systemd
docker exec -it systemd bash
Now, inside the docker container:
yum install audit
systemctl start auditd
I'm receiving the following error:
Job for auditd.service failed because the control process exited with error code. See "systemctl status auditd.service" and "journalctl -xe" for details.
Then I run:
systemctl status auditd.service
And I'm getting this info:
auditd[182]: Error sending status request (Operation not permitted)
auditd[182]: Error sending enable request (Operation not permitted)
auditd[182]: Unable to set initial audit startup state to 'enable', exiting
auditd[182]: The audit daemon is exiting.
auditd[181]: Cannot daemonize (Success)
auditd[181]: The audit daemon is exiting.
systemd[1]: auditd.service: control process exited, code=exited status=1
systemd[1]: Failed to start Security Auditing Service.
systemd[1]: Unit auditd.service entered failed state.
systemd[1]: auditd.service failed.
Do you guys have any ideas on why this is happening?
Thank you.
See this discussion:
At the moment, auditd can be used inside a container only for aggregating
logs from other systems. It cannot be used to get events relevant to the
container or the host OS. If you want to aggregate only, then set
local_events=no in auditd.conf.
Container support is still under development.
Also see this:
local_events
This yes/no keyword specifies whether or not to include local events. Normally you want local events so the default value is yes. Cases where you would set this to no is when you want to aggregate events only from the network. At the moment, this is useful if the audit daemon is running in a container. This option can only be set once at daemon start up. Reloading the config file has no effect.
So at least at Date: Thu, 19 Jul 2018 14:53:32 -0400, this feature not support, had to wait.

systemd init script for resque worker

i habe an nginx webserver running on an Ubuntu 16.04 Server.
Now i am trying to build an init script for resque worker and scheduler for a Rails app.
I created a file resque-worker.service in "/etc/systemd/system/" and it looks like this:
[Unit]
Description=resque-worker for pageflow
[Service]
Type=forking
ExecStart=/home/pageflow/pageflow_daad/rake resque:scheduler QUEUE=* RAILS_ENV=production > /home/pageflow/pageflow_daad/log/resqueschedule.log &
[Install]
WantedBy=multi-user.target
For some reason after executing "systemctl daemon-reload" and "systemctl start name.service" i get this error:
$ systemctl status resque-worker.service
● resque-worker.service - resque-worker for pageflow
Loaded: loaded (/etc/systemd/system/resque-worker.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2017-05-17 15:52:38 CEST; 15s ago
Process: 28096 ExecStart=/home/pageflow/pageflow_daad/rake resque:scheduler QUEUE=* RAILS_ENV=production > /home/pageflow/pageflow_daad/log/resqueschedule.log & (code=exited, status=203/EXEC)
May 17 15:52:38 ostheim systemd[1]: Starting resque-worker for pageflow...
May 17 15:52:38 ostheim systemd[1]: resque-worker.service: Control process exited, code=exited status=203
May 17 15:52:38 ostheim systemd[1]: Failed to start resque-worker for pageflow.
May 17 15:52:38 ostheim systemd[1]: resque-worker.service: Unit entered failed state.
May 17 15:52:38 ostheim systemd[1]: resque-worker.service: Failed with result 'exit-code'.
In this case i used the root path of my Rails app for "/home/pageflow/pageflow_daad/rake".
The times before where i tried the path of the rake binary i got the error:May 17 15:30:26 ostheim rake[26846]: rake aborted!
May 17 15:30:26 ostheim rake[26846]: ArgumentError: couldn't find HOME environment -- expanding~'`
I hope someone with more experience in this can help me out.
Thanks in advance and best regards,
Ronald
After studying the several docu sites and the documentation itself i found a way to get this running. Just wanted to post this if someone finds this to be helpfull:
[Unit]
Description=resque-scheduler for pageflow
[Service]
User=yourUser
WorkingDirectory=/path/to/rails/app
ExecStart=/path/to/executeable/rake resque:scheduler &
Environment=QUEUE=*
Environment=RAILS_ENV=production
[Install]
WantedBy=multi-user.target
With this script, a
systemctl daemon-reload
&
systemctl start example.service
The Service startet running and runs like a charm.
I think there 2 types of errors inside the systemd unit. Here are some advices :
1) Let systemd capture your application logs, then use journalctl to look at it
journalctl -u resque-worker.service
2) Use env the systemd way :
[Unit]
Description=resque-worker for pageflow
[Service]
Type=forking
ExecStart=/home/pageflow/pageflow_daad/rake resque:scheduler
Environement=QUEUE=*
Enrironement=RAILS_ENV=production
[Install]
WantedBy=multi-user.target
Then,
systemctl daemon-reload
systemctl restart resque-worker.service

Resources