Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
saitho committed Apr 16, 2020
0 parents commit 8c98a1d
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
vendor
.idea
*.iml
13 changes: 13 additions & 0 deletions .mackerel/inventory.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
all:
vars:
# this sets config folder path to "project" folder in project root
mackerel__config_folder: "{{ inventory_dir }}/../project"
ansible_user: root
ansible_connection: ssh
hosts:
myhost:
ansible_host: 1.2.3.4 # add your own IP here!
mackerel:
applications:
- example_docker
#- example_native
Empty file added Dockerfile
Empty file.
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# PHP sample project

This is a sample repository for deploying a PHP application and serving it on a domain using [Mackerel, the Open-Source Web Server management](https://github.com/mackerelserver/deployment).

## How to use

### Requirements

* Ansible
* web server with root SSH access (we recommend renting a pay-per-use VPS at Hetzner)
* top level domain with A record pointing to your server IP

### Preparation

1. Install Composer dependencies:
```shell script
composer install
```
2. Install Ansible dependencies
```shell script
ansible-galaxy install -r vendor/mackerel/deployment/requirements/requirements.yml
```
3. Change the IP address `1.2.3.4` to your own servers IP in `.mackerel/inventory.yml`

4. Replace `mydomain.com` with your own domain in `mackerel/example_docker.yaml`

### Application deployment

```shell script
ansible-playbook vendor/mackerel/deployment/server-provision.yml
```

### Server provisioning

```shell script
ansible-playbook vendor/mackerel/deployment/application-deploy.yml
```
3 changes: 3 additions & 0 deletions ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[defaults]
inventory = .mackerel/inventory.yml
retry_files_enabled = False
23 changes: 23 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"license": "GPL-2.0-or-later",
"authors": [
{"name": "Mario Lubenka", "email": "[email protected]", "role": "Lead Developer"}
],
"repositories": [
{ "type": "vcs", "url": "[email protected]:mackerelserver/deployment.git" }
],
"require": {
"mackerel/deployment": "dev-master"
},
"scripts":{
"mackerel-submodules": [
"cd vendor/mackerel/deployment && git submodule sync && git submodule update --init"
],
"post-install-cmd": [
"@mackerel-submodules"
],
"post-update-cmd": [
"@mackerel-submodules"
]
}
}
13 changes: 13 additions & 0 deletions project/example_docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
domain: mydomain.com
deployment:
type: docker
settings:
services:
app:
image: saitho/mackerel-php-project-demo
expose_port: 80
db:
image: mariadb:10.5
environment:
MYSQL_ROOT_PASSWORD: example

0 comments on commit 8c98a1d

Please sign in to comment.