Skip to content

AWS cloud9 development environment setup guide

Kunal Ramchurn edited this page Mar 16, 2020 · 14 revisions

This guide is for setting up the crown-marketplace project in an AWS cloud9 environment.

Update Ruby Version

For crown-commercial marketplace you need ruby version 2.5.3.

Run the following commands:

rvm install 2.5.3

rvm --default use 2.5.3

Installing PostgreSQL and PostGIS

For PostgreSQL use steps 1-3 of the following guide:

https://computingforgeeks.com/install-postgresql-11-on-ubuntu-18-04-ubuntu-16-04/

To install PostGIS, do the following commands:

sudo apt update

Make sure to use your version of PostgreSQL in the command (version 11 in this case).

sudo apt install postgis postgresql-11-postgis-2.5

You now need to create an ubuntu role with superuser privileges.

First enter into the PostgreSQL environment using the following commands:

sudo -i -u postgres

psql

You can then do the following SQL commands to create the new role:

CREATE USER ubuntu;

ALTER USER ubuntu WITH SUPERUSER;

Finally exit back to the main command line (exit) and run the following command:

sudo apt-get install libpq-dev

PhantomJS

To install PhantomJS follow all the steps in this gist:

https://gist.github.com/julionc/7476620

Yarn

To install Yarn, follow the first two steps in this guide:

https://linuxize.com/post/how-to-install-yarn-on-ubuntu-18-04/

Downloading and Initialising the Project

You can now git clone the project into your environment using:

git clone https://github.com/Crown-Commercial-Service/crown-marketplace.git

You should have a Cognito account so you can login but to do so you need to make sure you add the “.env.local” file to your project directory.

To initialise the project do the following commands:

yarn

bundle

Make sure they both execute correctly before continuing.

Running the Project

Before running the project do the following commands to create the database:

rake db:setup

rake db:static

You can now run the project using:

rails s

To view the application, click ‘Preview’ (next to run in the menu bar) and select ‘Preview Running Application’ from the drop-down menu.

To enter the facilities-management/beta you must copy the full URL into your browser and add /facilities-management/beta to the end.

This should be all you need to do to get started and begin development.

After logging into the repository, it is worthwhile to run the following commands:

git config --global user.name "YOUR_USERNAME"

git config --global user.email YOUR_EMAIL

git config --global credential.helper store