Difference between revisions of "CTF: Instalasi CTFd di Ubuntu 22.04 dengan docker"

From OnnoWiki
Jump to navigation Jump to search
 
(27 intermediate revisions by the same user not shown)
Line 1: Line 1:
Sumber: https://github.com/CTFd/CTFd
+
Sumber: https://docs.ctfd.io/docs/deployment/installation
  
 
Spec:
 
Spec:
  
VirtualBox
+
* VirtualBox
Ubuntu 22.04
+
* Ubuntu 22.04
Memory 3G
+
* Memory 3G
Core 2
+
* Core 2
 +
 
 +
Sebagian besar dilakukan sebagai user biasa.
  
 
==Basic==
 
==Basic==
  
 +
Sebagai user biasa.
 +
 
  sudo su
 
  sudo su
  apt update
+
  sudo apt update
  apt -y install net-tools
+
  sudo apt -y install net-tools pip
 +
 
 +
==Install Docker atau Docker Compose==
 +
 
 +
Sebagai user biasa, install
 +
 +
sudo apt  -y install docker-compose  # version 1.29.2-1
 +
 +
atau
 +
 +
sudo snap install docker            # version 20.10.17
 +
 
 +
salah satu saja, lebih di sukai docker-compose.
 +
 
 +
==Install CTFd==
 +
 
 +
Sebagai user biasa, download CTFd
 +
 
 +
cd ~
 +
git clone https://github.com/CTFd/CTFd.git
 +
 
 +
Edit atau sesuaikan docker-compose.yml
 +
 
 +
cd ~/CTFd
 +
vi docker-compose.yml
 +
 
 +
Edit environment
 +
 
 +
environment:
 +
  - SECRET_KEY=<SPECIFY_RANDOM_VALUE>
 +
  - UPLOAD_FOLDER=/var/uploads
 +
  - DATABASE_URL=mysql+pymysql://ctfd:ctfd@db/ctfd
 +
  - REDIS_URL=redis://cache:6379
 +
  - WORKERS=1
 +
  - LOG_FOLDER=/var/log/CTFd
 +
  - ACCESS_LOG=-
 +
  - ERROR_LOG=-
 +
  - REVERSE_PROXY=true
 +
 
 +
yang perlu di edit adalah
 +
 
 +
SECRET_KEY=<SPECIFY_RANDOM_VALUE>
 +
WORKERS=1
 +
 
 +
==Run==
 +
 
 +
Docker Compose & Up
 +
 +
cd ~/CTFd
 +
sudo docker-compose up
 +
 +
atau
 +
 +
cd ~/CTFd
 +
sudo docker-compose up --build
 +
 +
Sampai keluar
 +
 
 +
ctfd_1  | [2023-01-29 06:59:21 +0000] [1] [INFO] Starting gunicorn 20.1.0
 +
ctfd_1  | [2023-01-29 06:59:21 +0000] [1] [INFO] Listening at: http://0.0.0.0:8000 (1)
 +
ctfd_1  | [2023-01-29 06:59:21 +0000] [1] [INFO] Using worker: gevent
 +
ctfd_1  | [2023-01-29 06:59:21 +0000] [21] [INFO] Booting worker with pid: 21
 +
ctfd_1  | INFO  [alembic.runtime.migration] Context impl MySQLImpl.
 +
ctfd_1  | INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
 +
ctfd_1  | INFO  [alembic.runtime.migration] Context impl MySQLImpl.
 +
ctfd_1  | INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
 +
 
 +
Kalau berhasil, Browse
 +
 
 +
http://ip.address:8000
 +
http://192.168.0.144:8000
 +
 
 +
==Start & Stop==
 +
 
 +
Stop
 +
 
 +
CTRL-C di layar
 +
 
 +
Start
 +
 
 +
cd ~/CTFd
 +
sudo docker-compose up --build
 +
 
 +
=Alternatif Instalasi docker yang kemungkinan error=
 +
 
  
 
==Install Docker==
 
==Install Docker==
Line 25: Line 113:
 
  sudo systemctl status docker
 
  sudo systemctl status docker
  
==Referensi==
+
==Install Docker Compose==
 +
 
 +
Sebagai user biasa
 +
 
 +
mkdir -p ~/.docker/cli-plugins/
 +
curl -SL https://github.com/docker/compose/releases/download/v2.3.3/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose
 +
 
 +
Set permissions,
 +
 
 +
chmod +x ~/.docker/cli-plugins/docker-compose
 +
 
 +
Cek
 +
 
 +
docker compose version
 +
 
 +
=Referensi=
  
 +
* https://docs.ctfd.io/docs/deployment/installation
 
* https://github.com/CTFd/CTFd
 
* https://github.com/CTFd/CTFd
 
* https://www.h4k-it.com/installing-and-configuring-ctfd/
 
* https://www.h4k-it.com/installing-and-configuring-ctfd/

Latest revision as of 05:38, 30 January 2023

Sumber: https://docs.ctfd.io/docs/deployment/installation

Spec:

  • VirtualBox
  • Ubuntu 22.04
  • Memory 3G
  • Core 2

Sebagian besar dilakukan sebagai user biasa.

Basic

Sebagai user biasa.

sudo su
sudo apt update
sudo apt -y install net-tools pip

Install Docker atau Docker Compose

Sebagai user biasa, install

sudo apt  -y install docker-compose  # version 1.29.2-1

atau

sudo snap install docker             # version 20.10.17

salah satu saja, lebih di sukai docker-compose.

Install CTFd

Sebagai user biasa, download CTFd

cd ~
git clone https://github.com/CTFd/CTFd.git

Edit atau sesuaikan docker-compose.yml

cd ~/CTFd
vi docker-compose.yml

Edit environment

environment:
  - SECRET_KEY=<SPECIFY_RANDOM_VALUE>
  - UPLOAD_FOLDER=/var/uploads
  - DATABASE_URL=mysql+pymysql://ctfd:ctfd@db/ctfd
  - REDIS_URL=redis://cache:6379
  - WORKERS=1
  - LOG_FOLDER=/var/log/CTFd
  - ACCESS_LOG=-
  - ERROR_LOG=-
  - REVERSE_PROXY=true

yang perlu di edit adalah

SECRET_KEY=<SPECIFY_RANDOM_VALUE>
WORKERS=1

Run

Docker Compose & Up

cd ~/CTFd
sudo docker-compose up

atau

cd ~/CTFd
sudo docker-compose up --build

Sampai keluar

ctfd_1   | [2023-01-29 06:59:21 +0000] [1] [INFO] Starting gunicorn 20.1.0
ctfd_1   | [2023-01-29 06:59:21 +0000] [1] [INFO] Listening at: http://0.0.0.0:8000 (1)
ctfd_1   | [2023-01-29 06:59:21 +0000] [1] [INFO] Using worker: gevent
ctfd_1   | [2023-01-29 06:59:21 +0000] [21] [INFO] Booting worker with pid: 21
ctfd_1   | INFO  [alembic.runtime.migration] Context impl MySQLImpl.
ctfd_1   | INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
ctfd_1   | INFO  [alembic.runtime.migration] Context impl MySQLImpl.
ctfd_1   | INFO  [alembic.runtime.migration] Will assume non-transactional DDL.

Kalau berhasil, Browse

http://ip.address:8000
http://192.168.0.144:8000

Start & Stop

Stop

CTRL-C di layar

Start

cd ~/CTFd
sudo docker-compose up --build

Alternatif Instalasi docker yang kemungkinan error

Install Docker

apt -y install curl
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7EA0A9C3F273FCD8
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt-cache policy docker-ce
sudo apt install -y docker-ce
sudo systemctl status docker

Install Docker Compose

Sebagai user biasa

mkdir -p ~/.docker/cli-plugins/
curl -SL https://github.com/docker/compose/releases/download/v2.3.3/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose

Set permissions,

chmod +x ~/.docker/cli-plugins/docker-compose

Cek

docker compose version

Referensi