-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Pchinthapenta nr 191162
- Loading branch information
Showing
4 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
test/deploy/linux/php/docker-php/redhat/roles/configure/tasks/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
--- | ||
- debug: | ||
msg: Install Docker and PHP | ||
|
||
######################################## | ||
# RHEL support for Docker installation | ||
######################################## | ||
- block: | ||
- name: RHEL - install Docker | ||
package: | ||
name: docker | ||
update_cache: yes | ||
state: present | ||
|
||
- name: RHEL - Start docker service | ||
shell: "service docker start" | ||
|
||
- name: RHEL - Granting permissions to docker from ec2-user | ||
shell: "usermod -a -G docker ec2-user" | ||
|
||
- name: RHEL - Flush user/group permissions change | ||
meta: reset_connection | ||
|
||
- name: RHEL - Verify docker service is ready | ||
shell: docker info | ||
register: output | ||
retries: 20 | ||
delay: 15 | ||
until: output is not failed | ||
|
||
when: ansible_pkg_mgr == 'yum' | ||
become: true | ||
|
||
- name: Create templates directory | ||
file: | ||
path: /home/ec2-user/templates | ||
state: directory | ||
|
||
- name: Copy files to templates directory | ||
synchronize: | ||
src: "{{ item }}" | ||
dest: /home/ec2-user/templates | ||
mode: push | ||
with_fileglob: | ||
- "../../../../docker-templates/*" | ||
become: true | ||
|
||
######################################## | ||
# PHP installation | ||
######################################## | ||
|
||
- name: Yum update | ||
shell: yum update | ||
become: true | ||
|
||
- name: Install PHP | ||
shell: yum install php -y | ||
become: true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM php:8.2-cli | ||
COPY . /usr/src/myapp | ||
WORKDIR /usr/src/myapp | ||
EXPOSE 80 | ||
CMD [ "php", "index.php" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
// Set the content type to text/plain | ||
header('Content-Type: text/plain'); | ||
|
||
// Function to print "Hello, World!" | ||
function printHelloWorld() { | ||
echo "Hello, World!\n"; | ||
if (extension_loaded('newrelic')) { // Ensure PHP agent is available | ||
newrelic_background_job(false); | ||
} | ||
if (ob_get_length()) { | ||
ob_flush(); | ||
flush(); | ||
} | ||
} | ||
|
||
// Print "Hello, World!" initially | ||
printHelloWorld(); | ||
|
||
// Loop indefinitely | ||
while (true) { | ||
// Sleep for 5 seconds | ||
sleep(5); | ||
// Print "Hello, World!" | ||
printHelloWorld(); | ||
} | ||
?> |
27 changes: 27 additions & 0 deletions
27
test/manual/definitions/apm/php-agent/docker-php-linux2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"global_tags": { | ||
"owning_team": "virtuoso", | ||
"Environment": "development", | ||
"Department": "product", | ||
"Product": "virtuoso" | ||
}, | ||
"resources": [ | ||
{ | ||
"id": "doc-php-l2", | ||
"provider": "aws", | ||
"type": "ec2", | ||
"size": "t3.small", | ||
"ami_name": "amzn2-ami-hvm-2.0.????????.?-x86_64-gp2", | ||
"user_name": "ec2-user" | ||
} | ||
], | ||
"services": [ | ||
{ | ||
"id": "wordpress", | ||
"source_repository": "https://github.com/newrelic/open-install-library.git", | ||
"deploy_script_path": "test/deploy/linux/php/docker-php/redhat/roles", | ||
"port": 80, | ||
"destinations": ["doc-php-l2"] | ||
} | ||
] | ||
} |