-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: auto-deploy preview untuk pull request #97
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
github-actions
bot
added
enhancement
New feature or request
integration
When multiple functionalities should works together
deployment
Deployment related things
labels
Feb 28, 2024
feryardiant
force-pushed
the
feat/deployment-config
branch
2 times, most recently
from
February 29, 2024 00:51
5d6a9a5
to
a43b96f
Compare
feryardiant
had a problem deploying
to
preview-97
February 29, 2024 00:58
— with
GitHub Actions
Failure
feryardiant
had a problem deploying
to
preview-97
February 29, 2024 01:07
— with
GitHub Actions
Failure
feryardiant
had a problem deploying
to
preview-97
February 29, 2024 01:25
— with
GitHub Actions
Failure
feryardiant
force-pushed
the
feat/deployment-config
branch
from
February 29, 2024 02:01
971cb0e
to
7639147
Compare
feryardiant
had a problem deploying
to
preview-97
February 29, 2024 02:02
— with
GitHub Actions
Failure
feryardiant
had a problem deploying
to
preview-97
February 29, 2024 02:07
— with
GitHub Actions
Failure
feryardiant
force-pushed
the
feat/deployment-config
branch
from
February 29, 2024 02:20
1940818
to
d0c10ce
Compare
feryardiant
had a problem deploying
to
staging
February 29, 2024 03:38
— with
GitHub Actions
Failure
feryardiant
force-pushed
the
feat/deployment-config
branch
from
February 29, 2024 04:02
d1c84a2
to
0543ca1
Compare
feryardiant
had a problem deploying
to
staging
February 29, 2024 04:36
— with
GitHub Actions
Failure
feryardiant
force-pushed
the
feat/deployment-config
branch
from
February 29, 2024 04:40
58d67f5
to
9c856e3
Compare
feryardiant
had a problem deploying
to
preview-97
February 29, 2024 04:42
— with
GitHub Actions
Failure
feryardiant
had a problem deploying
to
preview-97
February 29, 2024 05:16
— with
GitHub Actions
Failure
feryardiant
force-pushed
the
feat/deployment-config
branch
2 times, most recently
from
February 29, 2024 05:29
1c70057
to
01f16c2
Compare
feryardiant
had a problem deploying
to
preview-97
February 29, 2024 05:31
— with
GitHub Actions
Failure
feryardiant
force-pushed
the
feat/deployment-config
branch
from
February 29, 2024 05:34
01f16c2
to
503838d
Compare
feryardiant
temporarily deployed
to
preview-97
February 29, 2024 05:36
— with
GitHub Actions
Inactive
feryardiant
force-pushed
the
feat/deployment-config
branch
from
February 29, 2024 05:45
503838d
to
c0a31cd
Compare
feryardiant
had a problem deploying
to
preview-97
February 29, 2024 16:34
— with
GitHub Actions
Failure
feryardiant
had a problem deploying
to
preview-97
February 29, 2024 16:38
— with
GitHub Actions
Failure
feryardiant
force-pushed
the
feat/deployment-config
branch
from
February 29, 2024 16:48
064f6bd
to
b5bec50
Compare
feryardiant
had a problem deploying
to
preview-97
February 29, 2024 16:49
— with
GitHub Actions
Failure
feryardiant
had a problem deploying
to
preview-97
February 29, 2024 16:53
— with
GitHub Actions
Failure
feryardiant
force-pushed
the
feat/deployment-config
branch
from
February 29, 2024 17:03
b5bec50
to
33ce833
Compare
feryardiant
had a problem deploying
to
preview-97
February 29, 2024 17:04
— with
GitHub Actions
Failure
feryardiant
had a problem deploying
to
preview-97
February 29, 2024 17:09
— with
GitHub Actions
Failure
feryardiant
force-pushed
the
feat/deployment-config
branch
2 times, most recently
from
February 29, 2024 17:27
b198bb3
to
e9f4fd7
Compare
feryardiant
had a problem deploying
to
preview-97
February 29, 2024 17:29
— with
GitHub Actions
Failure
feryardiant
had a problem deploying
to
preview-97
February 29, 2024 17:31
— with
GitHub Actions
Failure
feryardiant
force-pushed
the
feat/deployment-config
branch
from
February 29, 2024 17:43
bccb3a3
to
3ac098c
Compare
feryardiant
had a problem deploying
to
preview-97
February 29, 2024 17:44
— with
GitHub Actions
Failure
feryardiant
had a problem deploying
to
preview-97
February 29, 2024 18:02
— with
GitHub Actions
Failure
feryardiant
temporarily deployed
to
preview-97
February 29, 2024 18:09
— with
GitHub Actions
Inactive
feryardiant
had a problem deploying
to
preview-97
February 29, 2024 18:34
— with
GitHub Actions
Failure
feryardiant
temporarily deployed
to
preview-97
February 29, 2024 18:44
— with
GitHub Actions
Inactive
Signed-off-by: Fery Wardiyanto <[email protected]>
feryardiant
force-pushed
the
feat/deployment-config
branch
from
February 29, 2024 18:56
049d8ea
to
971d45b
Compare
- Move `labeler` to `main` workflow - Make `deploy` should only be triggered when `main` workflow completed Signed-off-by: Fery Wardiyanto <[email protected]>
let's try Signed-off-by: Fery Wardiyanto <[email protected]>
Signed-off-by: Fery Wardiyanto <[email protected]>
Signed-off-by: Fery Wardiyanto <[email protected]>
creasi
approved these changes
Feb 29, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR updated, silakan disimak.
feryardiant
changed the title
feat: experiments with deployment preview
feat: auto-deploy preview untuk pull request
Feb 29, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
deployment
Deployment related things
enhancement
New feature or request
integration
When multiple functionalities should works together
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Seperti kita ketahui, selama ini kita cukup kesulitan untuk dapat me-review setiap pekerjaan yang mana mengharuskan reviewer untuk merge dulu setiap PR sebelum melakukan review. Masalahnya adalah jika ternyata masih ada bug atau PR terebut belum sepenuhnya selesai maka dev harus membuat PR baru lagi untuk memperbaiki issue dari PR sebelumnya yang usdah di merge.
Tentu hal tersebut tidak ideal dimana harusnya setiap PR harus selesai dan sudah memenuhi kriteria terlebih dahulu, dan reviewer harus lah dapat melakukan review sebelum sebelum PR tersebut dapat di merge.
Hal tersebut yang menjadikan kita butuh sebuah mekanisme yang memungkinkan untuk melakukan deployment tersendiri di tiap PR agar dapat melakukan review dan tentunya tidak mengganggu deployment pada branch utama.
Mekanisme seperti ini umum kita jumpai pada layanan populer macam Heroku, Vercel, Netlify, dll namun dengan resource yang kita miliki saat ini "tidak memungkinkan" untuk menggunakan layanan semacam itu.
Untuk alasan itulah PR ini dibuat dengan meng-imitasi mekanisme serupa namun dengan stack yang jauh lebih sederhana.
Stack saat ini
staging
deployment ditampung dalam satu server dan direktori yang samanginx
sudah dibuat untuk dapat secara otomatis mengakomodir setiap projectlaravel
yang di tempatkan di direktori tersebut dan di deploy menggunakandeployer
atau setidaknya memiliki struktur direktoripublic
yang serupa.Mekanisme yang diterapkan
main
dengan tambahan nomor PR, misal branchmain
berlokasi di/var/www/skeleton
maka PR nomor 97 akan di berlokasi di/var/www/skeleton-97
http://skeleton-97.creasi.dev
main
namun dengan nama database menyesuaikan dengan project dan nomor PREnvironment variables & secrets
Untuk project baru yang dibuat menggunakan template project ini, berikut beberapa environment variable dan secret yang dibutuhkan agar mekanisme deployment diatas dapat berjalan sebagaimana mestinya :
Variables
APP_NAME
: Nama projectSENTRY_PROJECT
: Nama project di sentry (cek Project Settings di Sentry)APP_ENV
: Nama untuk spesifik environmentAPP_URL
: URL end-point untuk masing-masing environmentSecrets
DB_PASSWORD
DB_USERNAME
SENTRY_DSN
Panduan untuk Reviewer
ℹ️ Kriteria auto-deploy PR saat ini dibatasi hanya berlaku untuk branch dengan pola nama
feat/**
danmain
Ketika PR telah di deploy, reviewer dapat meng-akses dengan meng-klik tombol View deployment pada time-line item di PR tersebut
Menual deployment dapat dilakukan dengan mengakses menu berikut, sesuaikan branch dan target deployment yang dibutuhkan dan klik Run workflow
Setelah deployment selesai, klik workflow tersebut untuk mendapatkan URL dari deployment teresbut.
Catatan untuk dev
Saat ini belum ada implementasi auto-destroy deployment ketika PR di-merge, saya butuh feedback dan liat seberapa positif inpact dari implementasi saat ini terlebih dahulu. Auto-destroy akan saya implementasikan lain waktu, atau silakan jika ada yang mau kontribusi.
Jadi direktory deployment dan database preview untuk PR yang sudah di merge bisa dihapus secara manual.
Reset database saat deploy
Tambahkan flag
--reset
saat melakukan deployment, contoh :