In this article, we are going to:
We want to route requests to custom urls (like
my-app.local) to specific web-servers. This is the role of a reverse proxy.
We are going to use nginx as…
In this article, we are going to
- install Docker on your computer.
As an example, we’ll take a very simple Node.js / Express / MongoDB aplication. Here is the package.json of this app:
"dev": "nodemon ./index.js",
"start": "node ./index.js"
It has two scripts:
Functional programming is the process of building software by composing pure functions, avoiding shared state, mutable data, and side-effects.
Imperative code has a few problems:
With a large codebase, this is difficult to maintain and test. Functional programming aims to solving these problems.
So let’s refactor the imperative code from the previous article and use concepts related to functional programming: pure functions, closures and functions composition.
We have an array of tuples representing the points coordinates of a line.
const points = [[5, 10], [10, 40], [40, 30], [60, 5], [90, 45], [120, 10], [150, 45], [200, 10]]
And a Svg element in an HTML page:
<svg viewBox="0 0 200 200" version="1.1" xmlns="http://www.w3.org/2000/svg" class="svg"></svg>
We want to make a
<path> element from the
d attributes of
<path> always starts with a move to command:
M x,y, followed by several commands depending on the type of shape. …
Let’s see how to:
- Several websites run inside Docker containers on a single server. (Each one could either be a static files server, or Wordpress running on Apache or combination of a Node.js app and a reverse-proxy like in my previous article).
- The domain name for each website is configured to point to the IP of the server.
The manual way to setup a nginx reverse-proxy…
Edit Apr 28, 2018: removed the deprecated
links docker-compose instructions.
Let’s make an example which does the following when the server receives a client request:
The code is on Github.
This could be extended to build a Progressive Web App (with Vue.js or React) on top of the Wordpress API (or anything with a REST API).
to configure the deployment process with a Git Hook.
Three steps to configure the deployment process:
1. Create an empty Git repo on the server
2. Write a Git Hook to deploy the code
3. Deploy from the local computer
On the remote server:
# Copy the 'project-create.sh' bash script https://gist.github.com/francoisromain/58cabf43c2977e48ef0804848dee46c3
# Then create a new project
# It configures a Git repo, and creates a Git hook$ bash ./path/to/project-create.sh <your-project>
On your local computer:
# Add your server as a Git remote called 'deploy'
git remote add deploy ssh://<your-name>@<your-ip>/srv/git/<your-project>.git/# Push your code and deploy
git push deploy master
- Connect to the server via SSH without…