Best workflow for to work with Ionic2 and Angular2 - deployment

I'm usually developing PHP backend apps. I'm developing on Windows and use Vagrant to create virtual machine.
Workflow looks like that:
On base machine I have all my project files and I'm using git.
On base machine I have installed PhpStorm which is connected over ssh to virtual machine. PhpStorm is syncing files from base machine to local machine (in one direction)* using deployment.
Every library and module like nodejs, ruby, gulp etc. I'm installing on virtual machine to not clutter my base machine.
Debugging works fine - I can connect PhpStorm debugging over remote ssh.
Almost everything it's fine with that workflow (sometimes I have to download some generated files on virtual machine), but that workflow is not the best for working with Ionic2 and Angular.
Ionic uses many nodejs modules -> this causing many problems in PhpStorm to hinting errors and code completion. Second problem is debuging I can't connect typescript debugging from PhpStorm because all files all generated by gulp on virtual machine.
My question is:
What's is the best workflow when I want to work on windows with ionic2?
Do I have to install all libraries on Windows machine?
Should I use shared folders for that project is any possibility to hinting in PhpStorm?
base machine - on Windows
virtual machine - on Ubuntu 14 Server LTS
I can't use shared folders cause of slowly cache creating on PHP app and in general PHP apps running then very slowly, even if I moved cache folder to not shared folder on Ubuntu.

If you have Ionic CLI installed you can start new project by ionic start command. It provides you workflow with everything you can need. For example:
$ ionic start cutePuppyPics --v2 //create new project
$ cd cutePuppyPics
$ ionic serve //start server, live reload etc.
Yes, you should install it all on your non-virutal desktop, because if you want to test app on your device, it will be hard to link this device to ADB in your virtual machine.
It works very well with PhpStorm :)

Related

Visual Studio Code remote access to a WSL2:ubuntu on my desktop from my macbook

've looked around and can't seem to find the answer to this - probably because the feature is pretty new.
I tried the remote WSL:ubuntu connection on my windows desktop machine to connect to my WSL2 Ubuntu running on the same machine. This is pretty much perfect as it allows access to my Nvidia GPU under linux
Is there anyway I can do the same trick from my macbook? I can connect to the windows side of the desktop using the new remote tunnel feature but I'm drawing a blank on how to do for the WSL buried in that machine. It looks like it's just using the same remote connection feature so I'm thinking it should be possible but WSL2 network is not exposed the same way you can with a VM or other machine.
The desktop has way more everything than my macbook including a nvidia GPU I want to use for some machine learning.
I can do it from the desktop itself - but it's nice to be able to use that machine from my macbook at certain times of day.
I have recently started using VSCode so I'm on the learning curve with it - it may well be that it's not possible using the new remote tunnels - or requires some messing with adding a new hyper-v bridged adapter to the WSL installation. I'm hoping against hope there's an easy solve that I've somehow missed.
I tried setting up the remote tunnel as per https://code.visualstudio.com/blogs/2022/12/07/remote-even-better but it seems to setup a server to access windows not the WSL2 service.
Thanks for any help!
I had a similar problem and found this github issue. While the developers are looking into including this feature, you currently will need to install the VSCode CLI directly in WSL. You can find the downloads here
Notes
I would recommend the x64 CLI download in the Linux section. It will download a tar.gz file which will have a file named code in it when extracted.
The tunnel will launch from wherever you place that code file, so I put mine in the ~/ (home) directory.
You can then open a tunnel using the command ./code tunnel from that location. You can replace the . with the path to the code file to open the tunnel while in a different directory, i.e. ~/code.
You can still launch a tunnel from Windows with code tunnel. (note that this command does not have ./)

Host user tasks used on remote SSH side

Background:
At work I develop either in a virtual machine on my Windows laptop, or in a desktop workstation via a remote desktop app. Both environments are Ubuntu.
I have recently started to enjoy using VSCode, with the Remote SSH plugin. But I have to manually copy my setup .vscode/ folder to each project. I work actively in 10-20 projects, which makes this a bit of annoying.
All projects have the same setup and file structure, and both environments are setup the same. It feels like I could automate this more.
Using 3rd party tools is not applicable for me, since I cannot install whatever I want. Native support is important.
Question:
Is there any way for me to setup VSCode settings and tasks on my hosting Windows machine, but use them on the remote side after starting an SSH session of VSCode?

Developing Flutter with VSCode and WSL2

Since I mostly develop Web, using nginx, PHP and MySQL, I have ported my WebDev-environment entirely to WSL2.
Since performance is very important, all my web-related projects reside on the WSL2-vhdx file /home/user/Projects/Web. In WSL2 I've installed all my necessary tools for a nice and neat Linux-like experience, Docker, GIT, etc.. This combined with VSCode remote integration works very well.
Now, I'm digging into building Flutter-Apps, and my Flutter-environment is installed on the Windows side. My Flutter-related projects reside on D:\Projects\Flutter which is a partition, and NOT USED in WSL2 in any way. Building Flutter-apps with flutter-windows-sdk and VSCode works neatly.
But, the problem is: Now I've my project files scattered all across my computer. Web-stuff in a WSL2-vhdx-file and Flutter-stuff on the D-partition.
Is there a way to build flutter-apps with Flutter, while having the project-files stored on a WSL2-vhdx-file, in combination with VSCode-remote and an Android-emulator?
I tried creating a test Flutter-project on the \\wsl$ network mount, which didn't work.
Moving my web-related project files to the D:\ partition of Windows is no option, since the I/O mounts in WSL2 are extremely slow.
I got it working, reliably with adb connect 192.168.xxx
For anyone interested, see my full blog post here: https://dnmc.in/2021/01/25/setting-up-flutter-natively-with-wsl2-vs-code-hot-reload/
Is there a way to build flutter-apps with Flutter, while having the project-files stored on a WSL2-vhdx-file, in combination with VSCode-remote and an Android-emulator?
I'm assuming (based on the mention of VS Code Remoting) that you want to run the extension in WSL. I haven't tried that specifically, but I have run Flutter inside WSL and also connected a VS Code Remoting session to an Android emulator in the cloud, so I would expect this to work.
You'll need to make sure you set up the Flutter SDK inside WSL (so you can run flutter commands inside WSL - it should be the Linux version of the Flutter SDK and not the Windows one if you're using the zip).
To have your emulator show up in flutter devices from inside WSL, you will likely need to run adb tcpip 5555 from the Windows side (this means you need an Android SDK in Windows) - this will tell your phone to listen on TCP port 5555. Then you'll need to run adb connect [phone ip]:5555 from inside WSL (this means you'll need an Android SDK in Linux). If all goes well, the phone should then show up in adb devices and also be picked up by the device selector in VS Code.
I tried creating a test Flutter-project on the \wsl$ network mount, which didn't work.
It's not clear what went wrong here, though my first guess would be that maybe the UNC path isn't supported - if you map a drive letter to it does it make a difference?
While this isn't an officially supported setup, feel free to raise issues in the Dart-Code repository on GitHub with any issues you have. It's not a priority, but I would like for VS Code Remoting (including WSL and Docker) to generally work for Dart and Flutter dev.
Anytime you're crossing/sharing the file-system boundary from windows to wsl you're paying a massive cost in speed/time.
With the setup you've described I'd consider trying to self-host the browser based VSCode.dev inside wsl - checkout details instructions here: https://medium.com/geekculture/3-steps-to-code-from-anywhere-45401247f479
Personally I've settled on running VSCode and docker inside a Linux VM on Windows, and have a 96% time saving in things like running up a server and watching code for changes making this setup my preferred way now.
The standardisation of devcontainer.json and being able to use github codespaces if you're away from your normal dev machine make this whole setup a pleasure to use.
see https://stackoverflow.com/a/72787362/183005 for detailed timing comparison and setup details

Java web application: start coding from a remote git repo in a debian VPS server

I have a VPS server, the OS is debian.
I have a ssh access to the server.
In debian I have a src folder containing a git repo of a java web application. The path of the git repo is /src/myRepo.
I want to start coding with a java IDE (netbeans?). What do I have to do?
This problem usually has nothing to do with Git.
Basically the workflow is:
Work on your project locally, build test.
Deploy the resulting JAR files to the VPS.
Re-test they work as intended on the VPS.
That is, in order to support this workflow,
on your VPS you need:
A working JRE.
A working web server — if you don't intend to host your Java application
using something dedicated (like tomcat), otherwise you need that hosting
application installed and configured.
A working SSH server.

Upload and Deploy Golang application to VPS

I've made a Go app and when I run the exe locally it works fine. Where would I upload this to on my VPS? public_html/domain.com/somefolder ? or /usr/somefolder with SSH?
I have my app, my .exe and src-files, but what do I do with it when I deploy online on my VPS? I haven't been able to find a tutorial about this, so I hope you can help me.
do I upload all files in my src folder including the binaries from when I've written "go build"?
upload to where on my VPS? using ssh or cpanel / ftp program or what?
What are the steps from "go build" on your own local windows 8 computer to uploading and running it online on a linux server?
Ps.
Additionally will CentOS 5.1.1 although not supported https://golang.org/doc/install - allow for me to run an already linux compiled go program on my VPS, and does it only mean that I cannot install Go and do compilation on the CentOS 5.x server? Would CentOS 5.1.1 explain the "segmentation fault" error shh gives me when running the command "./[filename]"?
Well, usually, you would:
Copy the binary you created + all resource files (html, css, images, ...)
(optionally the source code as well)
Have a way to ensure the program keeps running
crontab can be used to check if your program is alive, but a simple monitoring program would suffice as well (which you can write yourself)
Run the binary as a non-privileged user
(you can also combine it with something like Docker if you want)
It does not make sense to put it inside public_html/domain.com/somefolder, as it is not public html code. You'd want your files somewhere they cannot be accessed unless using the application/binary you created.
My apologies for not having neat source links to my story. However, this does seem like the best thing to do.
Another important note:
Even though your VPS may run Windows, you can also deploy linux binaries to a Linux VPS (which are drastically cheaper) - looking at this SO question.
A short note I wrote on writing golang app on osx and deploying on Linux server: http://kumargaurav.co/2016/08/10/deploy-go-lang-app-linux-server/