MongoDB won't start on Fedora/Linux - ruby-on-rails

Just finished installing mongodb using
sudo yum install mongodb
But when I try running 'mongo' for a rails app I get
[thiago#netbox mongoExample]$ mongo
MongoDB shell version: 2.2.4
connecting to: test
Wed Aug 21 16:07:56 exec error: src/mongo/shell/mongo.js:91 couldn't connect to server 127.0.0.1:27017
db = new Mongo().getDB( url );
^
exception: connect failed
I have also tried:
[thiago#netbox mongoExample]$ service mongo start
Redirecting to /bin/systemctl start mongo.service
Failed to issue method call: Access denied
[thiago#netbox mongoExample]$ sudo service mongo start
[sudo] password for thiago:
Redirecting to /bin/systemctl start mongo.service
Failed to issue method call: Unit mongo.service failed to load: No such file or directory. See system logs and 'systemctl status mongo.service' for details.
[thiago#netbox mongoExample]$ systemctl status mongo.service
mongo.service
Loaded: error (Reason: No such file or directory)
Active: inactive (dead)
I tried following their documentation (http://docs.mongodb.org/manual/tutorial/install-mongodb-on-red-hat-centos-or-fedora-linux/) with no luck.
I appreciate any help. Thanks in advance!

Related

403 forbidden nginx on docker/ddev website

I am attempting to deploy a site locally with Docker with DDev, using WSL2. I have gotten as far as getting phpMyAdmin working, and I have a ddev url, but when I try to use ddev launch and/or goto the http://sitename.ddev.site I get a 403 error.
So far I have tried to change docroot to public and that didn't work. Additionally I have SSH'd into the docker container, and all of the appropriate files are there. My directory hierarchy looks like (using ls in the powershell):
~/dev/project_name$ ls
composer.json composer.lock project_name public sites vendor
Additionally, and this may be a separate question and possibly unrelated - but in the event that it isn't - when I run the drupal installation command with:
ddev exec drush site:install --account-name=admin --account-pass=admin
I get asked for database name/driver/username/password/host/port - of which I'm not totally sure what information it expects me to supply. I managed to find the database information in Docker, but I haven't been able to correctly supply it the correct information, apparently. The input and output:
Database name [drupal]:
> db
Database driver [mysql]:
> mysql
Database username [drupal]:
> db
Database password [drupal]:
> root
Database host [127.0.0.1]:
> localhost
Database port [3306]:
> 3306
[warning] Program UNKNOWN not found. Proceed if you have already created or emptied the Drupal database.
Do you want to continue? (yes/no) [yes]:
> yes
[notice] Starting Drupal installation. This takes a while.
[notice] Performed install task: install_select_language
[notice] Performed install task: install_select_profile
[notice] Performed install task: install_load_profile
[notice] Performed install task: install_verify_requirements
In install.core.inc line 971:
Database name field is required.
Database username field is required.
Resolve all issues below to continue the installation. For help configuring your database server, see the <a href="https://www.dr
upal.org/docs/8/install">installation handbook</a>, or contact your hosting provider.<div class="item-list"><ul><li>Failed to con
nect to your database server. The server reports the following message: <em class="placeholder">SQLSTATE[HY000] [2002] No such fi
le or directory</em>.<ul><li>Is the database server running?</li><li>Does the database exist or does the database user have suffi
cient privileges to create the database?</li><li>Have you entered the correct database name?</li><li>Have you entered the correct
username and password?</li><li>Have you entered the correct database hostname and port number?</li></ul></li></ul></div>
Failed to execute command drush site:install --account-name=admin --account-pass=admin: exit status 1```
The next notice should be this:
[notice] Performed install task: install_verify_database_ready
Maybe the database is down, not connected, or the access data is wrong.
Check the drush status:
ddev exec drush st
Drupal version : 9.3.2
Site URI : http://my-drupal9-site.ddev.site
DB driver : mysql
DB hostname : ddev-my-drupal9-site-db
DB port : 3306
DB username : db
DB name : db
Database : Connected
Steps to reproduce, without the error
install brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
install ddev
brew install drud/ddev/ddev
start container
cd ~/dockertests/
mkdir my-drupal9-site
cd my-drupal9-site
ddev config --project-type=drupal9 --docroot=web --create-docroot
ddev start
ddev composer create "drupal/recommended-project"
ddev composer require drush/drush
ddev drush site:install -y
ddev drush uli
ddev launch
# [success] Installation complete. User name: admin User password: XXXX
install drupal again
ddev exec drush site:install --account-name=admin --account-pass=admin

nginx permission denied accessing puma socket that does exist in the correct location

On a Digital Ocean droplet running Ubuntu 21.10 impish I am deploying a bare bones Rails 7.0.0.alpha2 application to production. I am setting up nginx as the reverse proxy server to communicate with Puma acting as the Rails server.
I wish to run puma as a service using systemctl without sudo root privileges. To this effect I have a puma service setup in the users home folder located at ~/.config/systemd/user, the service is enabled and runs as I would expect it to run.
systemctl status --user puma_master_cms_production
reports the following
● puma_master_cms_production.service - Puma HTTP Server for master_cms (production)
Loaded: loaded (/home/comtechmaster/.config/systemd/user/puma_master_cms_production.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2021-11-18 22:31:02 UTC; 1h 18min ago
Main PID: 1577 (ruby)
Tasks: 10 (limit: 2338)
Memory: 125.1M
CPU: 2.873s
CGroup: /user.slice/user-1000.slice/user#1000.service/app.slice/puma_master_cms_production.service
└─1577 puma 5.5.2 (unix:///home/comtechmaster/apps/master_cms/shared/tmp/sockets/puma_master_cms_production.sock)
Nov 18 22:31:02 master-cms systemd[749]: Started Puma HTTP Server for master_cms (production).
The rails production.log is empty.
The puma error log shows the following
cat log/puma_error.log
=== puma startup: 2021-11-18 22:31:05 +0000 ===
The pid files exist in the application roots shared/tmp/pids folder
ls tmp/pids
puma.pid puma.state
and the socket that nginx needs but is unable to connect to due to permission denied exists
ls -l ~/apps/master_cms/shared/tmp/sockets/
total 0
srwxrwxrwx 1 comtechmaster comtechmaster 0 Nov 18 22:31 puma_master_cms_production.sock
nginx is up and running and providing a
502 bad gateway
response. The nginx error log reports the following error
2021/11/18 23:18:43 [crit] 1500#1500: *25 connect() to unix:/home/comtechmaster/apps/master_cms/shared/tmp/sockets/puma_master_cms_production.sock failed (13: Permission denied) while connecting to upstream, client: 86.160.191.54, server: 159.65.50.229, request: "GET / HTTP/2.0", upstream: "http://unix:/home/comtechmaster/apps/master_cms/shared/tmp/sockets/puma_master_cms_production.sock:/500.html"
sudo nginx -t reports the following
sudo nginx -t
nginx: [warn] could not build optimal proxy_headers_hash, you should increase either proxy_headers_hash_max_size: 512 or proxy_headers_hash_bucket_size: 64; ignoring proxy_headers_hash_bucket_size
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successfu
just to be pedantic both an ls and a sudo ls to the path reported in the error shows
ls /home/comtechmaster/apps/master_cms/shared/tmp/sockets/
puma_master_cms_production.sock
as expected so I am stumped to understand why nginx running as root using sudo service nginx start is being denied access to a socket that exists, that is owned by the local user rather than root.
I expect the solution is going to be something totally obvious but I can not see what
This problem ended up being related to the folder permissions for the users home folder and specifically a change in the way Ububntu 20.10 sets permissions differently to previous versions of ubuntu, or at least a difference in the way the DigitalOcean setup scripts behave.
This was resolved with a simple command line chmod o=rx from the /home against the user folder concerned e.g.
cd /home
chmod o=rx the_home_folder_for_user

Permission error when starting workspace on Laradock Docker on Windows 10

Each time when starting docker-compose up on Laradock, receives Permission error for workspace laradock on Windows 10. I have tried restarting but not working.
PS D:\projects\sites\laradock> docker-compose up -d nginx mysql phpmyadmin redis workspace
laradock_redis_1 is up-to-date
laradock_mysql_1 is up-to-date
laradock_docker-in-docker_1 is up-to-date
laradock_phpmyadmin_1 is up-to-date
Starting laradock_workspace_1 ... error
ERROR: for laradock_workspace_1 Cannot start service workspace: driver failed programming external connectivity on endpoint laradock_workspace_1 (cc289cd2758bb1c99d3f8aab7243220a94078e19b2a1f4a08e4b0b01fbba64a3): Error starting userland proxy: Bind for 0.0.0.0:2222: unexpected error Permission denied
ERROR: for workspace Cannot start service workspace: driver failed programming external connectivity on endpoint laradock_workspace_1 (cc289cd2758bb1c99d3f8aab7243220a94078e19b2a1f4a08e4b0b01fbba64a3): Error starting userland proxy: Bind for 0.0.0.0:2222: unexpected error Permission denied
ERROR: Encountered errors while bringing up the project.
I think you can find your answer here .In short you should execute this command netcfg -d this will clean up all networking devices, and requires a reboot

can't start elastic search server

I'm trying to start my elastic search server but get the following error
* Starting Elasticsearch Server
sysctl: setting key "vm.max_map_count": Read-only file system
Any idea how to fix this? I've tried reinstalling the whole thing but to no avail.
Full actions below
rs191919:~/workspace/sample_app (elastic-again) $ wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.7.0.deb
--2016-03-11 17:21:12-- https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.7.0.deb
Resolving download.elasticsearch.org (download.elasticsearch.org)... 23.21.221.132, 23.21.209.176, 23.23.251.246, ...
Connecting to download.elasticsearch.org (download.elasticsearch.org)|23.21.221.132|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 27320700 (26M) [application/x-debian-package]
Saving to: ‘elasticsearch-1.7.0.deb.1’
100%[==========================================================================================================>] 27,320,700 22.5MB/s in 1.2s
2016-03-11 17:21:14 (22.5 MB/s) - ‘elasticsearch-1.7.0.deb.1’ saved [27320700/27320700]
rs191919:~/workspace/sample_app (elastic-again) $ sudo dpkg -i elasticsearch-1.7.0.deb
Selecting previously unselected package elasticsearch.
(Reading database ... 125961 files and directories currently installed.)
Preparing to unpack elasticsearch-1.7.0.deb ...
Creating elasticsearch group... OK
Creating elasticsearch user... OK
Unpacking elasticsearch (1.7.0) ...
Setting up elasticsearch (1.7.0) ...
Processing triggers for ureadahead (0.100.0-16) ...
rs191919:~/workspace/sample_app (elastic-again) $ sudo update-rc.d elasticsearch defaults 95 10
System start/stop links for /etc/init.d/elasticsearch already exist.
rs191919:~/workspace/sample_app (elastic-again) $ sudo /etc/init.d/elasticsearch start
* Starting Elasticsearch Server sysctl: setting key "vm.max_map_count": Read-only file system
rs191919:~/workspace/sample_app (elastic-again) $ curl http://localhost:9200
curl: (7) Failed to connect to localhost port 9200: Connection refused
rs191919:~/workspace/sample_app (elastic-again) $

PG error on running rails application

On running my rails application I am getting the follwoing error
PGError (could not connect to server: Connection refused
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.1024"?
):
I tried the command
/etc/init.d/postgresql restart
I am getting the following:
Stopping postgresql service: [FAILED]
Initializing database: mkdir: cannot create directory `/var/lib/pgsql/data/pg_log': File exists
[FAILED]
Starting postgresql service: [FAILED]
This error is not connected with Ruby on Rails. You should check permissions for PostgreSQL log directory. Also you need to be sure that you are starting Postgres daemon as root:
sudo /etc/init.d/postgresql start

Resources