Tugas Kelompok PJPB - Smart Contracts
Anggota kelompok
- Arina Salma Salsabila (20/459170/PA/19831)
- Gabriel Possenti Kheisa Drianasta (19/442374/PA/19123)
- Gregorius Adi Pradana (20/455382/PA/19597)
- Haikal Abdurrahman (19/445563/PA/19387)
- Timothy Cleytus Gultom (20/455390/PA/19605)
Teknologi
- Back end: PHP 7.2 (vanilla)
- Database: MySQL
- Hosting: DigitalOcean
1. Buat file dengan nama docker-compose.yml, isi file dengan konfigurasi berikut:
```yaml
# ./docker-compose.yml
version: '3'
services:
app:
image: adhocore/lemp:7.4
# For different app you can use different names. (eg: )
container_name: some-app
volumes:
# app source code
- ./web:/var/www/html
# db data persistence
- db_data:/var/lib/mysql
# Here you can also volume php ini settings
# - /path/to/zz-overrides:/usr/local/etc/php/conf.d/zz-overrides.ini
ports:
- 8080:80
environment:
MYSQL_ROOT_PASSWORD: supersecurepwd
MYSQL_DATABASE: appdb
MYSQL_USER: dbusr
MYSQL_PASSWORD: securepwd
# for postgres you can pass in similar env as for mysql but with PGSQL_ prefix
volumes:
db_data: {}
```
2. Kemudian, compose
docker-compose up -d
3. Navigasi menuju folder web
cd web
4. Clone repository berikut, kemudian ganti branch ke docker
git clone https://github.com/gabrielkheisa/tugas-pjpb.git
cd tugas-pjpb
git checkout docker
5. Bash ke container untuk melakukan beberapa konfigurasi database:
docker exec -u root -t -i some-app /bin/bash
6. Login ke MySQL sebagai root dengan password supersecurepwd
mysql -u root -p
7. Tambahkan tabel berikut, beserta user Admin:
USE appdb;
CREATE TABLE `user_pjpb` (
`nama` VARCHAR(30),
`email` VARCHAR(30),
`hash` VARCHAR(70),
`public_key` VARCHAR(70),
`url` TEXT(70),
`id` INT(11) AUTO_INCREMENT,
PRIMARY KEY (`id`)
);
7. Berikan akses dbusr ke appdb:
GRANT ALL PRIVILEGES ON appdb.* TO 'dbusr'@'localhost' WITH GRANT OPTION;
exit;
Aplikasi dapat diakses melalui http://{ip-address}:8080/login.php, untuk registrasi melalui http://{ip-address}:8080/register.php