VPNs/Accessing the Dev DB
4 minute read
VPNs exist for our Development, Experimental, Production and Shared Services environments. The VPN provides a way for developers and operations to access the environments in a secure manner, via an encrypted tunnel over the internet.
Access to the different environments is restricted to a limited number of people. If you believe you need to access one of the environments you do not have access to please reach out to the DevOps team and tag @ihr-devops
who may be able to assist.
In the examples below we are using dev
for the environment, you can replace this with any other environment you have access to, dev
, exp
, prod
or ss
.
Ubuntu users
If you’re using Ubuntu, you can install a plugin for Ubuntu’s native Network Manager to use your UI to connect/disconnect to/from VPNs.
-
Install the OpenVPN package and network-manager plugins
apt-get install openvpn network-manager-openvpn network-manager-openvpn-gnome
-
In Slack, grab the VPN config file by opening a DM with intellibot and saying
vpn dev config
-
Save the configuration outputted by the
vpn dev config
command- Save it as
~/Downloads/intellihr-dev.ovpn
- Save it as
-
Set your password by sending another message saying
vpn dev password <my super strong password>
-
To test the VPN connection you can now run
sudo openvpn --config ~/Downloads/intellihr-dev.ovpn
. You will be prompted for a username/password- Username is your Slack username
- Password is what you set via the bot command
We can now configure Network Manager and GNOME to allow easier enabling of the VPN
-
Restart network manager
sudo service network-manager restart
orsudo service NetworkManager restart
in newer Ubuntu version -
Go to your Network Settings and add a new VPN
-
Choose
Import From File...
option and select the~/Downloads/intellihr-dev.ovpn
file -
You’ll now be able to connect to VPN by turning it on from your Network Setting interface
macOS users
-
Download and install TunnelBlick
-
In Slack, grab the VPN config by opening a private message with intellibot and saying
vpn dev config
-
Set your password by sending another message saying
vpn dev password <my super strong password>
-
Save the config outputted by the
vpn dev config
command- Save it as
~/Downloads/intellihr-dev.ovpn
- Double click the saved file to finish the setup in
TunnelBlick
- Save it as
Windows users
-
In Slack, grab the VPN config by opening a private message with intellibot and saying
vpn dev config
-
Save the config outputted by the
vpn dev config
command into a fileintellihr-dev.ovpn
-
Set your password by sending another message saying
vpn dev password <my super strong password>
-
Download and install OpenVPN Connect Client for Windows
-
Create a new profile by clicking on the plus icon
-
Click on the ‘Upload Profile’ tab and then drag and drop the
intellihr-dev.ovpn
file created earlier -
The next dialog is a form where you can add more details
- Change the Profile Name to anything you want for example
IntelliHR - DEV
- Type in your username as outputted by Intellibot when setting your password
- Click on the
Save Password
checkbox and type in the password you set earlier
- Change the Profile Name to anything you want for example
-
Click on Connect and the next dialog is the
Missing External Certificate
dialog -
Click on Continue and then you’ll be connected to the VPN
Accessing the Dev DB
- Configure and connect to the VPN by following the above steps
- In the DB Client of your choice, create a new DB connection
- Using the credentials from 1Password (“Lapis Dev RDS”), connect to the Dev DB
- You should now have access to all tenants as different schemas, note that to check data across all tenants, a query can be run against all schemas by appending the table name with
all_
for example, to query all Business Entities, you would run the following SQL:
SELECT * FROM all_business_entities
Accessing the Prod DB
-
Configure and connect to the VPN by following the above steps
-
In Slack,
/msg intellibot prod-db
-
Use the VPN to connect to the details provided by intellibot
Notes
- Special access needs to be granted before the above intellibot command will work for you. This access is only granted on an as needed basis with approval from the CTO
- Destructive SQL statements are blocked, including
DROP
,TRUNCATE
andDELETE
, unless you have been granted to use them - All SQL queries are logged to #alert-ihr-sql-logs in Slack
- It is best to use the
psql
client as other DB clients tend to cache and prefetch a lot of data which makes it extremely slow to connect through the proxy