Deploy Aplikasi PHP Sederhana ke Heroku

Source Image: www.heroku.com


Buat akun Heroku

Sebelum mendeploy aplikasi ke heroku kita harus membuat akun terlebih dahulu. ini adalah link untuk mendaftar ke heroku https://signup.heroku.com/login




Buat Project Baru




Masuk ke menu Deploy





Ini adalah langkah- langkah yang akan dilakukan untuk mendeploy aplikasi kita ke heroku, namun sebelumnya kita harus menginstall heroku CLI terlebih dahulu. Bisa klik link ini Heroku CLI


Pilihan sistem operasi untuk menginstall Heroku CLI


Kemudian saya akan membuat sebuah file PHP yang bernama index.php




Kemudian saya masuk ke heroku dengan cara dibawah ini:
heroku login




Kemudian saya initialize project saya
git init






Setelah itu lakukan remote ke project kita, sesuaikan dengan nama project  kita masing-masing
heroku git:remote -a hakim



Setelah itu lakukan perintah  git add [nama file] pada kasus ini saya hanya ingin menambahkan file index.php, sesuaikan dengan nama file yang akan di deploy.


Setelah itu lakukan commit
git commit -am "Deploy PHP file to Heroku"


Setelah itu baru push ke heroku master, dengan cara:
git push heroku master



Kemudian kita cek apakah aplikasi sudah berhasil di deploy ke heroku dengan memasukkan alamat url project kita, pada project saya kali ini ialah dengan url sebagai berikut:  https://url.herokuapp.com/

File PHP telah berhasil di deploy ke Heroku


Sekian dan terimakasih.. -_-






Share:

Introduction to Docker




What is Docker ? 

    Docker is a platform for developers and sysadmins to develop, deploy, and run applications with containers. The use of Linux containers to deploy applications is called containerization. Containers are not new, but their use for easily deploying applications is.

    Images and containers
    A container is launched by running an image. An image is an executable package that includes everything needed to run an application--the code, a runtime, libraries, environment variables, and configuration files.
    container is a runtime instance of an image--what the image becomes in memory when executed (that is, an image with state, or a user process). You can see a list of your running containers with the command, docker ps, just as you would in Linux.

    Containers and virtual machines

    container runs natively on Linux and shares the kernel of the host machine with other containers. It runs a discrete process, taking no more memory than any other executable, making it lightweight.
    By contrast, a virtual machine (VM) runs a full-blown “guest” operating system with virtual access to host resources through a hypervisor. In general, VMs provide an environment with more resources than most applications need.

    Container
    Virtualization











    Benefit of Docker

    1. Reproducibility: Similar to a Java application, which will run exactly the same on any device capable of running a Java Virtual Machine, a Docker container is guaranteed to be identical on any system that can run Docker. The exact specifications of a container are stored in a Dockerfile. By distributing this file among team members, an organization can guarantee that all images built from the same Dockerfile will function identically. In addition, having an environment that is constant and well-documented makes it easier to keep track of your application and identify problems.
    2. Isolation: Dependencies or settings within a container will not affect any installations or configurations on your computer, or on any other containers that may be running. By using separate containers for each component of an application (for example a web server, front end, and database for hosting a web site), you can avoid conflicting dependencies. You can also have multiple projects on a single server without worrying about creating conflicts on your system.
    3. Security: With important caveats (discussed below), separating the different components of a large application into different containers can have security benefits: if one container is compromised the others remain unaffected.
    4. Docker Hub: For common or simple use cases, such as a LAMP stack, the ability to save images and push them to Docker Hub means that there are already many well-maintained images available. Being able to quickly pull a premade image or build from an officially-maintained Dockerfile can make this kind of setup process extremely fast and simple.
    5. Environment Management: Docker makes it easy to maintain different versions of, for example, a website using nginx. You can have a separate container for testing, development, and production on the same Linode and easily deploy to each one.
    6. Continuous Integration: Docker works well as part of continuous integration pipelines with tools like Travis, Jenkins, and Wercker. Every time your source code is updated, these tools can save the new version as a Docker image, tag it with a version number and push to Docker Hub, then deploy it to production.
    Permalink


    Source: 


    Share:

    Project Omega On AWS (VPC, S3, EC2) Part-1




    Kali ini saya akan mencoba untuk menyelesaikan sebuah project dari Linux Academy yaitu Project Omega , Dari gambar diatas dapat kita lihat bahwa ada beberapa hal yang akan kita lakukan mulai dari setup server hingga web dapat diakses melalui publik


    EC2 


          Pada step 1 diatas, kita akan memilih Amazon Machine Image free tier untuk kebutuhan lab ini.
     
     

        pada step 2, pilih tipe instance yang akan dipakai, pada lab ini menggunakan t2.micro. Kemudian        klik Review and Launch.


        Isikan jumlah instance yang akan dibuat, network, subnet dll, jika sudah selesai kemudian klik            Review and Launch


        Pilih storage, kemudian Review and Launch   


        Pada tags bisa dikosongkan.

        Set security group, security group ini berfungsi sebagai firewall kedalam instance, pada kasus kali ini, kita akan mengijinkan akses publik kedalam instance, dengan spesifikasi port 22 (ssh) dan port 80 (http). Untuk keamanan akses publik ke SSH sangat tidak disarankan.


        Review instance yang akan dibuat, jika sudah yakin klik launch


         
        Buat dan download key pair yang akan digunakan untuk akses ke instance melalui SSH.

        Instance sedang diprovisioning.


    Detail Instance


        Akses instance melalui SSH sudah berhasil dilakukan.


        Selanjutnya, coba install web server untuk akses dari publik.






        Web server sudah bisa diakses dari publik.

    Share:

    Mengatasi Account Locked di Debian



    Awal nya ini terjadi pada linux saya setelah beberapa kali mengalami crash pada hardisk yang terkadang sering tidak terbaca. Meskipun kadang sempat kesal kenapa hal itu bisa terjadi, kemudian saya coba browsing-browsing di google dan berdiskusi di komunitas distronya ternyata belum mendapatkan solusi juga, bahkan saya sempat bertanya pada developernya yang berasal dari Italy, dia menyarankan agar saya mengupgrade OS saya ke versi terbaru, dan ternyata sama saja.

    Saya coba memahami apa yang sebenarnya terjadi setelah beberapa kali intall ulang.
    Saya coba bertanya kepada diri saya "kenapa tidak mengganti nama user yang baru ?" karena sebelumnya saya menggunakan nama user yang sama ketika menginstall ulang pada partisi yang sama. Kemudian setelah selesai proses intalasi linux akhirnya bisa berjalan secara normal kembali.


    Kemudian selang beberapa hari muncul lagi masalah yang sama yaitu account saya terkunci, kemudian saya terpikir untuk masuk kedalam console dan coba bertanya kepada diri saya "kenapa tidak masuk saja kedalam console dan mount partisi home nya". Setelah saya coba untuk masuk kedalam console dengan cara masuk ke menu grub kemudian menambahkan beberapa perintah didalamnya, sehingga saya berada dalam console, karena sebelumnya saya tidak bisa masuk kedalam console, dan hanya ada satu cara untuk masuk ke menu consolenya yaitu dengan mengedit file grubnya.









    kemudian saya menjalankan perintah mount untuk membuka partisi home saya,



    kenapa itu saya lakukan ? karena saya berpikir bahwa ada yang aneh dengan home saya, dan beberapa kali clue yang saya temukan adalah home saya, maka dari itu saya terpikir untuk menjalankan perintah mount partisi home saya untuk membuka home saya agar tidak terkunci lagi.


    Begitulah beberapa masalah yang sering saya alami dengan mainan linux saya, mulai dari masalah yang datang tak diundang dan pulang tak diantar, masalah sepele hingga masalah yang mengharuskan saya untuk menginstall ulang semuanya.hehe


    saya percaya selama kita masih mau berusaha mencari solusi maka semua masalah akan terselesaikan -_-.
    Share:

    Install Django 2.0 and Setup Local Environment Development on Linux Debian





    1. Install python, i install python 3. Before install python, update the repository

    $ sudo apt-get update
    $ sudo apt-get install python3

    2. Install Virtualenv

    $ sudo apt-get install python-virtualenv

    3. Create a new directory

    $ virtualenv -p python3 project_name

    4. Change the directory project_name

    $ cd project_name

    5. To use this environment, you need to activate it

    $ source bin/activate

    6. Install Django using pip3

    $ pip3 install Django

    7. Start django project

    $ django-admin startproject myproject

    8. Change directory using cd

    $ cd myproject

    9. Run Django Project

    $ ./manage.py runserver

    Access the web browser at http://127.0.0.1:8000


    Share:

    Cara Reset Password Root di MariaDB Linux



    1. Matikan service mysql

    $ sudo /etc/init.d/mysql stop

    2.Jalankan safe mode di maria db untuk masuk ke dalam database tanpa menggunakan password

    $ sudo mysqld_safe --skip-grant-tables &
    [1] 24361 
    $180426 10:20:56 mysqld_safe Logging to syslog.
    180426 10:20:57 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 

    3.Jalankan MariaDB

    $ mysql -u root
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 1
    Server version: 5.5.33a-MariaDB MariaDB Server
    
    Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    MariaDB >

    4.Reset Password MariaDB

    MariaDB [(none)]> use mysql;
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
    Database changed
    
    MariaDB [mysql]> update user set password=PASSWORD("new_password;") where User='root';
    Query OK, 1 row affected (0.01 sec)
    Rows matched: 1  Changed: 1  Warnings: 0
    
    MariaDB [mysql]> flush privileges;
    Query OK, 0 rows affected (0.00 sec)
    
    MariaDB [mysql]> quit
    Bye
    
    

    5. Restart MariaDB

    $ sudo /etc/init.d/mysql restart

    Selesai. Sekarang coba masuk kedalam MariaDB menggunakan password yang baru kita ubah tadi.


    # mysql -u root -p
    Enter password: 
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 4
    Server version: 10.1.29-MariaDB-6 Debian buildd-unstable
    
    Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    MariaDB [(none)]>
    

    Jika masih gagal untuk masuk dengan menampilkan pesan error seperti dibawah ini :

    ERROR 1698 (28000): Access denied for user 'root'@'localhost'

    Lakukan proses yang sama hingga langkah 3 diatas kemudian lakukan perintah dibawah ini :


    MariaDB [(none)]> use mysql;
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
    Database changed
    
    Database changed
    MariaDB [mysql]> UPDATE user SET plugin="";
    Query OK, 1 row affected (0.00 sec)
    Rows matched: 1  Changed: 1  Warnings: 0
    
    MariaDB [mysql]> flush privileges;
    Query OK, 0 rows affected (0.00 sec)
    
    MariaDB [mysql]> quit
    Bye

    Kemudian coba lagi untuk masuk kedalam MariaDB.
    Semoga Berhasil...


    Share:

    Cara Intall Apache Spark di Linux




     1. Install Java

         Memeriksa apakah java SDK (Standar Development Kit) dan JRE(Java Runtime Environment) sudah terinstall di OS kita
    $ java -version


     Pada gambar diatas telihat versi java SDK yang digunakan ialah versi 1.8.0_131
    serta versi JRE 1.8.0_131 serta telah terinstall.


    Jika belum diinstall,kita bisa mendownload SDK dan JRE terlebih dahulu di
    http://www.oracle.com/technetwork/java/javase/downloads/index.html
    Setelah itu ekstrak filenya kemudian masukkan kedalam PATH Environment

    2.  Install Scala


     - Download scala di http://www.scala-lang.org/download/
     - Ekstraks file scala
    $ tar xvf scala-2.12.3.tgz
    $ sudo -i
    # cd /home/nisty/Downloads/
    # mv scala-2.12.3 /usr/local/scala/
    # exit
    $ export PATH=$PATH:/usr/local/scala/bin
    $ scala -version 
















    3. Install Apache Spark

    - Download Apache Spark di https://spark.apache.org/downloads.html
    $ tar xvf spark-2.2.0-bin-hadoop2.7.tgz
    $ sudo -i
    # cd /home/nisty/Downloads/
    # mv spark-2.2.0-bin-hadoop2.7 /usr/local/spark/
    $ export PATH=$PATH:/usr/local/spark/bin
    $ spark-shell


    Untuk menjalankan di user interface web akses browser dengan alamat http://192.168.1.23:4040 terlihat pada gambar diatas itu adalah alamatnya .
    Bisa jadi alamatnya berbeda, sesuaikan dengan alamat yg diberikan.



    Share: