Using git with a PHPFog Wordpress app - wordpress

I have cloned a copy of my PHPFog Wordpress app to my local machine. I then have a few themes im working on with there own sperate repository. So I copy and paste a theme into my Wordpress repository and then sync it back up with PHPFog.
This works all well and good.
However If I update my Wordpress app in the admin panel, and later on sync up some changes I have made I lose the update, and go back to the version of Wordpress I started with.
How are you supposed to correctly work with git and PHPFOG if every change you make on your Wordpress admin panel gets overwritten with every sync from your local machine.
Am I supposed to update Wordpress and then do another clone in order to have the correct version on my local machine before making new changes, and if that is the case how do clone the updated Wordpress app to my local machine.
Thanks

Your right, file system changes, that are made from the Wordpress admin, do not get added to your PHP Fog repo, and can get blown away on the next push.
A better way to handle this issue is to run your Wordpress installation locally on your development system like you hintted to. I use mamp for mac or wamp or xampp for windows to make changes in the Wordpress admin locally then check in and push those changes. This will let you see the results of your changes without effecting your production site. I think the time invested setting this up is well worth it.
To get this running you should install either mamp or wamp and install a fresh copy of wordpress in order to make sure mysql is running locally and the wordpress installation is able to connect. Then in a new folder clone a fresh copy of your repo and load that up in the browser. The url will be something like localhost:8888. It should fail to find the database but that is expected. You will need to configure your local environment variables (listed below) to point to the locally running mysql server. Look in the wp-config.php file of the fresh install for the database settings. Do not use the wp-config.php settings of your cloned repo. You do not want to make changes to wp-config.php file because those changes will get checked into the repo and it will break your production site after the push.
MYSQL_DB_HOST
MYSQL_DB_NAME
MYSQL_USERNAME
MYSQL_PASSWORD
Here is a great link that explains this process in more detail: http://docs.phpfog.com/getting-started/development

Related

Setup for Wordpress + Plesk + Git + Local Environment

I need to update a development environment which exists for multiple Wordpress sites (existing and new ones) and which uses Plesk. Now Git should be used for version control.
Right now every change is done on the stage system, which is not good.
Description of the situation:
Themes which will be used are completely self developed and therefore Git should be used as version control.
The management of the sites is done with Plesk (Production and Stage version).
Sometimes (depending on the site owner) the most recent content is on the production site and sometimes on the stage site (site owner is updating content there) and must be transfered to production.
With the introduction of Git a local environment for every developers is needed (to locally develop and then push the changes to Git), to setup different sites from Plesk on a local environment I would choose MAMP?
Plesk offers a connection between Git (Gitlab in our case) and Plesk so commits will be automatically fetched by Plesk's Stage and Production environments and are published depending on the settings.
So the Workflow (and included questions) may be the following:
Setup new site on Plesk and download fresh stage state to local MAMP.
Create a repository on Gitlab and connect stage branch to Plesk stage site and main branch to Plesk production site.
Local Git folder will be the wordpress folder. Gitignore will ignore everything except the theme folder and the plugin folder (only plugins which have custom changes)
Working locally on stage branch and commiting will result in automatically updating the stage system on plesk.
The production page will not be updated automatically, this has to be done manually because this scenario varies from site to site.
Problems:
Migrating stuff to the production site will be only possible with a manual task I guess, because there is no possibility for customising the pipeline on gitlab as far as I know?
Don't know what to do with content images. Should they be ignored in the Git repo? Currently I would say yes if it's not template related?
Does this sound as a proper way or do I oversee some obstacles here or is there something which can be done in an easier way like the local setup for a new developer on an existing site. As there is only part of the Wordpress stuff in Git, the database and the rest of wordpress have to be copied from somewhere (e.g Plesk' Stage site).
In general the dev setup, deployment and version control with wordpress sites seems a little bit odd for me compared to others like webapps, mobile apps or backend services.
I've used git as version control for the whole WP installation and individual themes/plugins. Under normal circumstances, I don't see the point for the first option, unless you want to keep all the plugins and WP version in sync with the git repo. In that case, you should definitely gitingore the upload folder, otherwise uploading any attachment will cause a mess.
The automate the deploy, you can configure a webhook:
https://conetix.com.au/support/automatic-git-deployments-via-gitlab-to-plesk-based-hosting/

Localhost works but refuses to connect on a particular project (ERR_CONNECTION_REFUSE) (WAMP)

this is my third question about the same project, so yes, i'm struggling.
I'm trying to manually import a wordpress site in local. We don't have access anymore to the dashboard (some bad stuff happenning), so i can't install a plug-in that migrate the site easily and automatically.
After having problems for linking the database with the site, i had PHP errors (continue targetting to break). Now i don't have php errors anymore but i can't access the site anymore.
I can go to localhost, it reaches it easily, i can go to my other projects, but it refuses to reach this particular project.
It says :
This site can’t be reachedlocalhost refused to connect.
Try:
Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED
I've traveled on different forums to find a solution but i didn't find why it occurs only on one of my projects. The only difference i see is that the other projects use mariaDB and this one MySQL.
thanks for the help
Dude,
check local on flywheel its much simplier than wamp. Link:
https://localwp.com/
besides when migrating manually:
zip all ur files and download
install new wordpress in your local machine.
copy somewhere new wp-config.php and save it in different localization
paste and extract zip package in new wordpress localization on your computer
download database from wordpress you want to migrate on your local machine
replace wp-config.php which u extracted from files with your new wordpress instalation wp-config.php [ad.3]
it would be nice if u install wp-cli on your computer:link for windows:
https://www.ryadel.com/en/install-wp-cli-windows-wordpress-command-line-interface-how/
import database into your new wordpress and than run search replace in order to change migrating site domain name [use wp cli its easiest way]
to import DB:https://developer.wordpress.org/cli/commands/db/import/
to replace domains:https://developer.wordpress.org/cli/commands/search-replace/
remember that your DB need to be .sql and pasted in main wp directory
open terminal in main wp directory and write than wp-cli commands
If u re not familiar with terminal on windows I prefer gitbash / its easy to use adding linux commands and all sort of staff (always remember to open as administrator)
u can download here:https://gitforwindows.org/
after performing all this actions you can now log-in into wordpress on your local machine.
go to settings->permalinks and click save.
here you go u have finally migrated your site!
If you see 'error technical issues' you should also check ur file and directory permissions of wordpress.
here a link to correct permissions You can change with in gitbash terminal:Correct file permissions for WordPress

VersionPress database sync not working

I'm trying to setup a dev+dev/staging/prod environment with Wordpress. I'm developing local on two Mac workstations (2 local developers) with MAMP. And I have a production server on Cloud. I installed the Wordpress site on my MAMP and cloned it on the other workstation and on cloud. I set GIT to not sync wp-config.php and I made it so that the two workstation and the prod site have the proper DB connection. All 3 site works. I can sync files with Bitbucket with no problem. I setup the VersionPress plugin on all 3 sites assigning the proper name: dev1, dev2 and production. On the Wordpress control panel I see that VersionPress is working, each clone can rollback changes. When I commit things in SourceTree/Bitbucket I see the database changes made by the other dev and the prod site, i.e. [VP] Published post "Test1".
The problem is that the artcle made by Dev1 is not visible on Dev2 or Prod and vice versa. So if from my local MAMP, I log into Wordpress and go to Articles, I can't see the Test article made on the other cloned Wordpress site on our other workstation.
I should be 100% VersionPress compliant, and by the way in the VersionPress setup screen I had all check marked as good with the grey "V" icon.
Am I missing something?
Note: after installing VersionPress a lot of new .git and .gitignore were automatically populated, I guess that's okay, but I haven't touch them.
Other nore: VersionPress is amazing, for those who don't know it I strongly recommend it: https://versionpress.net/ I can't wait to have it 100% functional...
You should clone the sites using VersionPress, specifically its wp vp clone command. Then, you need to push and pull between environments using the other WP-CLI commands, wp vp push and wp vp pull.
The syncing will not work if you installed VersionPress separately on three already existing clones of a site.

Fresh Wordpress install on Amazon Linux EC2...can't delete and reinstall

I just recently started by creating a EC2 instance on AWS. I used the Amazon Linux package. I changed the PHP settings to include the ability to upload files larger than 200MB. Got phpinfo.php working. Installed phpMyAdmin. Everything looked good.
Next, I installed Wordpress. It worked great. Then I tried installing a theme. Worked great. Then I started installing some plugins for that theme. Something made the site crash. I tried a few things, but since I couldn't go to the sites Wordpress Admin panel, it seemed hopeless. So I decided to start from scratch. I deleted the html directory (including wp-content) and dropped all the wordpress tables. I moved a fresh copy of Wordpress into the html directory, reconfigured the config.php file, and it recreated the Wordpress tables in the database. Seems to work great. When I try to upload a theme, it says:
Connection Information
To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.
I noticed that wp-content didn't have a uploads directory, so I created one. That seemed to let me upload the theme, but it showed up as a media file. I moved it to the theme directory and that worked. But when I tried to upload a plugin, I got the same message as a above.
What happened when I deleted everything? Or rather, where was information stored that when I reinstalled Wordpress, it didn't create a uploads directory? I am fine with reinstalling Wordpress from scratch, but I don't want to reinstall the whole LAMP stack or redo the AWS instance. Any thoughts?
The issue is that your web server doesn't have the proper permissions to write to your content directory.
The WordPress Codex has some good info for proper file and directory permissions. Ideally, all files should have 644 permissions, and all directories should be 755 (no higher).
If you're still running into issues adding plugins and updating WordPress, you should heed the advice of the following (so that you don't have to enter FTP details into WordPress each time):
Any file that needs write access from WordPress should be writable by the web server. If your hosting set up requires it, that may mean those files need to be group-owned by the user account used by the web server process.

How to setup existing Wordpress project on XAMPP

I'm starting some work on an existing wordpress project on Github. Basically, the entire Wordpress install is on Github. I cloned it to my local XAMPP installation. What's the best way to get everything configured? I know I have to make a config file and get WP talking to my MYSQL database. I did that, and while I got the wp-admin stuff working fine, the front-side stuff isn't showing up.
In the database you need to update the links so that they point to your local host.
The way I do that is that I make a backup of the sql database and then replace everything like:
orig:
www.domain.com/site/...
with:
localhost/site/...
And then restore it
In 2020 it's perfect plugin to do this. It's called Duplicator. You need to install it and after it you have 4 steps to configure your installation on which machine it will be running. It's really easy to use, see this link:
https://wordpress.org/plugins/duplicator/

Resources