Development Setup on Ubuntu (WIP)
Install JDK
Install the JDK from Orcale - something like
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
(but google for the latest)
download the relevant tar.gz file
Place it into your software folder (or wherever you normally put software)
Edit your bashrc folder in home dir
add the following lines at the bottom
export JAVA_HOME=/<<wherever you put the jdk folder>>/jdk1.8.0_171
export CLASSPATH=.
export PATH=$JAVA_HOME/bin:$PATH
Install Maven
sudo apt-get install maven
mvn -version
Install GIT
sudo apt-get install git
Install Node.js
Need latest nodejs: https://tecadmin.net/install-latest-nodejs-npm-on-ubuntu/#
sudo apt-get install nodejs
sudo apt-get install npm <It will show "packages have unmet dependencies" because it is already installed with nodejs>
sudo npm install -g grunt
sudo npm install -g grunt-cli
sudo npm install -g bower
sudo npm install -g karma-cli
sudo npm install -g gulp
Install MySQL
sudo apt-get install mysql-server
sudo apt-get install emma (mySQL gui - or use mysql-workbench)
Launch MySQL Workbench from the terminal:
mysql-workbench
Install Docker
sudo apt-get install docker
sudo apt install docker.io
To create the docker group and add your user:
Create the docker group.
$ sudo groupadd docker
Add your user to the docker group.
$ sudo usermod -aG docker $USER
[Note: Here $USER is your computer user e.g. jayanta.saha ]
Log out and log back in so that your group membership is re-evaluated.
On a desktop Linux environment such as X Windows, log out of your session completely and then log back in.
On Linux, you can also run the following command to activate the changes to groups:
$ newgrp docker
Verify that you can run docker commands without sudo.
$ docker run hello-world
Please refer to this page for the above: https://docs.docker.com/engine/install/linux-postinstall/
Install NGINX
sudo apt-get install nginx
Install intelliJ - Community Edition
Download the intelliJ software from the following link:
https://www.jetbrains.com/idea/download/#section=linux
import the TIS schema xml into your intelliJ:
Please check the following image for importing from IntelliJ
Update and Upgrade after installation
sudo apt-get update
sudo apt-get upgrade
Configuring Docker at your local machine
Create a folder and call it 'docker' in your local directory (i.e. /Docker)
Create a file of type 'File' and call it 'Dockerfile'. Paste the command below in the newly created file and save it in the /Docker
FROM elasticsearch:2.4
In terminal, change your working directory '/Docker' and type in the following command (please include the dot at the end of command)
docker build -t elasticsearch:2.4 .
NOTE: If you have a message like "permission denied while trying to connect", then use the following command in Ubuntu machine:
sudo docker ps
This will ask for your admin password. Enter that.
Then apply the following command again
sudo docker build -t elasticsearch:2.4 .
To get the image ID, type in the following command
docker images
NOTE: If it does not work use sudo docker images
(In order to avoid writing sudo again and again, try this command sudo bash)
Make a note of the image ID, insert it into the command below before typing it into the command prompt
docker run -p 9200:9200 -p 9300:9300 -d <insert image ID here>
Verify that the container is running by typing in following command
docker ps
Edit the hosts file
sudo gedit /etc/hosts
Change the line to:
127.0.0.1 localhost local.<YOUR_INITIALS>.com local.dev.com local.tis.com
Set up nginx proxy
cd /etc/nginx
sudo gedit nginx.conf
Note: Please refer to the following link:
In the nginx.conf file search for word server_name and change the name to local.<your initial>.com;
sudo systemctl start nginx
sudo systemctl stop nginx (You don't need this now. Please check the following note)
Note: If you make any changes in your nginx.conf file you have to restart (i.e. stop and start) nginx.
Set up environment variables
sudo gedit /etc/environment
PATH="$JAVA_HOME/bin:$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/"
TIS_ENV="staging"
REVALIDATION_CONTEXT_ROOT="revalidation"
PROFILE_CONTEXT_ROOT="profile"
CONCERNS_CONTEXT_ROOT="concerns"
REFERENCE_CONTEXT_ROOT="reference"
CONNECTION_DISCREPANCIES_CONTEXT_ROOT="connection-discrepancies"
LOCALHOST_URL="http://local.sm.com" <Note: use your initial instead of sm>
ES_HOST="192.168.99.100"
INSPECTLET_ENABLED="false"
INSPECTLET_ACCOUNT="851503328"
CONCERNS_SERVICE_ENDPOINT="http://localhost:8084/concerns/concern-id"
LOG_DIR="/home/simon/UbuntuDev/logs" <Note: use your directory name instead of simon>
Log off and on again for the settings to take effect
Create databases
mysql -u root -p
enter password (if you set one up when you installed mySQL. If not, you don't need the -p)
create database heetiscleardbconcerns;
create database profile;
create database reference;
create database heetiscleardbrevalidation;
create database heetiscleardbtraineeid;
create database heetiscleardbnotification;
create database tcs;
create database connectiondiscrepancy;
Generate new ssh key pair:
https://confluence.atlassian.com/bitbucketserver/creating-ssh-keys-776639788.html
ssh-keygen -t rsa -C "email@example.com"
sudo gedit /home/simon/.ssh/id_rsa.pub to get the public key for use in GitHub
Create a settings.xml file in your .m2 folder
https://hee-tis.atlassian.net/wiki/spaces/TISDEV/pages/14483580/Maven
Need to create a link:
ln -s /usr/bin/nodejs /usr/bin/node
... otherwise you will get errors running bower install later. https://github.com/nodejs/node-v0.x-archive/issues/3911
Build the repos
Build the repos as per Development setup on windows#Checkoutandbuildthegitrepository
To disable middle mouse button paste:
https://wiki.ubuntu.com/X/Config/Input
$xinput list | grep 'id='
$xinput get-button-map <ID for Mouse>
$ xinput set-button-map <ID for Mouse> 1 0 3
To install Postman:
wget https://dl.pstmn.io/download/latest/linux64 -O postman.tar.gz
sudo tar -xzf postman.tar.gz -C /opt
rm postman.tar.gz
sudo ln -s /opt/Postman/Postman /usr/bin/postman
To add to unity launcher:
cat > ~/.local/share/applications/postman.desktop <<EOL
[Desktop Entry]
Encoding=UTF-8
Name=Postman
Exec=postman
Icon=/opt/Postman/resources/app/assets/icon.png
Terminal=false
Type=Application
Categories=Development;
EOL
Arrange to have their laptop's MAC address added to the whitelist. This is to bypass content filtering in London. If in doubt, ask @John Simmons (Deactivated)
Slack: https://hee-nhs-tis.slack.com/
Jira issues: https://hee-tis.atlassian.net/issues/?filter=14213