perakit / compose-web

This is perakit podman setup

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸš€ Perakit Podmanfile Multi-Stage Builds

πŸ”₯ Setup Multi-Stage Build

Pertama kita build dulu base-image untuk multi-stage container dengan menjalankan perintah berikut

podman build -t base-perakit -f base-image.podmanfile

Setelah base-image dibuat anda bisa masuk ke folder compose yang ingin anda jalankan sebagai contoh di-bawah saya akan menggunakan compose-alpine-one

cd compose-alpine-one

Minimal compose alpine one

⭐️ Fitur

  • Bash, It is useful for automating tasks, writing scripts to execute multiple commands, managing files and directories, and interacting with the system.
  • Curl, It is useful for transferring data with URLs, which makes it a versatile tool for web browsing, file transfer, and more.
  • Supervisor, It is useful for managing multiple programs and ensuring that they stay running even if one of them fails.
  • Nginx: Nginx is a web server that is known for its high performance and scalability. It is commonly used to serve static files, handle dynamic content, and provide reverse proxy functionality.
  • Nodejs: Node.js is a JavaScript runtime that allows you to run JavaScript code on the server. It is popular for building web applications and APIs using JavaScript.
  • Npm: Npm is the package manager for Node.js. It allows you to easily install, manage, and share JavaScript packages and modules.
  • MariaDB: MariaDB is a popular open-source relational database management system. It is known for its speed, reliability, and compatibility with MySQL.
  • Php83: Php83 is a server-side scripting language that is used to build web applications. It is known for its simplicity, security, and wide range of features.
  • Yarn: Yarn is a package manager for JavaScript that is designed to be faster and more reliable than npm. It allows you to easily install, manage, and share JavaScript packages and modules.
  • Composer: Composer is a dependency management tool for PHP that allows you to easily install and manage dependencies for your PHP projects. It simplifies the process of installing, updating, and managing third-party libraries and frameworks in your PHP code.

Note: Saya juga melengkapi beberapa extensi dasar php untuk menjalankan project laravel

πŸ”₯ Setup

Di dalam folder compose-alpine-one Buka file podman-compose.yml dan ubah konten yang ingin anda tentukan seperti password root, database-awal, user tambahan dan password user tambahan. Contoh:

environment:
  MYSQL_ROOT_PASSWORD: hello
  MYSQL_DATABASE: mydatabase
  MYSQL_USER: user
  MYSQL_PASSWORD: password

πŸ“¦ Cara Menjalankan


Setelah selesai mengubah file compose, Jalankan perintah compose dibawah dan selesai
podman compose --file podman-compose.yml up -d

setelah container jalan silahkan buka localhost di-browser anda 😁

πŸ«› Membuka Container Podman yang berjalan

Ambil nama container di podman dengan perintah

podman ps

Sebagai contoh nama container saya adalah "compose-alpine-one-server-1" jadi saya menjalankan perintah dibawah untuk masuk kedalam container

podman container exec -it compose-alpine-one-server-1 /bin/bash

Ganti "compose-alpine-one-server-1" sesuai dengan nama container yang muncul di podman ps anda

⭐ Struktur Folder

Silahkan masukkan project custom anda di folder dalam www jadi akan berada berdampingan dengan folder html

πŸ”₯ Advance SSL Setup

Untuk menggunakan ssl (port 443) anda membutuhkan sertifikat, anda bisa menjalankan perintah openssl self signed certificate untuk membuat sertifikat anda sendiri

openssl req -newkey rsa:4096 \
    -x509 \
    -sha256 \
    -days 3650 \
    -nodes \
    -out localhost.crt \
    -keyout localhost.key

isi sesuai kebutuhan anda

Setelah sertifikat ssl terbuat pindahkan file .crt dan .key ke dalam folder etc\nginx\ssl

Buka file konfigurasi default nginx di etc\nginx\sites-available\default Ikuti petunjuk yang ada di-dalam file tersebut

Lanjut Buka file podman-compose.yml dan hilangkan tanda pagar dibawah ports: # -433:433 jadi akan seperti dibawah dan pastikan spasi tab sesuai

ports:
  - '80:80'
  - '443:443'
  - '3306:3306'

setelah podman-compose.yml anda simpan, lakukan build ulang compose agar port bisa terbuka

podman compose --file podman-compose.yml up -d

About

This is perakit podman setup

License:GNU General Public License v3.0


Languages

Language:Shell 62.7%Language:Dockerfile 37.2%Language:PHP 0.2%