Can't SSH to GCloud after editing /etc/network/interfaces - networking

After editing /etc/network/interfaces on a GCloud VM instance I cannot access the machine at all through SSH. GCloud SDK shell still shows the instance running but the applications are no longer available. I have tried to SFTP to the machine as well, but without success. Is there any way to edit/repair the VM instance interfaces file without having to revert back to an earlier snapshot?
Many thanks!

You can create a new GCE instance and attach the disk of the old instance to the new instance. Then you can connect to the new instance and change anything you want in the old disk.

Related

Run symfony command on separate VM

I have an application running Symfony 5.2 on apache ubuntu 18.04 vm (vm1). Users are uploading assets to the application that are at first stored in filesystem. I then have a symfony command triggered on cronjob that will:
read from fs and read from db
manipulate assets using terminal commands
upload to separate storage
remove assets from filesystem and update db.
The command is quite heavy so I would like to run it on a separate vm to avoid impact on user experience. My question is how to best achieve this.
My current thinking is that I can
Disable command on vm1
Setup new vm (vm2) with same codebase. Trigger command with cronjob on vm2
Somehow allow communication between vm1 and vm2 (i guess both in same private network)
Somehow allow vm2 read/write access to fs on vm1 (could probably be done by setting up nfs on vm1 accessed by vm2)
Somehow allow vm2 read/write access to mysql db on vm1 (i guess open port 3306 to vm2's private ip)
Is this the best way forward or does symfony have some support to better achieve this?

I need to connect with an instance which is created in a VMware based eucalyptus cloud platform but i don't understand how to do it?

Connect to instance: i-38942195
To connect to your instance, be sure security group my-test-security-group has TCP port 22 open to inbound traffic and then perform the following steps (these instructions do not apply if you did not select a key pair when you launched this instance):
Open an SSH terminal window.
Change your directory to the one where you stored your key file my-test-keypair.pem
Run the following command to set the correct permissions for your key file:
chmod 400 my-test-keypair.pem
Connect to your instance via its public IP address by running the following command:
ssh -i my-test-keypair.pem root#192.168.0.29
Eucalyptus no longer supports VMware, but to generally troubleshoot instance connectivity you would first check that you are using a known good image such as those available via:
# python <(curl -Ls https://eucalyptus.cloud/images)
and ensure that the instance booted correctly:
# euca-get-console-output i-38942195
if that looks good (check for instance meta-data access for the SSH key) then check that the security group rules are correct, and that the instance is running using the expected security group and SSH key.
VMWare deprecation notice from version 4.1:
Support for VMWare features in Eucalyptus has been deprecated and will be removed in a future release.
http://docs.eucalyptus.cloud/eucalyptus/4.4.5/index.html#release-notes/4.1.0/4.1.0_rn_features.html
Euca2ools command:
http://docs.eucalyptus.cloud/eucalyptus/4.4.5/index.html#euca2ools-guide/euca-get-console-output.html

After opening ports 8072 and 8073, not albe to connect to Google cloud VM

I've Virtual Machine running in Google Compute. I've Ubuntu 14.04 on that VM.
I'm building a AOSP custom ROM on this VM. I needed to open port 8072 and 8073 for new toolchain (for Marshmallow) to start the server. So I followed following steps:
1. ufw was inactive; so I enabled it
2. sudo allow tcp:8072
3. sudo allow tcp:8073
4. sudo ufw status verbose
It showed these 2 ports there.
After some time I restarted the VM; and now I'm not able to connect to it.
I connect using the option "Open in browser window". I also tried with "Open in browser window with custom port" with port 22. But it is not allowing me to connect to it.
Can someone help me with this?
The problem is that when you allowed the ufw it blocked new ssh connections, you need to start another instance with the disk from the old instance and to to the /mnt/etc/ufw.conf and set ENABLE=no.
# Set to yes to start on boot. If setting this remotely, be sure to add a rule
# to allow your remote connection before starting ufw. Eg: 'ufw allow 22/tcp'
ENABLED=yes
After that you restart the instance with the old disk the first rule you need to add is ufw allow 22/tcp.
But you need to allow the ports 8072 and 8073 on google cloud firewall to allow the connection to the instance.
You can create another instance because the disk is in use by an instance.
If you have important information on the disk perform a snapshot before you proceed
1 - Edit instance and make sure "Delete boot disk when instance is deleted" is not checked.
2 - Delete the instance. (Now you have a disk not used by any instance)
3 - Add the olddisk to another instance (Not as root disk)
4 - Edit another instance you have running, and add the old disk to it.
5 - Mount de old disk. (mount /dev/sdb1 /mnt)
6 - edit /etc/ufw/ufw.conf
7 - unmount the disk (umount /mnt)
8 - Edit the instance you mounted the disk and remove the disk from the instance.
9 - Go back to disk tab click on the old disk and create an instance.

woocommerce webhooks not firing

woocommerce webhooks aren't firing at all for me, even on a fresh install. I did the following:
Create a new MySQL database
Install WP from the zip file.
Set up WP.
Install Woocommerce.
Enable REST API and create a key.
Added "Coupon created" webhook, made sure it's set to active, and set it to a publicly accessible site.
When I create a coupon, the webhook does not fire, and no entry is created in the log. I tried this with orders as well and also doesn't work.
I think it's a machine configuration problem, but not sure what to change. The machine is an EC2 instance and has all ports opened in its security group policy.
Weirdest of all is that on a different EC2 instance does work, but it's a production machine and I want to have a dev server work so I can test out things. The only config differences between the production and dev machines that I can think of are the subnets and the firewall, but I don't understand why the subnet should matter and I opened all the firewall ports on the dev machine.
what Linux distributions are you running for prod and dev?
CentOS with SELinux enabled with not allow HTTPD scripts and modules to connect to network by default.
setsebool -P httpd_can_network_connect on
If above is not valid, please identify network problems by trying connecting to AWS RDS via SSH CLI. If you can open a connection via SSH CLI, the problem will be with your application. If you can't, it will be network problem. First thing to check in that case is AWS RDS security group. For testing you can open 3306 to public.
Let me know how it goes.

Editing files on Google Cloud Engine VM

I have recently setup a VM on Google Cloud to develop and host my web site/application. The setup went fine, and I even have gcloud SDK up and running. I also have Apache installed and configured. My question is how do I setup my editing environment (PHP Storm) and upload my files? They seem to have the ports for FTP and SFTP blocked.
FTP uses a clear-text protocol and is thus not recommended. To use SFTP:
Make sure you can ssh to your instance: gcutil --project=<project> ssh <instance>. This does two things: (a) makes sure that port 22 is open on your VM, and (b) propagates your private key to the instance, if it's not already there.
Configure PHP Storm to use the Key pair authentication mechanism using the key ~/.ssh/google_compute_engine to log in to the instance.
That's it.

Resources