Skip to content

Instantly share code, notes, and snippets.

View dylanlott's full-sized avatar
🏗️
Hacking

d7t dylanlott

🏗️
Hacking
View GitHub Profile
@dylanlott
dylanlott / server-setup.md
Last active February 21, 2020 19:44
Checklist for standing up a secure, robust Ubuntu 16.04 server with Docker and Node.

Server Setup and Provisioning Checklist

ssh root@<your.server.ip.addr> to access your server.

Once you're in, update and upgrade your Ubuntu installation.

apt-get update; sudo apt-get upgrade -y

My first move is usually to add in my dotfiles and setup my vim how I like it. If you don't have a vim setup, skip this step.

@dylanlott
dylanlott / deploying-with-flightplan.md
Last active February 21, 2017 17:12 — forked from learncodeacademy/flightplan-deploy.md
Deploy Node.js Apps with Flightplan

Setup your server

Add a Passwordless Deploy user

(wherever it says url.com, use your server's domain or IP)

Login to new server as root, then add a deploy user

sudo useradd --create-home -s /bin/bash deploy
sudo adduser deploy sudo
@dylanlott
dylanlott / api_utils.js
Last active January 13, 2017 15:58
CRUD API utility written in 36 lines of code, using native Promises and Mongoose methods.
module.exports.create = function (model, body) {
return Promise((resolve, reject) => {
new model(body).save()
.then((result) => resolve(result))
.catch((err) => reject(err))
})
}
module.exports.query = function (model, query) {
return Promise((resolve, reject) => {
model.find(query)
@dylanlott
dylanlott / docker-compose-node-mongo.yml
Created December 15, 2016 22:06
docker-compose.yml file for a node/mongo starter pack
version: '2'
services:
mongodb:
image: bitnami/mongodb:latest
ports:
- '27017:27017'
web:
image: node:latest
volumes:
- ./src/app:/usr/src/app
@dylanlott
dylanlott / package.json
Created October 30, 2016 19:40
package.json example for Docker tutorials
{
"name": "myapp",
"version": "1.0.0",
"description": "Docker tutorial my-app",
"main": "hello-world.js",
"scripts": {
"start": "node hello-world.js"
},
"author": "Your Name Here",
"license": "ISC",
@dylanlott
dylanlott / hello-world.js
Last active October 30, 2016 19:38
Hello World example app for Docker
var express = require('express');
var app = express();
app.get('/', function (req, res) {
res.send('Hello World!');
});
app.listen(8080, function () {
console.log('Example app listening on port 8080!');
});
version: "2"
services:
mongo:
image: mongo
ports:
- '27017:27017'
server:
build: my-app-repo/my-server
ports:
- '8080:8080'
@dylanlott
dylanlott / Dockerfile
Created October 30, 2016 17:29
Serve front end using NGINX and Docker
FROM kyma/docker-nginx
COPY dist/ /var/www/
CMD 'nginx'
@dylanlott
dylanlott / docker-compose.yml
Created October 26, 2016 22:55
docker-compose.yml example for the Docker First Deploy Fast blog series
version: "2"
services:
web:
build: . //build the web container from our current directory Dockerfile
ports:
- '8080:8080' //bind external ports to container ports
working_dir: '/app'
command: npm run start //the command to run to start the container
environment:
- MONGO_URI=mongodb://mongo:27017 //pass mongo conection string params to container
@dylanlott
dylanlott / node-dockerfile
Last active October 30, 2016 19:26
node-dockerfile
FROM node:argon
RUN mkdir -p /usr/src/app
COPY package.json /usr/src/app
RUN npm install
COPY ./ /usr/src/app
EXPOSE 8080
CMD [“npm”, “run”, “start”]