---
# System prepended metadata

title: SIAP KOJA Technical Notes

---

# SIAP KOJA Technical Notes
Berisikan catatan-catatan selama pengembangan.


## Link Penting
~~1. Project Management Trello (Inactive) https://trello.com/b/RiZRLJjP/sapa-warga-apps~~
2. Project Management Gitlab
https://gitlab.com/groups/jdsteam/sapa-warga/-/boards
3. Gitlab Source Code https://gitlab.com/jdsteam/sapa-warga/sapawarga-app
4. Mockup Desain Admin https://invis.io/DTR1PKDZ4C8
5. Mockup Desain Mobile App https://invis.io/BEQOGO3HJFX
6. Dokumentasi Postman API https://documenter.getpostman.com/view/7126362/S1EJZ273

## Local Development Setup

### Komponen: API

1. `git pull` atau `git clone <url>` jika memulai dari awal
2. `cp .env-sample .env`
3. `export IMAGETAG=dev`
4. `sudo -E docker-compose -f docker-compose.dev.yml up -d`
5. Jalankan seeder:
```
docker-compose -f docker-compose.dev.yml exec api php yii seeder
```
6. Buka browser dan akses http://localhost:81/ping. Jika ter-setup dengan benar, pada layar akan menampilkan teks "pong"

### Komponen: Webadmin

1. `git pull` atau `git clone <url>` jika memulai dari awal
2. `cp .env-dev .env`, lalu sesuaikan value dari variable sesuai kebutuhan
3. `export IMAGETAG=dev`
4. `sudo -E docker-compose -f docker-compose.dev.yml up -d`
5. Buka browser dan akses http://localhost:8081. Jika ter-setup dengan benar, akan ditampilkan halaman login

#### Rebuild Webadmin

Untuk me-rebuild komponen `webadmin` jalankan command ini: 

```
# build for production
docker-compose -f docker-compose.dev.yml exec app yarn build

# build for development
docker-compose -f docker-compose.dev.yml exec app yarn build-dev
```

## Development Server
[Link Dokumentasi](https://hackmd.io/s/rkGi9HI2V)


## Mock Server
> Mock server sudah dipisah ke repo lain. Dokumentasi akan di-update setelah setup container dan CI/CD selesai
```
$ cd /home/development/projects/sapawarga-app
$ git pull
```
Pastikan sudah running container
```
$ docker ps -a
$ docker restart sapawarga-mock
```

## Continuous Integration (CI)
Jika ada commit yang tidak perlu melalui pipeline GitLab CI (misal karena test case yang pasti fail), bisa di-skip menggunakan commit message `[ci skip]`.

## Cheatsheet

### Start API Mock Server
```
$ cd mock-server
$ docker run -d --name sapawarga-mock --workdir=/application -v $(pwd):/application -p 3000:3000 node node index.js
```

### Cek Disk Space Server
```
sudo du -sh /var/lib/* | sort -h
```

### Rescan Hardisk and Extend Filesystem
```bash
sudo resize2fs /dev/sda2
```
Note: Change `/dev/sda2` to your device name.