<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: rbondarenko</title>
    <description>The latest articles on DEV Community by rbondarenko (@romanbon).</description>
    <link>https://dev.to/romanbon</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F48566%2F78d6f0b5-8cdf-42f5-8eae-2579102e1187.jpeg</url>
      <title>DEV Community: rbondarenko</title>
      <link>https://dev.to/romanbon</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/romanbon"/>
    <language>en</language>
    <item>
      <title>SSH server with WebPack</title>
      <dc:creator>rbondarenko</dc:creator>
      <pubDate>Tue, 19 Dec 2017 15:23:43 +0000</pubDate>
      <link>https://dev.to/romanbon/ssh-server-with-webpack-3m1l</link>
      <guid>https://dev.to/romanbon/ssh-server-with-webpack-3m1l</guid>
      <description>&lt;p&gt;Hi!&lt;/p&gt;

&lt;p&gt;I've just made a nice solution I want to share with you. It's an SSH server with WebPack for front-end developers who work with JavaScript. &lt;br&gt;
What I like about this stuff is that I don't have to count on my machine resources when writing code - I just synchronize my local developer environment (e.g. WebStorm or other IDE) with a cloud self-hosted machine and don't waste my local resources to run WebPack applications. &lt;/p&gt;
&lt;h2&gt;
  
  
  How it works:
&lt;/h2&gt;

&lt;p&gt;SSH server captures all changes in your local project files and instantly synchronizes them with the project files on you hosting. Webpack configures your project build and displays it in your browser in real time.&lt;/p&gt;

&lt;p&gt;Or you can use sshfs to mount a remote file system over SSH.&lt;/p&gt;
&lt;h3&gt;
  
  
  It consists of:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Ubuntu:16.04&lt;/li&gt;
&lt;li&gt;Openssh-server&lt;/li&gt;
&lt;li&gt;Nodejs&lt;/li&gt;
&lt;li&gt;Webpack-dev-server&lt;/li&gt;
&lt;li&gt;Webpack 3.8.1&lt;/li&gt;
&lt;li&gt;Yarn 1.3.2&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To launch this solution on &lt;a href="https://containerum.com/"&gt;Containerum.com&lt;/a&gt; sign up with the service, download and use &lt;a href="https://github.com/containerum/chkit"&gt;Containerum CLI&lt;/a&gt; &lt;code&gt;chkit&lt;/code&gt;.&lt;/p&gt;
&lt;h4&gt;
  
  
  1. Run the Solution with &lt;code&gt;chkit solution&lt;/code&gt;:
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ chkit solution run containerum/webpack-3.8-ssh-solution -e USER=react -e USER_PASS=12345678 -e NAME=websln -e CPU=500m -e RAM=500Mi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;USER - username,&lt;/li&gt;
&lt;li&gt;USER_PASS - password,&lt;/li&gt;
&lt;li&gt;NAME - Solution name&lt;/li&gt;
&lt;li&gt;CPU, RAM - compute resources for this Solution&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  2. Make sure that the Solution is running:
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ chkit get deploy

+-------------------+------+-------------+------+-------+-----+
| NAME              | PODS | PODS ACTIVE | CPU  | RAM   | AGE |
+-------------------+------+-------------+------+-------+-----+
| websln-13k4y      | 1    | 1           | 500m | 500Mi | 22m |
+-------------------+------+-------------+------+-------+-----+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  3. Check through the list of services using &lt;code&gt;chkit get&lt;/code&gt; command, mark the port used to connect to the running VM:
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ chkit get svc

+--------------+-----------------+----------+-------------------+-------------+-----+
| NAME         | CLUSTER-IP      | EXTERNAL | HOST              | PORT(S)     | AGE |
+--------------+-----------------+----------+-------------------+-------------+-----+
| websln-13k4y | 10.105.25.198   | true     | x3.containerum.io | 33176:22/TCP| 18m |
+--------------+-----------------+----------+-------------------+-------------+-----+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  4. Connect to the running machine:
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ ssh react@x3.containerum.io -p33176
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  5. Create a working directory:
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;react@websln:~$ mkdir react
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;and jump to this directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;react@websln:~$ cd react
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  6. Install a sample react application on your local machine &lt;a href="https://github.com/facebookincubator/create-react-app:"&gt;https://github.com/facebookincubator/create-react-app:&lt;/a&gt;
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ npm install -g create-react-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Note: You'll need to have Node &amp;gt;= 6 on your machine.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;and create a new app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ create-react-app my-app

$ cd my-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open WebStorm on your machine and set the following project settings:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GWI5rfMj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/kwohm5dcqk7gi58ip11h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GWI5rfMj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/kwohm5dcqk7gi58ip11h.png" alt=""&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Gpz-Dk1O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/s1xjr3ncqtyez5y1nmkh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Gpz-Dk1O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/s1xjr3ncqtyez5y1nmkh.png" alt=""&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PzaW9R5L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/3mnxap6w21gnpdpgqssw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PzaW9R5L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/3mnxap6w21gnpdpgqssw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Test the connection:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--a2mT92oa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/4kkyc81w1vuscgglign9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--a2mT92oa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/4kkyc81w1vuscgglign9.png" alt=""&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yepAYcnM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/slteqwipe1xtpvgx3svq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yepAYcnM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/slteqwipe1xtpvgx3svq.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Upload the selected project folders to the running VM:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5eeq7-3c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/hu9v38o8izc5n7c1jkgt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5eeq7-3c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/hu9v38o8izc5n7c1jkgt.png" alt=""&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fAMfkOUd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/mfdmd7tf22ypm47el1je.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fAMfkOUd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/mfdmd7tf22ypm47el1je.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  7. Run the following commands on the running machine:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;react@websln:~$ npm i

react@websln:~$ npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  8. To provide access to the launched Solution, we’ll create a service with &lt;code&gt;chkit expose&lt;/code&gt; command locally:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chkit expose deploy websln-13k4y -p portname:3000:TCP
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  9. Using &lt;code&gt;chkit get&lt;/code&gt; get the address and the port to access the running Solution:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ chkit get svc

+-------------------+-----------------+----------+-------------------+---------------+-----+
| NAME              | CLUSTER-IP      | EXTERNAL | HOST              | PORT(S)       | AGE |
+-------------------+-----------------+----------+-------------------+---------------+-----+
| websln-13k4y      | 10.105.25.198   | true     | x3.containerum.io | 33176:22/TCP  | 22m |
+-------------------+-----------------+----------+-------------------+---------------+-----+
| websln-13k4y-3ac7 | 10.111.121.79   | true     | x2.containerum.io | 19451:3000/TCP| 9s  |
+-------------------+-----------------+----------+-------------------+---------------+-----+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;http://x2.containerum.io:19451&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  10. All changes that you make in &lt;code&gt;src/App.js&lt;/code&gt; are now immediately reflected in your project and can be viewed in your browser at &lt;code&gt;http://x2.containerum.io:19451&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Nujs6juS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/f3kujcb0poulzqpi1uas.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Nujs6juS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/f3kujcb0poulzqpi1uas.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Pretty neat, right? And it saves your local resources, so you can work from any machine pretty fast. I hope you'll find it useful too. If you have any questions or suggestions, or if I missed something, please comment.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>react</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
