Giter VIP home page Giter VIP logo

serverinstall's Introduction

One Day Apps YT Channel

Ansible scripts to install PostgreSQL, Postgrest, Glewlwyd, Nodered, RSS-Bridge, Nginx, phpPgAdmin, Apticron, and UFW on a new Ubuntu 20.04 LTS server.

What is this?

It's an automated deployment that follows the video tutorial series I've started here:

DNS and a Server

This is all of the back-end requried to set up a database, an API that talks to that database, an authentication server, and some scraping and low-code development tools that might be useful to go with them for fetching data out of remote services.

How do I use it?

Install Ansible (brew install ansible on a Mac after you've installed Homebrew or sudo apt install ansible if you're running Ubuntu within Windows). Download the repo, unzip it, cd into the directory in a terminal and run the serverinstall shell script from an OSX terminal or Ubuntu command prompt like...

$ sh serverinstall

It will ask you for a fully qualified domain name, an email address and password (one without 2fa, this is for the server to use to send notifications by itself, make an "app password"), whether you'd like a firewall or not (say yes...), and if you put in an email from a custom domain, the SMTP server settings as you would put in an email client on your laptop/desktop. It knows the settings for common email services like Yahoo, Gmail, Hotmail, and iCloud if you give it an address from one of those, so you may want to use one of those free email services to make it a bit easier.

It presumes your SSH config logs into your server with the root account, which is the default on Digital Ocean. If you need to log into another account and use sudo, uncomment the lines atop main.yml in the includes directory and specify the settings you need. On a default AWS EC2 Ubuntu instance this would be remote_user: ubuntu and become: True, for example.

Then what?

The install will take some time, but when it finishes you'll have a server up and running with lots of spiffy new tools that my videos will explain how to use for fun and profit! The links to the things it installs are...

The username to log into all of these is admin, and the password will be in your home folder in a file called ansible-admin-password.txt, Ansible created a random password for you when installing everything.

If you told it "yes" on the firewall option it will install UFW and restrict incoming traffic to ports 80, 443, and 22 (web and ssh) only.

Are there any other things I need to do after it finishes?

  1. Download Postman if you don't have it, it's very useful for testing APIs.

  2. Log into phpPgAdmin, and create a database named "api" within the web interface. If you do so rather than via CLI or via Ansible, there is a plugin that will allow graphical table design, which we'll use in the video series on these servers to make creating database schemas a LOT easier. Then click on the "api" database after you've created it, click "SQL" in the upper right hand corner of the window, and paste/run the contents of the permissions_setup.sql file that you downloaded from this repository. It sets the proper permissions on the database for the API.

  3. Log into your Glewlwyd instance and click Users, then the pencil to edit the Administrator user, and add the scope openid to the admin account, as well as the role web_admin.

There is a Postman collection and environment in this repo that you can import for some basic API interaction with the services installed in this deployment. If you've never used Postman before, when you open it up you can click the import button to add the files, like so:

Postman Import

Postgrest controls access by database roles claimed in the authentication token that the client/user passes with a request. In this deployment, web_anon is the default unprivileged user, web_user has permissions to READ, INSERT, and UPDATE in the API database, and web_admin has all privileges. You'll want to do a lot of your testing with the web_admin account to make sure things work in your apps, in all likelihood. These permissions can be changed, added, deleted, etc of course.

Help! Something didn't work, I got a red error from Ansible

Feel free to leave an issue, and I'll help you sort it out. If something randomly failed because of your connection going down or the server rebooting or some other random occurrence, try to re-run the scripts and it may fix whatever is broken (within reason). Of course you can simply delete and create a new server instance as well to start from scratch, that's the beauty of cloud computing ;).

serverinstall's People

Contributors

onedayappdev avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.