Customizing the nano editor in google cloud shell - google-cloud-shell

I was wondering if there was a way to customize the nano editor settings in the Debian-based virtual machine instance when you launch the cloud shell.
I already tried going to the root of the instance then cd to etc and editing the nanorc file. but every time i try re-save the nanorc back it says permission denied.
Thanks.

You should be able to customize your nano editor settings by creating $HOME/.nanorc file. While Google Cloud Shell virtual machines are ephemeral (the VM is turned down when idle and a new one is allocated when you are back), the content of your home disk is persistent.

Related

I need to run a file that I placed on an AWS server using sftp

I have a bitnami WordPress instance using AWS lightsail. I need to migrate the site to another identical AWS instance. I created a PHP installer from the first instance using the Wordpress Duplicator plugin.
I then uploaded the file onto the new server to a folder (opt/bitnami/apache2/htdocs/).The instructions I've seen online they say I just need to navigate to the location of the installer in a browser and it will run. However, when I attempt to access the PHP file from a browser I just get an error on the front-end saying:
OOPS! THAT PAGE CAN’T BE FOUND
I have seen suggestions online that the installer be placed into a public folder called html_public but my instance doesn't have a folder like that. I changed the access rights to the folder, and the installer, to be full rw access.
Any ideas how I can get this to work?
You must config the Security Groups firewall to open the HTTP port.
Open the Amazon VPC console at [https://console.aws.amazon.com/vpc/]
On the Inbound Rules tab, choose Edit the port range 80, 443 - Source: Anywhere - IP Address: 0.0.0.0/0 and Save.

Is it possible to access via ssh a one click app from the Google Cloud Platform marketplace?

I just recently installed a one click application from the Google Cloud Platform. I installed WordPress as a VM instance , but when I try to access my VM instance via ssh i see that its empty and it doesn't contain any WordPress files. Is there a way to access the WordPress files either via FTP or even better ssh?
One click deployments should come with everything you need “out of the box”.
You can visit your Deployment Manager and click on the Word Press resource to view login options and choose SSH or login to the Word Press admin console from there.
Accessing files through SCP can be done through the GCloud command line as well as another alternative.

Share my local wordpress site with another developer with git

I want to share my local wordpress site with another developer with git in a way our database will be same when he setups my wordpress site in his local PC.
I am using windows 7 OS
I'm not sure if what you are asking for is possible.
here is my suggestion (the database should be on a real server)
if you use CPanel:
1- In the CPanel create the database and new user and assign the user to the database
2- In the CPanel Go to Remote MySQL, add your IP address and the other developer IP address. (to allow remote access)
3- Export the database from your local PC and import it to the CPanel.
4- Change the wp-config.php configuration.
Note: The urls should be the same on your PC and the developer pc.
for example if your website url on your pc is : http://localhost/mywebsite/
the other developer should make it the same.
I would suggest keeping your database out of git (except perhaps the database definitions).
Instead you can leverage git hooks. Using something like pre-push, run a mysql dump command to get the current state of your db, and copy it to a shared Dropbox/Drive folder with your team mate.
.git/hooks/pre-push
#!/bin/bash
mysqldump -u root -p --all-databases > ~/Dropbox/shared-with-tm/mysql.sql
Completely untested This is a vague answer to answer a vague question - but might give you a starting point.

Local Drupal website connecting to a remote database

I'm new to Drupal. I want to run my Drupal website locally and connect directly to the remote database, but I can't seem to figure out how to do it. I have MAMP installed on the Mac and I have all the files in the htdocs folder. It looks like I just need to change the settings.php file to match my remote database, but I'm unsure what I need to change.
I guest you look at this drupal.org HowTo that step by step guides you through creating the database and what you need to change before running the Install program.
https://www.drupal.org/node/66187
Also check the comments on that thread.
Yes, you have to adjust your settings file (/sites/default.settings.php), database configuration. Watch out, usually there is a different ("external") host for accessing database from out of server. I think that it can be set per database user does it has privileges to access database from outer server or not. Maybe there's some special user for that.
There should not be any extra setup or configuration. Just make sure that
You are connected to the remote database (usually goes in sites/default/settings.php).
The database host allows remote connections.

Vagrant + Docker + Wordpress

I installed vagrant on a Mac and I want to achieve this :
Launch vagrant up and have a vagrant with docker installed and docker compose
Install Wordpress with mysql inside this vagrant machine with docker-compose up
Have the folder (/var/www/html) of the docker container mapped as volume in my vagrant machine at /dockermapinVagrant
Have this /dockermapinVagrant onto my host(OS X) and be able to modify files directly from the host
I achieved that and everything works perfectly.
I can add templates from my OS X host with no problems (dragging the theme in the themes folder on my host OS X), see the changes directly of the Wordpress site using my browser ...
The problem
I noticed is that I can not install any plugins on Wordpress (
dashboard -> updates ) I have a message :
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.
Solution i tried
Change the permission in the docker container wp by setting the user to www-data and chmod to 777 but on some folder as wp-content it doesn’t change to 777. Moreover setting the owner to www-data doesn’t work at all it stay always to 1000:1000 in the container.
Is there a way to update the plugins on wordpress in a docker container without FTP ?
Is there maybe a better way do to that ? Use a data-only container on the vagrant machine with FTP access to the mounted volume ? And map the data container volume on the vagrant machine then to the host to have direct access and see changes directly during the dev process. But I do not want to give FTP access directly on the data-only container (FTP is not secure and I prefer to manage the backup and the data from the vagrant machine directly and delete the mapped volumes in production)
You sure can achieve this, and it's probably just the missing line
define( 'FS_METHOD', 'direct' );
in your wp-config file. You should setup each WordPress outside of the docker environment first IMHO; and then import the database, and WordPress files etc into docker using your Dockerfile(s) as part of staging and deployment, which should be distinct from development (although some of deployment will be shared).
On better ways of managing, I would not put docker inside vagrant if at all possible; it adds unnecessary complexity to that stage of development. I would use vagrant exclusively, focus on getting my provisioning scripts ready (as I use scripts between vagrant and docker), and work via SFTP directly to the vagrant box; committing changes via git. You can then focus your efforts on the necessary code and pull what you need when you need to.
Once it gets to the stage of testing, or staging, I use the provisioner scripts to help me build my docker environment consistently, (probably sharing some of the provisioning code). I Can then pull a specific release from my repo, and build it into my docker image, which I can deploy.
Other alternatives if you really want spin up, delete WordPress, get to grips with the WP-CLI command-line tools, which can install WordPress, plugins, manage updates and install integrity.

Resources