Tuesday, May 26, 2020

Windows Server : Configure and Set up Web Server on IIS

Creating a new website on IIS

If you have multiple servers, please configure same way on all server within the environment.

1. Login to your server and go to E: drive. Create a directory as the name of the application.
E:\iCare

2. Open Service Manager and Open IIS or start type IIS and press enter to open,
- Expand Site Tree
- R. Click on site tree and Click on Add website

3. On Add WebSite page, fillout the information as follow
  - Site Name: <Application Name>    # icare
  - Physical Path: E:\iCare
  - Binding: Leave default
  - Hostname: <Application Name> # all lower case  # icare
  - Verify start website immediately is checked and click ok

4. Go to site you just created.
  - Right Click on the site and click on Edit Bindings
  - Click on Add and specify type: Environment IP and available port.
    Note: port 80 by default and also add port for application for eg, 8001

Binding Info
<siteName> port 80
<IP Address> - Port - new application specific port
Make sure, the port is not used by any other application. You will have problem to reuse the port that is already in use.

5. Now, Go to Applicaion Pools
  - Browse to the Application Name you just created.
  - R click and click on Advance Settings
  - Under general tab, set "Enable 32-bit application" to false
  - Under Generate [rocess model event log entry:
  - Specify the account name and pw that is used to start this application. they also called service accounts.

Deploying the applicaiton
1. R click on the site and click on Deploy
2. Click on Import application
3. Specify the location of the applicaiton.

Issue/torubleshooting
- There might be misconfig on the web.config file which is located on E:\application directory

DNS entry update
1. Login to DNS server
2. Go to DNS and forward lookp -> domain and application
3. Use IP for the new site.
    - Click on "Create a pointer record" in the DNS box. Use the server IP. R. click on Domain and click on add New Host.

Sunday, May 10, 2020

Docker Intro

Go to hub.docker.com
search for ubuntu, centos, mysql

How to create custom image

Custom file --> is your --> own image

Dickerfile -> Docker scripting language

Traditionally  just to use a web server, we used to use physical machine, physical network, but these days we have a host a machine, we have a VM, and inside VM, we can run docker.



1. Install Redhat 8 on your system.

# docker ps
# docker ps -a

# yum install python36
# python3


# cat Dockerfile
FROM centos

RUN yum install python36 -y

# docker images
# docker images | grep exp

# docker build -t expanor:v1 /ws/

Now, your image is ready. Based on this image, you can launch 100s of other os instances

# docker run -it ==nme os2 nexpanor:v1
# docker ps
# python3

# vi Dockerfile
FROM centos
RUN yum install python36 -y


# docker rm -f $(docker ps -a -9)   # terminates all docker instalnces

# docker run -it --name os1 centos

Create a file on your VM
# yum install https -y
# vi index.html
Life is beautiful !!!
# docker run -it --name OS1 centos  # Create an OS docker instance OS1
# docker cp index.html os1:/var/www/html

On your docker instance, try to start the webserver
You will get error

Now, go ahead and start wen server on your VM.
# systemctl start httpd
# systemctl status htpd

look at the httpd service file at /usr/lib/systemd/system/httpd.service

Now, cat that file and look under

execStart
ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND

now remove $OPTIONS and manually run the command below on docker

# /usr/sbin/httpd -DFOREGROUND

To find the IP address of docker, you can use inspect option
# docker inspect OS1

# docker rm -r os1

Review
#  mkdir /workfile; cd /workfile
# cat >>index.html
Welcome to my page !!!

# cat Dockerfile
FROM centos

RUN yum install httpd -y


# docker images
# docker build -t expanor:v1 /ws/

Now, your image is ready. Based on this image, you can create hundreds of other docker instances.

# docker imags  | grep exp  - to see your image you just created.

# docker ps
# docker run -it --name os2 expanor:v1
# docker ps

# cat Dockerfile
FROM centos

RUN yum install httpd -y

RUN yum install python36 -y
CMD python3

# docker build -it expanor:v2 /ws/

when you run above command, you will be at python prompt. just type exot() to close the doccer sesssion.

# docker ps
# docker rm -f $(docker ps = a =9)  # terminate att docker session

# docker run -it --name OS1 centos