Develop WordPress theme with Git on Dreamhost - wordpress

I am trying to set up my first Git based WordPress theme development using roots as my starting theme. I was planning to develop a theme locally and push to my Dreamhost VPS every now and then. Read some info on the Dreamhost Wiki. I also followed David Winter's tutorial on setting up a WordPress core update option with Git.
I also set up another repo for my theme with the theme roots as a basis. Perhaps I should have made it a submodule too, but I am just learning by doing here.. I set up a bare repo on the server and locally I tried to make a pull request, but this is not working.
Locally
For my local theme I have this:
$ pwd
/opt/local/www/imagewize/wp-content/themes/img/.git
jaspersmbp:.git jasper$ cat config
and here the git config file for the theme:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
[remote "origin"]
url = ssh://me#domain.com/~/domain.com/wp-content/themes/img
fetch = +refs/heads/*:refs/remotes/origin/*
WordPress submodule details are:
location:
$ pwd
/opt/local/www/imagewize
Git config file:
core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
[submodule "wordpress"]
url = git://github.com/WordPress/WordPress.git
Remote
On the remote DH VPS inside the theme I have this config:
core]
repositoryformatversion = 0
filemode = true
bare = true
When I am inside the theme locally and try to connect to Dreamhost VPS I get:
$ git pull origin master
fatal: Couldn't find remote ref master
me:img jasper$ fatal: The remote end hung up unexpectedly
Debugging
$ git branch -a
loads nada locally..
git push origin master
error: src refspec master does not match any.
error: failed to push some refs to 'ssh://me#domain.com/~/imagewize.com/wp-content/themes/img'
Update
Adjusted url in config and now I get:
git push origin master
fatal: '/imagewize.com/wp-content/themes/img' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
Update II
I did some more online reading and after I found src refspec master does not match any when pushing commits in git I realized I did do adds, but no commit.
git commit -m 'Initial commit'
[master (root-commit) 7bbcd6a] Initial commit
137 files changed, 17766 insertions(+)
create mode 100644 .gitignore
.........
And then:
$ git push origin master
Counting objects: 150, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (144/144), done.
Writing objects: 100% (150/150), 259.70 KiB, done.
Total 150 (delta 26), reused 0 (delta 0)
To ssh://me#domain.com/~/domain.com/wp-content/themes/img/
* [new branch] master -> master
And we are up and running!
Only somehow my local files were not uploaded to the remote theme folder
$ ls -lha
total 16K
drwxrwxr-x 7 me server 147 Oct 7 20:21 .
drwxr-xr-x 6 me server 105 Oct 7 20:21 ..
-rw-rw-r-- 1 me server 23 Oct 7 20:21 HEAD
drwxrwxr-x 2 me server 10 Oct 7 20:21 branches
-rw-rw-r-- 1 me server 66 Oct 7 20:21 config
-rw-rw-r-- 1 me server 73 Oct 7 20:21 description
drwxrwxr-x 2 me server 4.0K Oct 7 20:21 hooks
drwxrwxr-x 2 me server 28 Oct 7 20:21 info
drwxrwxr-x 4 me server 40 Oct 7 20:21 objects
drwxrwxr-x 4 me server 41 Oct 7 20:21 refs
, but I should work that out soon enough..
Update III
Bare repositories do not have a working directory it seems explained here. They seem to say I should clone on production. So wherever I create the bare repository is not where I clone the final result.

Will just have to change the setup. Where I push to will just be the git repo for keeping track of changes like Github and wherever I want to have the end result I will clone the repo.

Related

User Plugin in Artifactory not loading

I have Artifactory 6.20.1 running in a Docker container. I'm trying to install the artifactCleanup plugin (https://github.com/jfrog/artifactory-user-plugins/tree/master/cleanup/artifactCleanup)
I have put the artifactCleanup.groovy file in the corresponding folder:
$ ls -all /opt/jfrog/artifactory/var/etc/artifactory/plugins/
total 36
drwxr-xr-x 2 artifact artifact 4096 Feb 24 10:28 .
drwxr-xr-x 3 artifact artifact 4096 Feb 23 15:24 ..
-rwxr-xr-x 1 artifact artifact 5829 Feb 23 15:25 README.md
-rwxr-xr-x 1 artifact artifact 14043 Feb 23 15:26 artifactCleanup.groovy
-rwxr-xr-x 1 artifact artifact 325 Feb 24 10:28 artifactCleanup.json
However if I'm trying to see my loaded plugins I get an empty response
curl -X GET -u "admin:password" http://localhost:8081/artifactory/api/plugins
{}
The Server has been restarted before running that request. All commands have been running inside the Docker container. I have been looking at the documentation (https://www.jfrog.com/confluence/display/JFROG/User+Plugins) on how to install plugins. My User account which was used for the rest calls is an admin account.
Now I am out of clues, why that plugin is not loading?
You can use the below reload plugins using the Reload Plugins REST API endpoint.
https://www.jfrog.com/confluence/display/JFROG/Artifactory+REST+API#ArtifactoryRESTAPI-ReloadPlugins
Please comment here if you are running into any issues.
Turns out I created a wrong directory. Correct directory is
/var/opt/jfrog/artifactory/etc/plugins
which already existed.

How to grant nginx permissions to phpMyAdmin on synology diskstation

I have a Synology Diskstation DS216se running DSM 6.2.3-25426. I've installed MariaDB 10, Web Station, PHP 7.2, and myPhpAdmin, but when I open it at http://diskstation/phpMyAdmin/ I get this error message
"Sorry, the page you are looking for is not found."
I'm using an nginx server in Web Station, and the error log at /var/log/nginx/error.log contains multiple entries like the following
*621 open() "/var/services/web/phpMyAdmin/js/vendor/jquery/jquery.debounce-1.0.5.js" failed (13: Permission denied)
The file, and all other files with permission denied entries in the logs, exist in the /var/services/web/phpMyAdmin/ directory - what permissions need to be granted to the directory for this to succeed?
I hit this as well. I managed to recover, but it effectively amounts to hard clearing any evidence of prior installs of Web Station, PHP 7.2, phpMyAdmin, and any other web related services. Then manually ripping out some bad directories with broken symlinks/permissions.
My hypothesis is that I tried to install adminer prior to this and - having not done any set up for Web Station et. al. - it put the filesystem in a bad state.
I am not willing to try installing adminer again to test this hypothesis.
What I did to fix this:
Backup what you need (e.g., any personal web site).
SSH into your diskstation. Please be aware of what you are doing and keep in mind the big picture. Don't go deleting random things.
Uninstall Web Station, PHP 7.2, Apache, phpMyAdmin, etc. Anything that Web Station would ultimately be inclined to read and serve up.
Verify that /var/services/web doesn't contain anything you care about, and delete it (sudo rm -rf /var/services/web).
Verify that /volume1/web doesn't contain anything you care about, and delete everything inside it (sudo rm -rf /var/services/web). You may need to chmod permissions for this - I ended up leaving the web directory itself intact, but nothing inside.
Reboot. Mount any encrypted disks, etc.
Check that /var/services/web now shows it is symlinked to /volume1/web, e.g. sudo readlink -e /var/services/web.
Also check permissions for /volume1/web, e.g. ls -al /volume1. It should be owned by root:root and have permissive (777) bits.
Install Web Station, PHP 7.2, and phpMyAdmin in that order.
After this, I could open phpMyAdmin and be served its log in screen.
Debugging notes:
For me, when I SSH in I see in the logs similar issues:
2020/12/17 10:36:35 [error] 32658#32658: *1028 "/var/services/web/phpMyAdmin/index.php" is forbidden (13: Permission denied),
ps says that the nginx workers run as the http user (uid=1023(http) gid=1023(http) groups=1023(http)).
The directory /var/services/web/ appears to be owned by root, both group and user:
# ls -al /var/services/web/
total 424
drwxr-xr-x 3 root root 4096 Dec 17 10:29 .
drwxr-xr-x 3 root root 4096 Dec 17 10:22 ..
-rw-r--r-- 1 root root 27959 Apr 13 2016 adminer.css
-rw-r--r-- 1 root root 82 Apr 13 2016 .htaccess
-rw-r--r-- 1 root root 387223 Apr 13 2016 index.php
drwxr-xr-x 10 root root 4096 Dec 17 10:29 phpMyAdmin
It's not clear to me how Web Station's nginx is intended to work at all given the mismatch - perhaps some set of actions I took prior caused it to decide to install with bad ownership.
I decided to leave everything owned by root, but changed group permissions so that http can access:
# chown -R root:http /var/services/web/
# chmod -R 775 /var/services/web/
This got past the initial error, but revealed a new one:
"/usr/syno/synoman/phpMyAdmin/index.cgi" is not found (2: No such file or directory)
Indeed, there was no trace of phpMyAdmin anywhere in that directory. Evidence of a bad install.
I decided to uninstall anything web related: phpMyAdmin, PHP 7, Apache (happened to be installed), nginx, and Web Station. Once I did, I still had two files in /var/services/web: adminer.css index.php.
I had tried adminer prior to this. In /var/services, there were symlinks to specific volume locations, e.g.:
# ls -al /var/services/
total 12
drwxr-xr-x 3 root root 4096 Dec 17 10:22 .
drwxr-xr-x 17 root root 4096 Dec 17 10:21 ..
lrwxrwxrwx 1 root root 18 Jan 20 2020 download -> /volume1/#download
lrwxrwxrwx+ 1 root root 14 Dec 17 10:22 homes -> /volume1/homes
lrwxrwxrwx 1 root root 24 Jan 20 2020 pgsql -> /volume1/#database/pgsql
lrwxrwxrwx 1 root root 13 Dec 17 10:22 tmp -> /volume1/#tmp
lrwxrwxrwx 1 root root 13 Dec 17 10:22 web
Interestingly, web was not symlinked. I fully deleted /var/services/web.
Looking over at /volume1, I do see a /volume1/web, again fully owned by root but with extremely constrained permission:
d---------+ 1 root root 52 Dec 17 10:14 web
There are only a few things in here, which look related to a blank install of Web Station. I fully deleted everything within /volume1/web, but left it as is. With everything maximally cleaned I rebooted.
Upon boot, /var/services/web was now symlinked to /volume1/web, which now also had useful permission bits (777), and owned by root:root. Maybe this was done by some boot recover process, who knows. (I still have nothing web related installed at this point.)
I installed Web Station, then PHP 7.2, then phpMyAdmin.
I had the same issue when accessing my server via
<name>.local/phpMyAdmin/
It worked when I accessed it via
<local ip>/phpMyAdmin/

Nginx add modules = how to?

I just install Nginx on Oracle linux and working with it as reverse proxy.
it's wroking as I wanted.
now I want to add this moudle:
ngx_http_v2_module
how do I do this ?
where is the config file ?
everywhere I looked they say
his module is not built by default, it should be enabled with the --with-http_v2_module configuration parameter.
but I don't see any example of how to do it ....
when I enter
/usr/share/nginx/moudles/
I see this files only :
-rw-r--r--. 1 root root 65 Mar 30 2018 mod-http-geoip.conf
-rw-r--r--. 1 root root 72 Mar 30 2018 mod-http-image-filter.conf
-rw-r--r--. 1 root root 64 Mar 30 2018 mod-http-perl.conf
-rw-r--r--. 1 root root 71 Mar 30 2018 mod-http-xslt-filter.conf
-rw-r--r--. 1 root root 59 Mar 30 2018 mod-mail.conf
-rw-r--r--. 1 root root 61 Mar 30 2018 mod-stream.conf
so do I need to download something ? and put it in this directory ?
also
with this module I could push image to user?
meaning he will go the websites and will see my image\icon in his webpage?
or do I need another module ?
Thanks,
Assuming this is about Oracle Linux 7, Oracle provides nginx in two channels:
EPEL packages for Oracle Linux 7 (ol7_developer_EPEL)
# yum info nginx
Loaded plugins: langpacks, ulninfo
Installed Packages
Name : nginx
Arch : x86_64
Epoch : 1
Version : 1.12.2
Release : 2.el7
Size : 1.5 M
Repo : installed
From repo : ol7_developer_EPEL
Summary : A high performance web server and reverse proxy server
URL : http://nginx.org/
License : BSD
Description : Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and
: IMAP protocols, with a strong focus on high concurrency, performance and low
: memory usage.
and it is compiled with the http2 module:
# /usr/sbin/nginx -V 2>&1 | sed -e 's/--with/\n\0/g' | grep http_v2
--with-http_v2_module
Alternatively there is also a version in the Software Collection Library (ol7_software_collections)
# yum info rh-nginx114
Loaded plugins: langpacks, ulninfo
Installed Packages
Name : rh-nginx114
Arch : x86_64
Version : 1.14
Release : 6.el7
Size : 0.0
Repo : installed
From repo : ol7_software_collections
Summary : Package that installs rh-nginx114
License : GPLv2+
Description : This is the main package for rh-nginx114 Software Collection.
where we also have support for http2:
# /opt/rh/rh-nginx114/root/usr/sbin/nginx -V 2>&1 | sed -e 's/--with/\n\0/g' | grep http_v2
--with-http_v2_module
So basically whatever version you have installed, you should be covered.
For the configuration of this module, you should look at the upstream NGINX documentation.

nagios core on centos (nginx) starts correctly but cant read any hosts or services

guys i have looked and searched and read. yum update changed a permission somewhere but cant find where. Nagios on centos starts correctly i can view the page but for some reason i dont see any hosts or services, only 403 forbidden in the corner.
ive checked my nagios.cfg and no errors or warnings. I have started Nagios as daemon, same. Any other suggestions ?
total 160
drwxrwxr-x 5 root root 4096 May 7 18:14 .
drwxr-xr-x. 78 root root 4096 May 8 22:38 ..
-rw-rw-r-- 1 root root 11339 Sep 23 2014 cgi.cfg
-rw-rw-r-- 1 root root 11658 Aug 30 2013 cgi.cfg.rpmnew
drwxr-x--- 5 root nagios 4096 Aug 30 2013 conf.d
-rw-rw-r-- 1 root root 43443 Oct 2 2014 nagios.cfg
-rw-rw-r-- 1 root root 44533 Aug 30 2013 nagios.cfg.rpmnew
-rw-r--r-- 1 root root 960 Jul 24 2016 nrpe.cfg
-rw-r--r-- 1 root root 899 Mar 31 2015 nrpe.cfg.rpmsave
-rw-r--r-- 1 root root 5332 Feb 24 2015 nsca.cfg
drwxr-x--- 2 root nagios 4096 May 7 17:39 objects
-rw-r----- 1 root apache 27 Aug 30 2013 passwd
drwxr-x--- 2 root nagios 4096 May 7 18:14 private
-rw-r----- 1 root root 1340 Aug 30 2013 resource.cfg
-rw-r--r-- 1 root root 1628 Mar 20 2013 send_nsca.cfg
the check configuration :
Nagios Core 3.5.1
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-30-2013
License: GPL
Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Processing object config directory '/etc/nagios/conf.d'...
Processing object config directory '/etc/nagios/conf.d/servicegroups'...
Processing object config file '/etc/nagios/conf.d/servicegroups/jira-servers.cfg'...
Processing object config file '/etc/nagios/conf.d/servicegroups/routers-servers.cfg'...
Processing object config file '/etc/nagios/conf.d/servicegroups/ups-servers.cfg'...
Processing object config file '/etc/nagios/conf.d/servicegroups/backup-servers.cfg'...
Processing object config file '/etc/nagios/conf.d/servicegroups/clone-servers.cfg'...
Processing object config file '/etc/nagios/conf.d/servicegroups/perforce-servers.cfg'...
Processing object config file '/etc/nagios/conf.d/servicegroups/linux-servers.cfg'...
Processing object config file '/etc/nagios/conf.d/servicegroups/web-servers.cfg'...
Processing object config file '/etc/nagios/conf.d/hostgroups.cfg'...
Processing object config directory '/etc/nagios/conf.d/hosts'...
Processing object config file '/etc/nagios/conf.d/hosts/servers.cfg'...
Processing object config file '/etc/nagios/conf.d/hosts/test.cfg'...
Processing object config file '/etc/nagios/conf.d/hosts/diskstation.cfg'...
Processing object config file '/etc/nagios/conf.d/hosts/clone-servers.cfg'...
Processing object config file '/etc/nagios/conf.d/hosts/wifi.cfg'...
Processing object config file '/etc/nagios/conf.d/hosts/cloud.cfg'...
Processing object config file '/etc/nagios/conf.d/hosts/perforce-servers.cfg'...
Processing object config file '/etc/nagios/conf.d/hosts/printers.cfg'...
Processing object config file '/etc/nagios/conf.d/hosts/switches.cfg'...
Processing object config file '/etc/nagios/conf.d/contacts.cfg'...
Processing object config directory '/etc/nagios/conf.d/commands'...
Processing object config file '/etc/nagios/conf.d/commands/notifications.cfg'...
Processing object config file '/etc/nagios/conf.d/commands/perfdata.cfg'...
Processing object config file '/etc/nagios/conf.d/commands/checks.cfg'...
Processing object config file '/etc/nagios/conf.d/commands/nrpe.cfg'...
Processing object config file '/etc/nagios/conf.d/templates.cfg'...
Read object config files okay...
Running pre-flight check on configuration data...
Checking services...
Checked 124 services.
Checking hosts...
Checked 23 hosts.
Checking host groups...
Checked 8 host groups.
Checking service groups...
Checked 8 service groups.
Checking contacts...
Checked 1 contacts.
Checking contact groups...
Checked 1 contact groups.
Checking service escalations...
Checked 0 service escalations.
Checking service dependencies...
Checked 0 service dependencies.
Checking host escalations...
Checked 0 host escalations.
Checking host dependencies...
Checked 0 host dependencies.
Checking commands...
Checked 27 commands.
Checking time periods...
Checked 1 time periods.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...
Total Warnings: 0
Total Errors: 0
Things look okay - No serious problems were detected during the pre-flight check
finally what i see :
what is see
thanks in advance.
Looks like your permissions are all messed up!
When you installed it.. was it from source? If so, did you use the --with-nagios-user= flag during ./configure?
On one of my boxes I have a combination of apache and nagios as the /usr/local/nagios owners. Try this:
chown -R nagios:nagios /usr/local/nagios
chown -R apache:nagios /usr/local/nagios/etc
chmod +x -R /usr/local/nagios/bin /usr/local/nagios/libexec
You'll also want to make sure that the nagios user and group is set in the main configuration file (/usr/local/nagios/etc/nagios.cfg), like this:
nagios_user=nagios
nagios_group=nagios
Also, did you remember to set up your htpasswd file?
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Anyway, hope this helps get you started!

Make Redis unixsocket owned by redis user

I have installed Redis 3.0.6 on Debian. There's a /etc/init.d/redis file which starts the Redis server when the system starts or I can invoke it manually to start/stop the server. Problem is that this script is run as root user.
I have a redis user and group that I want to make Redis run under. But I can't figure out how (I have not found an option to make Redis switch user ID after startup). In my config file I use
unixsocket /home/redis/redis.sock
unixsocketperm 770
But, of course, the redis.sock is owned by root.
drwxr-xr-x 2 redis redis 4096 Jan 18 03:34 bin
drwxr-xr-x 2 redis redis 4096 Jan 18 03:55 data
-rw-r--r-- 1 redis redis 41638 Jan 18 03:52 redis.conf
-rw-r--r-- 1 redis redis 16348 Jan 18 03:55 redis.log
-rw-r--r-- 1 root root 5 Jan 18 03:55 redis.pid
srwxrwx--- 1 root root 0 Jan 18 03:55 redis.sock
And the process is, too.
root 7913 0.1 0.1 38016 1976 ? Ssl 03:55 0:00 /home/redis/bin/redis-server *:6379
Ultimately, I have a git user that is also in the redis group and thus should in the end have access to redis.sock. (This is for a manual deployment of GitLab CE).
How I can I configure the Redis server that way?
Update your /etc/init.d to use sudo during start service (line 33):
sudo -u redis $EXEC $CONF
You may need to cleanup old files (in /var/lib) or reset their permission to redis.

Resources