Wednesday, October 31, 2018

Rocketchat backup and restore UBUNTU 18.04 SNAPS

This was taken from https://rocket.chat/docs/installation/manual-installation/ubuntu/snaps/


UBUNTU 18.04 using SNAPS
BACKUP ROCKET CHAT


1. Stop your rocketchat-server:

sudo service snap.rocketchat-server.rocketchat-server stop
2. Issue this backup command:
sudo snap run rocketchat-server.backupdb

3. If all goes well, you will see some output similar to:

[+] A backup of your data can be found at /var/snap/rocketchat-server/common/backups/rocketchat_backup_.tgz

4. Start your rocketchat-server:

sudo service snap.rocketchat-server.rocketchat-server start

UBUNTU 18.04 using SNAPS
RESTORE ROCKET CHAT

1. Stop your rocketchat-server:

sudo service snap.rocketchat-server.rocketchat-server stop
Please note: while the rocketchat-server service should be stopped, the rocketchat-mongo service should be kept running!
sudo service snap.rocketchat-server.rocketchat-mongo status | grep Active
   Active: active (running) (...)

2. Copy your backup file to the snap’s common folder:

sudo cp rocketchat_backup.tgz /var/snap/rocketchat-server/common/

3. Issue this restore command:

sudo snap run rocketchat-server.restoredb /var/snap/rocketchat-server/common/rocketchat_backup.tgz

4. If you are replacing an existing database, you will be warned:

*** ATTENTION ***
* Your current database WILL BE DROPPED prior to the restore!
* Would you like to make a backup of the current database before proceeding?
* (y/n/Q)>
  • Press y and Enter to make a backup of the database in its current state.
  • Press n and Enter to continue without a backup of the database in its current state.
  • Press any key and/or Enter to quit the restore process without making any changes.

5. If you choose to proceed and all goes well, you will see some output similar to:

[*] Extracting backup file...
[*] Restoring data...
[*] Preparing database...
[+] Restore completed! Please restart the snap.rocketchat services to verify.
If something goes wrong, you will instead be presented with a path to the relevant log file to help remedy errors. In this case, the database may not be usable until a restore is successfully performed.

6. Start your rocketchat-server:

sudo service snap.rocketchat-server.rocketchat-server start


Monday, October 29, 2018

Setting up Rocketchat on a UBUNTU 18.04 server

Rocketchat 0.70.4 on UBUNTU 18.04 Server

Installing Ubuntu server is pretty straight forward.  I did it on virtual hardware.  Its what I call a "next next next" install.  I used all the default settings that Ubuntu had asked me.  I had no issues on hardware recognition.  There are plenty of sites that can assist if you run into anything.  This is a summary of steps that I did from https://rocket.chat/docs/installation/manual-installation/ubuntu/
Just tons of info.  These steps worked with my server implementation, so they might help you!


NETWORK CONNECTIONS

By default the system will ask you about network, and have DHCP set to enabled.  This is fine for most users.  If you want to hardcode your IP, you can do it now by selecting IPv4 and entering in the information specific to your server.


If you are using DHCP, you'll notice that the DHCP address (if NIC is discovered and assigned properly) is already showing.  Note this IP if you need to logon to the server when done.

If you are configuring your server and want to hardcode the IP, Ubuntu does it differently and isn't really the same as any other entry method I've ever encountered.  Subnet is handed differently:

In my example, I want to set the ip to 10.1.80.182

When you put in the subnet, it wants to calculate the subnet for you, so instead of a common "255.255.255.0" subnet, you put in the subnet class instead for the ip.

Instead of 255.255.255.0, you would put in 10.1.80.0/24 (or the subnet class that you need if its not the common one)


SYSTEM CREDENTIALS

Enter in some user specific information.  This is the information that you will use to identify and connect to your server.


ADDITIONAL PACKAGES

System is going to ask you to install some other applications, including rocket chat.

For this document, I didn't select it, but instead installed it via SNAP.  It should work, I haven't tested it yet at the time of writing this document.

One thing that I do recall, if you select this option, it took like a minute or so (for my installs anyway) for the rocketchat service to become available.  So you should be able to make it work, just be patient when testing for the rocketchat login screen for the services to start (sudo service snap.rocketchat-server.rocketchat-server status)


Once completed, reboot your server and you should see the login in screen if all is successful!

INSTALLING ROCKET CHAT SERVER APPLICATION

Login to your server using the administrator account you configured above

I would make a suggestion that you do the remaining steps via a terminal application vs straight on the console, simply for situations where you might be copy/pasting the information.  Might save you typing if your console doesn't support paste functions

Installation is really straight forward.  Assuming you have network setup, internet is working, and the repo site is up, this command should install it:

sudo snap install rocketchat-server

System will start the snap download from the stable release repository
Takes a a minute or two, depends on network speeds and machine speeds

Once its completed you'll see something like:

rocketchat-server 0.70.4 from 'rocketchat' installed

Now use a browser http to your server.  After installation, it might take 30-60 seconds for the processes to startup, so if the server doesn't resolve right away, be patient before you panic.

http://IPofYourServer:3000

You should see the default RocketChat screen asking for your basic admin info


That is pretty much it for a default rocket chat installation.   You can put in your admin information and you are ready to go!

At this point it might be advisable to get the recent updates for the server with the following 

sudo apt-get update
then
sudo apt-get dist-upgrade
This step can take a while depending on network speed and volume of updates required.

Look at some of the other documentation here to secure your server with SSL connections






Setting up HTTPS access for RocketChat

Here's how you can configure HTTPS access for RocketChat.  

Want some HTTPS access for RocketChat?  Here's a really easy way.  This is a summary of steps that I did from https://rocket.chat/docs/installation/manual-installation/ubuntu/
Just tons of info.  These steps worked with my server implementation, so they might help you!

This was tested in UBUNTU 18.04 server using RocketChat 0.70.4

This document is how to use NGINX SSL reverse proxy

You'll need to have a server that the name can be resolved like "rocketchat.company.com"

You'll need to be able request a certificate from a cert authority

Login to Ubunut CLI then install NGINX with the following command:

sudo apt-get install nginx

Request a key via OPENSSL

This is a bit of a chore from the CLI, so I used this page (hope it works still)

https://www.digicert.com/easy-csr/openssl.htm

to help me generate the SSL certificate request syntax (highlighted in blue) which I paste into my CLI



EXAMPLE key for server called "rocketchat"

openssl req -new -newkey rsa:2048 -nodes -out rocketchat.csr -keyout rocketchat.key -subj "/C=US/ST=California/L=Oakland/O=Company/CN=rocketchat"

The system will generate two files.  One is your private .key, the other one is the .CSR or "request" key that you would submit to your certificate authority.

Once you get your public key back, perform these functions:

The private key that is generated, put it into

/etc/nginx/certificate.key

make it harder to change by assigning permission 400

chmod 400 /etc/nginx/certificate.key

Now copy your certificate provided to you by your authority to

/etc/nginx/certificate.crt

Now edit the file

/etc/nginx/sites-enabled/default

Delete everything in there and paste in the following below.

Change "server_name servername.domainname.com;" to the host name of your server.  
Example using my configs would be: "server_name rocketchat.company.com;"


# Upstreams
upstream backend {
    server 127.0.0.1:3000;
}
# HTTPS Server
server {
    listen 443;
    server_name servername.domainname.com;
    error_log /var/log/nginx/rocketchat.access.log;
    ssl on;
    ssl_certificate /etc/nginx/certificate.crt;
    ssl_certificate_key /etc/nginx/certificate.key;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # don’t use SSLv3 ref: POODLE
    location / {
        proxy_pass http://backend/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forward-Proto http;
        proxy_set_header X-Nginx-Proxy true;
        proxy_redirect off;
    }
}

Save your changes

Now startup NGINX:

sudo service nginx restart

If it works, the prompt should come back with no errors. 
If it does show errors or if you are curious, type in the following to get status information

systemctl status nginx.service

You should now be able to connect via HTTPS

https://ServerName

Reset Rocketchat lost Admin Password

Resetting RocketChat admin password

This method was test on a rocketchat on Ubuntu

Login into Ubunut CLI

Connect to MongoDB using this command:

sudo rocketchat-server.mongo


Select Rocket.Chat Database:

use parties





This command resets the username "administrator" to "12345".  If your system uses a different name, just change that name in the command below.

db.getCollection('users').update({username:"administrator"}, { $set: {"services" : { "password" : {"bcrypt" : "$2a$10$n9CM8OgInDlwpvjLKLPML.eizXIzLlRtgCh3GRLafOdR9ldAUh/KG" } } } })

You SHOULD be able to login to your server using the password 12345

Tuesday, October 23, 2018

2003-2007 Ford 6.0 liter Diesel Oil Cooler replacement procedure and EGR Cooler partial delete

I've done these.  Its not that hard a job.  But it is a very TIME consuming job and you have to be organized and have patience, else you could damage your truck and expose yourself to it not working.

This link has these videos summarized into a step by step that is helpful.

The steps come from the videos below, which both detail the process of the oil cooler replacement.  A wealth of information in both videos.  If you are tackling this process yourself, they are a must watch and study!

YOUTUBE

The recommendation I can make is to always use OEM Ford Parts whenever possible.
Especially the oil cooler and the important gasket kits that come with this part.

DO NOT CHEAP ON NON MOTORCRAFT PARTS.

You don't need specialized tools to do this.  Metric sockets and hand tools will work just fine.
This wouldn't be a job I would tackle if you are not mechanically inclined or have never done mechanical work before.  At very least you'll want to have a good close friend who is to give help.

A recommendation by many who do this job is to also perform whats known as a "partial delete" of your EGR system in these trucks (you should investigate emission regulations in your area).  The 6.0 EGR is notoriously prone to failures and doing this while you have this large component removed from the engine can save a lot of headaches down the road.  The only thing that is special about this is you will need to have some ports of it blocked off using a TIG welder.

The partial keeps everything looking factory, and keeps expensive exhaust components properly mounted.


Asterisk with AirTEL SIP FreePBX


Configuration example for AIRTEL INDIA SIP trunks with ASTERISK (FreePBX)

Working in FreePBX 14.0.4.1

You must have these configured to work with this service

DNS entry for 
ims.airtel.in = 10.232.139.146.  

You must be able to ping/route traffic to  "ims.airtel.in" successfully from your PBX.



Outbound CallerID must contain valid AIRTEL DID or calls WILL FAIL

outbound call (in FreePBX configs) 

"John Smith" <+919512349876>




FreePBX Configuration
1. CREATE a SIP TRUNK

     Trunkname = airtel-sip

2. Verify "disable trunk" = no

3. Click on SIP SETTINGS

     Trunkname = airtel-sip

PEER DETAILS: This is from my PBX settings (change username & password for your trunk.  

Airtel will give you USERNAME, SECRET and FROMDOMAIN
(The FROMDOMAIN is NOT the same as ims.airtel.in in my configuration experience.  I had to ask for FROMDOMAIN from airtel support)


username=++91XXXXXXXXXX@ims.airtel.in
secret=YourPASSWORD
fromdomain=10.X.X.X
type=friend
qualify=3600
port=5060
nat=force_rport,comedia
maxexpiry=600
insecure=invite,port
host=ims.airtel.in
dtmfmode=rfc2833
defaultexpiry=120
canreinvite=no
allow=all
context=from-trunk     
disallow=all     
allow=ulaw,alaw




4. Click on INCOMING tab

Register string = 

+91XXXXXX:YOUR_PASSWORD:+91XXXXXX@ims.airtel.in@ims.airtel.in/+91XXXXXX





5. click on SUBMIT and APPLY CHANGES
in the CLI should see something like this if you check

freepbx*CLI> sip show peers

Name/username       Host         Dyn Forcerport Comedia    ACL Port     Status      
airtel-sip/918016251 10.X.X.X          Yes             Yes                      5060    OK (11 ms)



Now its configured you should be able to make calls

Setting IP ubunut 18.04 server

sudo nano /etc/netplan/50-cloud-init.yaml

This return can be made to look like this:

network:
    ethernets:
        eth0:
            addresses: [10.1.100.55/24]
            gateway: 10.1.100.1
            nameservers:
              addresses: [8.8.8.8,8.8.4.4]
            dhcp4: false
    version: 2

Exit and save your changes by running the commands below

sudo netplan apply

Thursday, October 18, 2018

Ford Super Duty bed box rebuild

Rebuild of a Ford Super Duty box

This isn't a step-by-step how to.

This is just how I went about it with parts I had available for my situation and some ideas of how a box could be repaired.  I wanted to contribute to the internet.

In this situation the box floor and the cross members were rusted completely, but the box sides, front and back were still in very good shape.


There were a couple of paths of repair at the time of this.

1>
A complete replacement was going to be around $3000 (plus painting likely) but would be a very fast bolt on swap.

2>
Take the old box off and make a flatbed out of wood/metal.  Not a desirable look that I wanted, but a plan B (or a stop gap) to make the truck pass from a vehicle inspection perspective while a suitable replacement box was found.

3>
The third option is to fix the bad floor and cross members and keep the remaining box in service. 

This 3rd option fit the best for my situation at the time.

Planned on making my own cross members out of bar stock () and fabricate a bed out of a sheet of steel, but then found a smashed cannibalized box, but the bed floor and cross members were still intact and salvageable.


The super duty box is essentially in two main parts.  The bed sides, box front, and back frame with with the floor spot welded in place along its edges, and the cross members supporting the bed bottom and the sides to the frame.



Underneath there is a seam that goes the entire way down on each side from front to back.  This edge is a 90 degree bend in the metal of the box sides and the box bottom, during manufacturing, they are set in place then spot welded together.

This photo shows the seam that runs under the box, it is about 1" in height.

These spot welds are possible to drill out.  Common approach is using a spot weld remover drill bit.


I used this tool for the 8 spot welds holding rear bed cross member to the box sides behind the wheel wells.

This cross member is the only one of the 3 that goes all the way across.  In this picture the two members that are attached to the floor only have been cut with a saw.

The cross member that went all the way across from box side to box side I drilled out to retain the factory holes and use it to line up the replacement floor.


I also used this tool at the rear portion of the bed box to remove the spot welds holding the floor to this back frame.  Again to help me line up the floor.

This picture shows the drilled welds from the donor bed being laid onto the original box frame (tailgate end).  The spot welds lined up almost perfectly for me.  I guess they used the same computer program on the robot.


For the rest of the box spot welds on the bottom that hold the box floor to the sides, I decided to not use the spot weld drill. 
I just didn't want to spend that much time drilling it out.  Not only would I have to drill out the rusted box, I'd have to drill out the donor box, and that would be more time put into a project than I had available to me.

In my situation, the metal seam where the box and bed met and were spot welded was more or less in reasonable shape.  There were some sections that were rusted.  I decided to leave this metal attached to the box, and use a saw to completely cut the old floor out along the inside edge of this seam.


Here is a shot of the rusted bed cut out, but the metal seam still there.


Here's a shot below of the front cross member cut out of the box.  The middle part of it was rusted but the ends were solid so I saved them spot welded to the box.  I'll weld the cross member from the donor bed into this space.


My donor box I cut out the floor, but on the outside of the seam of the spot welded metal to have as much metal to work with as I could during the assembly process.

Here's what is left of my donor box after I cut its floor.  You can see the front cross member chopped out during the cutting process.  Its still attached with spot welds to the floor and will be put in as one piece.


Since my donor bed and my bed sides both had this seam, this wouldn't allow the bed bottom to fit into the bed sides since now there is an extra 1/4" of metal.  To make sure things lined up front to back and side to side, I notched out this metal on the donor floor and on the box to fit them together like a jigsaw puzzle.  Doing it this way would ensure that I could get the two sections lined up as close to the factory locations as possible...and leave enough metal "meat" to weld and secure the two parts together.

Once I lay it in there, I used a 5' long piece of 1/2" angle iron and rivets to hold both sides in alignment.  This allowed the whole box bottom to really sit in place together securely.  A 1/4" bit of gap between the cuts gave me some wiggle room to align things forward and backwards.
But everything aligned perfectly.

ALL Factory bolt and weld holes lined up without even needing to drill out a wider hole or anything.


In this picture below there sections of my original box that were rusted just behind the wheel wells under the rear cross member near the tailgate.  I cut out the bad sections and replaced them with good sections from the donor box.

Since the boxes were identical, I could use the factory body bends to align the parts together.  In this above photo you'll see I've pieced in the metal in the middle (silverish in color) and then used some scrap pieces of the box for additional structure and support, rivets holding them in place.  


I'm not a great welder, so rivets helped get things lined up solid, then I used a Mig welder after the fact. The 4 holes that attach the cross member to the bed were originally spot welds.  I ended up using some bolts to hold this together instead of a weld.

Once the box floor was in place, I welded the floor to the body.

You see the front cross member at the bottom of the picture where I've spliced the two together.
The reason i did this was, well, honestly i just didn't want to drill out the spot welds.  I cut the rusted one out and then kept that donor floor cross member still welded to the box floor and spliced it it then ran a weld.  It fit perfectly.  No flexing no weird bending, slid right in.

The cross members are all fully attached to the donor box bed.  The one on the end by the tailgate in the photo looks possibly cut, but its not, its solid and it lighted up perfectly to the spot wells on the box body perfectly.

The cross member at the front of the box is welded in along the seam where I cut it, but it is still attached to the bed with spot welds and slid right in.


I used a little bit of fiberglass and some body fill to fix up some rough spots.  The donor box wasn't perfect floor, but it was good enough.  The fiberglass and body fill I used looks kind of ugly in this photo, I sanded it down.  I just used to enclose some seams, wasn't necessary but I felt it looked better.



Once this was done I flipped the box over and put it on the truck.  It fit perfectly, the factory bolt holes from the bed to the frame lined up perfectly. NO sagging of the box, no bending, not flexing.  It went into place immediately.  You can buy a bolt kit, but i just used some bolts from the hardware store and they worked fine.  $10 vs $100 for that kit.  I am going to put a plastic box liner in the truck anyway so the bolt heads don't matter to me.


Passed motor vehicle inspection.

I then finished it with a spray on bed liner to protect it, even out the colors since the donor box was silver, and hide some imperfections.

Here's the finished product.  Aside from a few rough looking patch sections behind the wheel wells, its a strong solid bed on the back of a 14 year old truck.


I did the whole project over the course of probably 2 1/2 weeks a 1-2 hours each day, around 25 hours.  I've never done this before so I wasn't going at it with any kind of experience.  I just proceeded carefully, measuring twice and cut once approach.

I paid $250 for the donor bed and $250 on supplies like drill bits, saw bits and grinder cutoff wheels, bodyfiller and some fiberglass and things like that.  Another $100 for the bed liner kit.

Dorman sells a Ford Bedmounting kit (# 924-311) but I just used bolts from a hardware store that worked perfectly fine honestly.

Came out great.  Factory look and fit perfectly.