This project provides a streamlined Docker-based development environment for Laravel using Docker. It includes setup scripts and handy Docker shortcut commands to simplify local development.
- Docker & Docker Compose installed
- Bash shell available
- Git installed
- SSH access if cloning a private repository
├── README.md
├── ARCHITECTURE.md
├── SCRIPTS.md
├── cmd
│ ├── art
│ ├── artisan
│ ├── bash
│ ├── clear
│ ├── composer
│ ├── container
│ ├── down
│ ├── exec
│ ├── rebuild
│ ├── restart
│ ├── stop
│ ├── up
│ ├── workspace
├── Setup
│ ├── docker
│ │ ├── docker-compose.local.yml
│ │ ├── mysql
│ │ │ └── Dockerfile
│ │ ├── nginx
│ │ │ └── sites
│ │ │ └── web.local.conf
│ │ └── workspace
│ │ └── crontab
│ │ └── laradock
│ ├── install.sh
│ ├── swagger
│ │ └── swagger.yaml
│ └── utils.sh
└── Sources
├── public
│ └── index.html
└── web/app
git clone [email protected]:mzaman/insight-cms.git
cd insight-cms
Run the setup script:
chmod +x Setup/install.sh && ./Setup/install.sh
sudo nano /etc/hosts
Add the following line:
127.0.0.1 web.test
This install.sh
script will create a .env
file with default values and set up the necessary Docker containers.
The installation script will fully automate the setup process, including the configuration of all Docker services, installation of necessary dependencies, Laravel framework setup with specific configurations, database initialization, and seeding of initial data. With this single-step operation, everything will be up and running in just a few minutes. In most cases, you won’t need to manually verify or test any of the setup steps unless there are special circumstances that require attention.
Running the install.sh script multiple times consecutively poses no issues for the proposed project. Each execution will synchronize the necessary setup steps, securely skipping any previously completed processes. It will ensure that the setup progresses from the initial scratch state through the various build stages, ultimately reaching the live application status, even if some parts of the process have already been completed.
And this is the simple installation process — setting everything up effortlessly, so you can get started in no time!
Script | Description | Example Usage |
---|---|---|
workspace |
Enters workspace containers | ./workspace |
up |
Starts Docker containers | ./up |
stop |
Stops Docker containers | ./stop |
down |
Stops and removes containers | ./down |
restart |
Restarts containers | ./restart |
rebuild |
Rebuilds containers with no cache | ./rebuild |
art |
Runs Laravel Artisan in container | ./art optimize:clear |
artisan |
Runs Laravel Artisan in container | ./artisan optimize:clear |
Make them executable:
chmod +x cmd/*
- Enter
cmd
directory:
cd cmd
-
Run
./up
to start the containers. -
Run
./workspace
to enter the workspace container where software is running. -
Once inside the workspace container, enter
cd /var/www/web
or simplycd web
to access the Laravel application. You can now run all Composer and Artisan commands.
./art optimize:clear
./composer install
Please see the Scripts File for more information.
Docker yaml file location: Setup/docker/docker-compose.local.yml
- Laravel code lives in:
Sources/web
- Laradock lives in:
Docker/
Web URLs:
- Frontend: http://web.test
- PhpMyAdmin: http://localhost:8081
- Host:
mysql
- Username:
root
- Password:
root
Swagger test form: http://localhost:5555
Swagger source file location: Setup/swagger/swagger.yaml
Swagger Editor: http://localhost:5151
By default, the project is pre-configured with a JWT secret. If you experience any issues with JWT, generate a new JWT Secret:
cd cmd && ./art jwt:secret
Check your .env
file. After running the jwt:secret
command, ensure that the .env
file contains the following line:
JWT_SECRET=your_generated_secret_key
To use the News API, you will need to obtain an API key from a provider such as NewsAPI. Once obtained, set it as an environment variable in your .env
file:
NEWS_API_KEY=62ca91a83b6a43b2b653ad424a34249d
To use a new API key, send a POST request to /api/v1/api-key
with the required service_name
and api_key
. The API key will be securely stored and returned in the response.
API endpoint: http://localhost:5555/#/default/post_api_v1_api_key
To populate the database with dummy data, run the following command from the cmd
directory:
./art migrate:refresh --seed
./clear
NewsAPI (api/v1/sync-news) endpoint is used to fetch news from NewsAPI and store it in the database. After the first fetch, the API will cache the news for 1 hour. The message on the API response will indicate that the news is being fetched from the cache for the specified time. After that, it will fetch the news from the API again, store it in the database, and cache it for another hour.
API URL: http://localhost:5555/#/default/post_api_v1_sync_news
A cron job triggers the data synchronization every 1 hour. For testing, you can manually run it by sending a POST request to api/v1/cli-sync-news
.
API URL: http://web.test/api/v1/cli-sync-news
All roles, users, and permissions can be managed, assigned, or updated through the Admin URL:
Admin URL: http://web.test/admin/auth/role
- Access the Admin panel to create new roles, assign permissions, and manage users effectively.
- Assign roles to users based on their responsibilities.
- Update permissions as necessary for different roles to control system access.
By default, there are four types of users:
- Permissions: All permissions in the system.
- Key Permissions:
- User, Role, Permission, and Post Management
- API Key Management, Health Check, and API Logs
- Permissions: Specific to Post Management and API Key Management.
- Key Permissions:
- Post Sync, Create, Update, Read, and Delete Posts
- Manage API Keys
- Permissions: Limited to Post Management.
- Key Permissions:
- Create, Update, Read, and Delete Posts
- Permissions: For background tasks.
- Key Permissions:
- Post Sync and API Key Management
Role | Permissions |
---|---|
Admin | All permissions (User, Role, Post, API Key, Health Check, Logs) |
Manager | Post Sync, API Key Management, Create/Update/Delete Posts |
Editor | Create/Update/Read/Delete Posts |
CLI | Post Sync, API Key Management (for background tasks) |
- Post Sync: Sync posts with external sources.
- API Key Management: Manage API keys for external integrations.
- Post Management: Create, read, update, and delete posts.
- Health Check: Access the system’s health status.
- API Logs: View and delete logs of API interactions.
Here are the default credentials for each user:
- Admin:
- Email:
[email protected]
- Password:
password
- Email:
- Manager:
- Email:
[email protected]
- Password:
password
- Email:
- Editor:
- Email:
[email protected]
- Password:
password
- Email:
- Guest:
- Email:
[email protected]
- Password:
password
- Email:
- REDIS UI URL: http://localhost:9987
- Username:
laradock
- Password:
laradock
To use the Postman collection, follow these steps:
- Import the
./Insight CMS - REST API (v1).postman_collection.json
file into Postman. - After logging in or registering, save the Bearer Token in the
Authorization
section. You can use this token for subsequent requests.
- Postman Collection: [Insight CMS - REST API (v1).postman_collection.json](./Insight CMS - REST API (v1).postman_collection.json)
- Transform Postman Collections into OpenAPI: https://metamug.com/util/postman-to-swagger
MIT