Skip to content

Commit dd3676f

Browse files
authored
Merge pull request #128 from neonexus/master
Minor.
2 parents 0f9eae9 + 1c841d0 commit dd3676f

File tree

5 files changed

+49
-90
lines changed

5 files changed

+49
-90
lines changed

.github/workflows/codeql-analysis.yml

-69
This file was deleted.

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## [v5.3.1](https://github.com/neonexus/sails-react-bootstrap-webpack/compare/v5.3.0...v5.3.1) (2024-04-22)
4+
### Features
5+
6+
* Added a couple tips about TMUX to README.
7+
38
## [v5.3.0](https://github.com/neonexus/sails-react-bootstrap-webpack/compare/v5.2.3...v5.3.0) (2024-04-22)
49
### Features
510

README.md

+37-16
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# sails-react-bootstrap-webpack
22

33
[![Travis CI status](https://img.shields.io/travis/com/neonexus/sails-react-bootstrap-webpack.svg?branch=release&logo=travis)](https://app.travis-ci.com/github/neonexus/sails-react-bootstrap-webpack)
4-
[![Sails version](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fneonexus%2Fsails-react-bootstrap-webpack%2Fv5.3.0%2Fpackage.json&query=%24.dependencies.sails&label=Sails&logo=sailsdotjs)](https://sailsjs.com)
5-
[![React version](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fneonexus%2Fsails-react-bootstrap-webpack%2Fv5.3.0%2Fpackage.json&query=%24.devDependencies.react&label=React&logo=react)](https://react.dev)
6-
[![Bootstrap version](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fneonexus%2Fsails-react-bootstrap-webpack%2Fv5.3.0%2Fpackage.json&query=%24.devDependencies.bootstrap&label=Bootstrap&logo=bootstrap&logoColor=white)](https://getbootstrap.com)
7-
[![Webpack version](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fneonexus%2Fsails-react-bootstrap-webpack%2Fv5.3.0%2Fpackage.json&query=%24.devDependencies.webpack&label=Webpack&logo=webpack)](https://webpack.js.org)
4+
[![Sails version](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fneonexus%2Fsails-react-bootstrap-webpack%2Fv5.3.1%2Fpackage.json&query=%24.dependencies.sails&label=Sails&logo=sailsdotjs)](https://sailsjs.com)
5+
[![React version](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fneonexus%2Fsails-react-bootstrap-webpack%2Fv5.3.1%2Fpackage.json&query=%24.devDependencies.react&label=React&logo=react)](https://react.dev)
6+
[![Bootstrap version](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fneonexus%2Fsails-react-bootstrap-webpack%2Fv5.3.1%2Fpackage.json&query=%24.devDependencies.bootstrap&label=Bootstrap&logo=bootstrap&logoColor=white)](https://getbootstrap.com)
7+
[![Webpack version](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fneonexus%2Fsails-react-bootstrap-webpack%2Fv5.3.1%2Fpackage.json&query=%24.devDependencies.webpack&label=Webpack&logo=webpack)](https://webpack.js.org)
88

99
[//]: # ([![Codecov](https://img.shields.io/codecov/c/github/neonexus/sails-react-bootstrap-webpack?logo=codecov)](https://codecov.io/gh/neonexus/sails-react-bootstrap-webpack))
1010

@@ -537,28 +537,44 @@ For example: `./ngrok.js token=AUTHTOKEN1` > `NGROK_AUTHTOKEN=AUTHTOKEN2 ./ngork
537537
If you would like to use [`sails-hook-autoreload`](https://npmjs.com/package/sails-hook-autoreload), just install it: `npm i sails-hook-autoreload --save-dev`. The config
538538
file [`config/autoreload.js`](config/autoreload.js) is already pre-configured for this repo.
539539

540-
## Getting setup remotely
540+
## Getting Setup Remotely
541541

542542
There are a lot of ways to go about remote deployments; many automated, some not so much. For the sake of argument, let's say you want to set up a remote server by hand. It would be nice if said
543-
server (or servers if behind a load-balancer), could do a `git pull`, `npm install`, and an asset build if need be `npm run build`. It would also be great if you could see the progress, or even
543+
server (or servers if behind a load-balancer), could do a `git pull`, `npm install`, and if need be `npm run build`. It would also be great if you could see the progress, or even
544544
just the console of the Node server.
545545

546-
That's what the [`self-update.sh`](self-update.sh) and [`tmux.sh`](tmux.sh) shell scripts are for. Note, they are both defaulted to `bash`, but should work just fine in `zsh`.
546+
That's what the [`self-update.sh`](self-update.sh) and [`tmux.sh`](tmux.sh) shell scripts are for. Note, they are both using `bash`, but should work just fine in `zsh`.
547547

548548
### What is TMUX?
549549

550550
In simplest terms, TMUX is a "terminal multiplexer". It lets you switch between programs in one terminal, detach them (they keep running in the background) and reattach them to a different terminal.
551551

552-
In other words, it adds a lot of magic to the terminal. One of the most useful things, is being able to run programs in the background, but still being able to see the console output later (as
553-
it is still running). It runs on most Linux-y distros, including macOS.
552+
In other words, it adds a lot of magic to the terminal. One of the most useful things, is being able to run programs in the background, but still be able to see the console output later (as
553+
it is still running). It runs (on the remote server) on most Linux-y distros, including macOS.
554554

555-
[Check out their "Getting Started" docs](https://github.com/tmux/tmux/wiki/Getting-Started) for more on what you can do.
555+
[TMUXCheatSheet.com](https://tmuxcheatsheet.com/) has a great "how to install and use" that you can find here: https://tmuxcheatsheet.com/how-to-install-tmux/
556+
557+
Once installed, just run `tmux a` (or `tmux attach`), which will attach to the last open session. If there isn't one, it'll open one. Running just `tmux` will create a whole new session, and you
558+
generally don't want that.
559+
560+
`Ctrl + b` is the command to start a TMUX shortcut. It is how you navigate around inside TMUX.
561+
562+
A couple shortcuts you'll want to know:
563+
564+
| Description | Command |
565+
|-----------------|------------------------------------------------------|
566+
| Detach TMUX | `Ctrl + b` then `d` |
567+
| Next Window | `Ctrl + b` then `n` |
568+
| Previous Window | `Ctrl + b` then `p` |
569+
| Create Window | `Ctrl + b` then `c` |
570+
| Close Window | `Ctrl + b` then `&` (aka `Shift + 7`) OR just `exit` |
571+
| Window Preview | `Ctrl + b` then `w` |
572+
| Rename Window | `Ctrl + b` then `,` |
556573

557-
To install (remember: on the remote machine, not your local machine), it's most likely `sudo INSTALLER install tmux`. Amazon Linux is `sudo yum install tmux`, Ubuntu is `sudo apt-get install tmux`.
558574

559575
### A simple walkthrough for a self-updating VM
560576

561-
For this guide, I'm going to be using Amazon Linux as the basis; it's a great default if using AWS. However, most of these steps can easily be adapted.
577+
For this guide, I'm going to be using Amazon Linux as the basis; it's a great default if using AWS. However, most of these steps can easily be adapted for other distros.
562578

563579
It should also be noted, this is by no means the only way to set up remote servers; nor is it a thorough guide. This is just a quick-n-dirty, get off the ground running without a lot of tooling, kind
564580
of guide. There are PLENTY of automated deployment managers and documentation out there. This is fairly open-ended; it is assumed you know how to do a portion of basic remote server management.
@@ -636,7 +652,7 @@ Now that you have the server's public key saved in your repo, you should be able
636652
git clone [email protected]:USERNAME/REPO.git myapp
637653
```
638654

639-
#### Make sure everything works
655+
#### Make sure dependencies work
640656

641657
Now, you'll want to `cd myapp`, and `npm install`.
642658

@@ -645,13 +661,13 @@ the [environment variables](#environment-variables), but it is also possible to
645661

646662
#### Give it a spin
647663

648-
You should now be able to `sudo npm run lift:prod` (recommended for all remote environments, even DEV). `sudo` is needed on Amazon Linux, because it required ROOT permissions to open ports.
664+
You should now be able to `sudo npm run lift:prod` (recommended for all remote environments, even DEV). `sudo` is needed on Amazon Linux, because it requires ROOT permissions to open ports.
649665

650666
If everything is working as intended... congrats (or so you thought)! Now that you have everything working; it's time to get the server to update / rebuild / start itself.
651667

652668
#### Final stretch
653669

654-
Now you need to decide how you are going to have the `tmux.sh` script run on startup. The easiest way would be to just install `cronie`:
670+
Now you need to decide how you are going to have the `tmux.sh` script run on startup. The easiest way would be to just install `cronie` (for the use of `crontab`):
655671

656672
```shell
657673
sudo yum install cronie
@@ -675,15 +691,20 @@ Now edit the `crontab` to run the script at `@reboot`:
675691

676692
#### Have you tried turning it off and on again?
677693

694+
Now force it to restart, and the instance should automatically lift the server.
695+
678696
```shell
679697
sudo reboot
680698
```
681699

682700
Now re-login to the instance. You should be able to `tmux attach` and see the Sails console.
683701

702+
Once you've verified everything works, you can use `./tmux.sh myapp status` / `./tmux.sh myapp start` / `./tmux.sh myapp stop` / `./tmux.sh myapp restart` (but you don't have to).
703+
684704
#### Now save that image!
685705

686-
Now you should create an AMI from that server. You should be able to terminate the running instance, and spin up a new one using your new custom AMI, and everything should just work.
706+
Now that you have a self-starting/updating server, you should create an AMI from that instance. After it's been created, you should be able to terminate the running instance, and spin up a new one
707+
using your new custom AMI, and everything should just work. Now you have the start of a robust remote fleet; because spinning up new servers is just a couple clicks (or commands) away.
687708

688709
## What about SEO?
689710

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
{
22
"name": "sails-react-bootstrap-webpack",
3-
"version": "5.3.0",
3+
"version": "5.3.1",
44
"description": "A glass-box starter framework that grows with you. Built on proven and reliable tech like Sails, React, Bootstrap & Webpack.",
55
"keywords": [
66
"sails",
77
"react",
88
"bootstrap",
99
"webpack",
1010
"monorepo",
11-
"request logging",
1211
"startup",
13-
"ngrok"
12+
"ngrok",
13+
"tmux",
14+
"autoupdate",
15+
"selfupdate"
1416
],
1517
"dependencies": {
1618
"csrf": "3.1.0",

0 commit comments

Comments
 (0)