npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

initial-server-setup

v1.2.0

Published

Tool to setup clean ubuntu 22.04 initially with docker and nginx under the hood via ansible playbooks

Downloads

69

Readme

Initial setup tool for ubuntu 18.04 remote servers based on ansible-playbook. To run this tool you have to take a look at the requirements below.

ℹ️ Successfully tested with Ubuntu 22.04. It has some strange things like using legacy repos, but it is what it is. This is not used by anyone except me anyway.

What does this tool do?

All this steps will be produced on your remote server in default configuration.

initial-server-setup setup --host 123.456.78.90

⚠️ Be careful: after this steps you will be able to login only with passed ssh keys (without password) with default or root users. To add more ssh keys to login from your another control nodes you have to install those ssh keys before.

  1. Initial ubuntu server configuration:
    1. install curl for transferring data with urls;
    2. install vim text editor to edit text files;
    3. install ufw firewall to protect ports;
    4. install git version control to manage repositories.
    5. create new user default with sudo privileges and ability to login to remote server with your local public ssh key (~/.ssh/id_rsa.pub);
    6. disable remote root login with password with PermitRootLogin prohibit-password;
    7. setup ufw tool to allow only ssh connections and some ports (http:80, https:443, :8000).
  2. Install and configure docker-ce toolbox and do post-installation steps:
    1. install docker to manage containers;
    2. configure crontab for root to run docker system prune --all --force every night to clean detached images and other docker stuff to free space after deployments.
    3. add user default to docker administrators group;
    4. pull hello nginx container nginxdemos/hello;
    5. run hello container on :8001 port inside localhost (the container isn't published to the internet yet on this step).
  3. Install and configure nginx:
    1. install nginx to manage web servers;
    2. configure nginx with default configuration;
    3. add default server to proxy all requests from public :8000 port to the nginx hello container.
  4. Install and configure certbot:
    1. install certbot to manage ssl certificates.

As the result you will get configured web server with nginx layer to manage web servers and with docker to run containers inside remote machine. Also you have to be able to see the result of nginxdemos/hello container on your-domain.com:8000. And you will be able to login to your remote server with ssh <default|root>@<remote-server-ip|remote-server-domain>.

demo

Which requirements does this tool have?

Server node requirements

Server node is a node where you want to configure the environment.

Control node requirements

Control node is a node from what you are going to run setup tool.

How to install this tool?

npm i -g initial-server-setup

How to use this tool?

Basic configuration uses root user to login into remote server and ~/.ssh/id_rsa.pub to install ssh key inside remote server. Also this tool creates user default to login into remote server with ~/.ssh/id_rsa.pub key.

initial-server-setup setup --host 123.456.78.90

Options to configure the tool

You can define the following options and full command will be like.

initial-server-setup setup --host 123.456.78.90 --root-user root --root-key ~/.ssh/id_rsa.pub --target-user default --target-key ~/.ssh/id_rsa.pub

Option | Default | Required | Description --- | --- | --- | --- host | | + | Remote server ip or domain. root-user | root | - | Remote sudo user to login into clean server. root-key | ~/.ssh/id_rsa.pub | - | Remote sudo user key to install inside remote server. target-user | default | - | Remote admin user to create with sudo privileges. target-key | ~/.ssh/id_rsa.pub | - | Remote admin user key to install inside remote server.

Existed commands in the tool

You can use any command separately and every command has it own --help.

initial-server-setup setup-docker --help

Command | Description --- | --- setup [options] | General command to run all setup-* commands. setup-key [options] | Install local public key to remote host. setup-ubuntu [options] | Do initial ubuntu setup. setup-docker [options] | Do docker-ce setup and run hello container. setup-nginx [options] | Do nginx setup and run hello server for the hello container. setup-certbot [options] | Do certbot installation with nginx module.

Install additional ssh keys to remote server

Copy and paste your ssh public key from another control node to what you want to give access via the following command (do not forget to use -f flag).

ssh-copy-id -f -i ~/.ssh/different-key.pub <remote-server-ip|remote-server-domain>