Skip to content

Sabri0o/test-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

test-app

a simple app for experimental reasons

Overview

Building a simple web application at its root URL it displays a form that accepts three fields as input: "Nickname", "Favorite color" and "Cats or Dogs". This form saves the result in a relational database and ensure that "Nickname" is unique.

Technologies

  • React.js: to build user interface
  • Node.js: to build server side
  • PostgreSQL: to store data
  • Docker: to package the application into containers
  • Ansible: to deploy the application

Running application

  • To run the application locally:
    From the project directory, start up the application by running:
    docker-compose up --build
    Note: the built images of this web app (server and client) exist in the Docker Hub

Deploying application with Ansible

Set up your machine as an Ansible server

sudo apt-get update
sudo apt-get install ansible

  • Make sure that the Ansible server (your machine in that case) should reach the other remote servers via ssh.
  • Rename the hosts file and create another one as below
    sudo mv /etc/ansible/hosts /etc/ansible/hosts.orig
    sudo vim /etc/ansible/hosts
  • Add your remote servers so that your file appear as below
    [webserver]
    the remote server IP adress here
  • copy the docker-playbook.yml to the /etc/ansible/ directory
  • From the /etc/ansible/ directory, start up the deployment by running:
    ansible-playbook docker-playbook.yml
  • You can confirm running containers by running:
    ansible all -m shell -a 'sudo docker ps'

Now navigate to your browser, enter http://your-remote-host-ip:8080. You should get the web application page from the remote server.

Ps: Make sure that the port 8080 on the remote nodes is opened.

Ps: If you don't possess an instance on the cloud you can also try testing deploying the web application locally by changing all to localhost and removing the preparation tasks in the docker-playbook.yml file.

About

a simple app for experimental reasons

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published