AcademyTerminal Tactics: Survival in the ShellPhase 10: Final Extraction

Lesson 1: The Server Setup (Capstone Part 1)

Congratulations — you've learned all the individual tools. Now it's time to put everything together. In this mission, you'll set up a web application server from scratch, exactly like a DevOps engineer would on Day 1.

The Scenario

CloudCorp is launching a new microservice. Your job:

  1. Create the directory structure.
  2. Configure the application.
  3. Set proper security permissions.
  4. Write a startup script.
  5. Launch it!

Step 1: Directory Structure

Every professional project follows a standard layout:

/opt/webapp/
├── public/      → Static files served to users
├── logs/        → Application log files
├── config/      → Configuration and secrets
└── start.sh     → Startup script

The -p flag in mkdir creates parent directories automatically:

mkdir -p /opt/webapp/{public,logs,config}

Step 2: Configuration

Store settings in environment files, not hardcoded in scripts:

echo 'PORT=8080\nENV=production' > /opt/webapp/config/app.env

Step 3: Security

Config files often contain secrets (API keys, database passwords). Lock them down:

chmod 600 /opt/webapp/config/app.env   # Only owner can read/write

Step 4: Startup Script

Combine everything into an automated launch sequence:

#!/bin/bash
echo "Server starting on port 8080"
echo "$(date)" >> /opt/webapp/logs/startup.log
booting...

Mission Objective

Build and launch your server step by step:

  1. Lay the foundation: Create the directory structure with mkdir -p /opt/webapp/{public,logs,config}.
  2. Configure: Create the config file with echo 'PORT=8080\nENV=production' > /opt/webapp/config/app.env.
  3. Secure: Lock down the config with chmod 600 /opt/webapp/config/app.env.
  4. Automate: Create and arm the startup script.
  5. Launch! Run your startup script.

Mission Control

Create the application directory structure

Expected Command

mkdir -p /opt/webapp/{public,logs,config}

Create a configuration file

Lock down the config with proper permissions

Create a startup script

Run your startup script