Develop in a non local environment - development-environment

I have set up a reactJS environment on digitalocean just to start learning developing with react and graphQL and i was wondering if there is a text editor that can connect to connect on the internet and retrieve the files of the project.
Im not really sure if something like this is doable but in my head is like i will code the files on the VPS with a proper text editor and save them so i can have some sort of live preview.
I have already tried with sublime and brackets but im not really sure how to connect them on the project folder in my vps.

If your VPS has SFTP set up, you can use your SSH login details to connect and edit code live through an editor such as sublime text.
( I would recommend using FTP if the SSH access is through root or anything with authority on the server, if you do not care about security then feel free to use root )
https://www.sublimetext.com/
An SFTP / FTP plugin exists for what you require, please see below:
https://wbond.net/sublime_packages/sftp
Example usage of the plugin is as follows
Create a project folder
CTRL+SHIFT+P > "sftp" > SFTP -> Setup Server
Edit the login details within your sftp-config.json file
Make sure the remote path is correct and your credentials are correct
"upload on save" - change to true inside your sftp-config.json file
Save the sftp-config.json file, CTRL+SHIFT+P > "sftp" > SFTP Sync remote -> local
I'd recommend adding node_modules inside your ignore_regexes, as it can take up to 10-15 minutes to download these.
Now it should ( if set up correctly ) download the files specified in your "remote_path" folder. Saving future files will upload them to the server on save.
I hope this helps!

Related

Using Workbox via a local copy, without a CDN

I have a small device that serves a webpage using Nginx in a local network. I'm developing the webpage using Vue and I need that once a person got connected to the server and visited the page, on disconnection, the page needs to work as normal
I'm currently using Workbox plugin and I get this code:
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
importScripts(
"/precache-manifest.b62cf508e2c3da8c27f2635f7aab384a.js"
);
The problem is that it goes to the internet to download that file and I will not have an internet connection.
I tried downloading this file, but inside goes to the internet again.
Is there a way to get this to work in an offline environment?
You can follow the guidance in the workbox-sw docs to download a local copy of the bundled Workbox runtime libraries, and modify your service worker script to use those.
Running:
$ npx workbox-cli#4.3.1 copyLibraries /path/to/dir
from the command line will download a local copy of the runtime to the specified directory (replace /path/to/dir with the desired location).
You can then modify your service worker script so that it reads:
importScripts("/path/to/dir/workbox-v4.3.1/workbox-sw.js");
workbox.setConfig({
modulePathPrefix: '/path/to/dir/workbox-v4.3.1/'
});
importScripts(
"/precache-manifest.b62cf508e2c3da8c27f2635f7aab384a.js"
);

Is it possible to work with an editor remotly?

I want to edit files on my server, but don't want to always upload the files, is there a way on to edit the files remotly?
I tryed to make an bash script which should upload the files, but its not realy good :/ and sometimes didn't worked
You can use Atom with the
Retome FTP edit
Package
If you have got an SSH (SFTP enabled) access to your server, an option would be use use SSHFS to mount a remote directory on your local working path.
In this way you can use any editor (or even something else) to change your files and they will always be synchronised.
Just keep in mind that, in this way, files are actually located on your server, you won't have a real copy on your local machine.

MAMP PRO: The 'Path' to your remote document root is incorrect. but is not true - all files are there

The problem is incorrect path to remote host, but is not true. I have acces to my server via ftp without problems. All WP files are there and the site is working fine (frontend/backent). I have also access to phpMyAdmin to MySQL datepase binded to this site.
I have notce that paht to the web files is differ depend on FTP or SFTP is. In FTP app is such stright:
/[all wp files]
in editor app (such TextWrangler), after the samy access id/pass, I have got such path:
/home/[accountname]/public_html/[all wp files]
After click on detect button, app changing the path filed on:
- blanc - under FTP connection
or
- public_html - under SFTP
so it mean conection between MAMP and my server is working. Fine. But after this when I trying to Check URLs & credentials or when I trying Import Host... I received:
Error code: -3010 (The 'Path' to your remote document root is incorrect. The 'Path' field on the remote tab is the document root of your remote site that will be accessed via your Public Site URL (e.g.: 'public_html').) - Start auto detect not solved the problem.
or
Error code: -3113 (The 'Path' to your remote document root is incorrect. The 'Path' field on the remote tab is the document root of your remote site that will be accessed via your Public Site URL (e.g.: 'public_html').)
But it is not true! All files are there!
Please help. Should I use some special code under Apache tab (Additional parameters for VirtualHost directive or Directory directive?
Should I know something more from my serverprovider (home.pl) and solved this problem with them (there is no, in my subscription plan, access via cPanel or so, to set up something)?
Should I change something in https.conf file?
I'm not so using server coding so please forgive me but I have no idea where is the problem (but I'm trying to learn) :o)
My environment is:
MacOS X: 10.13.6
MAMP Pro: 5.2.2 (17923)
Thanx for any help or redirection to the answers someware else (I used searching ;o) but without success or I used wrong ask).
Just ran into this and found a solution that worked for me. I just had to switch the Public URL from https to http and it worked.
I had this error too.
Here's what I did to fix it:
Logged into my remote CPanel account
Created an FTP account for user#sitename.com
Defined the user directory in the FTP user settings similar to this /home/[site]/public_html
Ensured that this user had read/write permissions on the remote server (otherwise importing a site in MAMP Pro might fail)
Then, in MAMP Pro (v 6.0.1) created a new host following these steps:
https://documentation.mamp.info/en/MAMP-PRO-Mac/Create-a-new-host/Import/
I found that once the correct FTP permissions were set at the server, MAMP was OK and functioned as planned.
Good luck, hope this works for you too.

SSH Remote access in Aptana

I have since connected to my SSH site using Putty and Filezilla. Putty and Filezilla give me direct access to the appropriate directories and Filezilla gives me a full path from the top level directory. I have then tried the same path from the starting point in Aptana, but get blocked one level above my target directory. If I collapse all the directories in Putty and Filezilla and try to expand again, Putty works fine, but Filezilla then blocs at the same point as Aptana. So there is some subtle difference in approach between Filezilla and Aptana and Putty.
I was looking for a way to get an encryted link when editing files on my hosted webserver when using Aptana Studio. I can get an ordinary Remote FTP link set up and use that to edit files. The SSH facility looked as though it could do a secure link, so got the SSH details off my ISP and set up in Studio. In the setup I was asked to select a directory, but the ones available were all system directories rather than my htdocs tree. However by leaving out the default provided /, I could get to the htdocs tree and see all my files under remote. However when I try to load a file to Studio, I get a file does not exist message.
I'm new to SSH (and Studio) and don't know whether what I am trying to do is not possible or there is something else I need to set up. So far I have just been using Studio as a remote editor for PHP and HTML. I suspect there is a much better and professional way to set up what I am doing under Studio (even ignoring the secure transfer) as I am currently doing separate backup of the files in Filezilla, but just haven't figured out the way to set everything up yet.
Many thanks for any help.
Actually I'd like to post this as a comment to your question, but I'm pretty new here, so the system doesn't allow me to.
Anyway. You can add connections to remote servers over ssh like this:
If you don't have the remote tab go to Window -> Show View -> Remote
Rightclick in the remote tab and click "Add New FTP Site..."
Change the Protocol to SFTP and put in your credentials (you can use Username/Password or Username/Private Key authentification)
When you close Aptana with files still opened, it usually show you those files when you reopen Aptana later. It seams not to do this when you work with files of a SFTP remote host and shows you an error instead. I guess this is because it tries to validate those files (if they still exists) but doesn't authenticate with the remote host first. So nothing to worry there.
Hope this helps.

Issue with importing a database into phpMyAdmin

I am learning how to use SQL, I set up a localhost, in the course of that journey, I was confronted to the issue of importing sql files into phpMyAdmin, I did the right click on config.inc.php and clicked on the Notepad++ that I previously installed, I typed in there the following code: $cfg['UploadDir']='c:\Files';, of course I created on the hard drive C the Files directory. Now that I came back into phpMyAdmin, clicked on my database, clicked on import, this is what I got as message:
The directory you set for upload work cannot be reached.
Can anyone help me here with this issue?
Your webserver probably doesn't have permission to read 'c:\Files' thus it is not a valid directory. Technically you would say this is out of the web root.
I suggest you set the upload directory to a subdirectory of your web server's root directory (or in the PHPMyAdmin web directory). Then if for your own ease of use you want it to be located at 'c:\Files' you can create a shortcut from the web root upload directory whatever you name it, and place the shortcut in 'c:' and name it 'Files'.