Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/16 pages #17

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ _mysites/vendor/*
_mysites/console/bin/.files/cache/*
/Sites/*/vendor/*
/Sites/**/wp-config*
/Sites/**/configuration.php
/Sites/**/configuration.php
!/Sites/pages/configuration.php
/Projects/joomlatools-pages/cache/*
/Sites/pages/administrator/cache/*
Empty file added Projects/.gitkeep
Empty file.
43 changes: 43 additions & 0 deletions Projects/joomlatools-pages/cache/pages/page_628915681.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php /*//path:/Sites/pages/joomlatools-pages/pages*/
return array (
'files' =>
array (
'hello' => 'hello.html.php',
),
'pages' =>
array (
'hello.html.php' =>
array (
'path' => 'hello',
'slug' => 'hello',
'format' => 'html',
'hash' => 'f007625f',
'process' =>
array (
),
'route' => 'hello',
'date' => 1616843837,
'language' => 'en-GB',
'metadata' =>
array (
'robots' =>
array (
),
),
),
),
'routes' =>
array (
'hello' =>
array (
0 => 'hello',
),
),
'collections' =>
array (
),
'redirects' =>
array (
),
'hash' => 'c60f2a34',
);
2 changes: 2 additions & 0 deletions Projects/joomlatools-pages/pages/hello.html.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h3>Hello World!</h3>
<p>Welcome to my new page.</p>
138 changes: 12 additions & 126 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,146 +1,32 @@
![Screenshot](/screenshot.png?raw=true)

# my-sites-ide

`my-sites-ide` is designed to be an easy way to spin up new php development environments on the fly:

`composer global require yiendos/my-sites-ide`

Create new play areas, or you can integrate the IDE into existing projects. Simply navigate to the folder of your choice and run:

`mysites setup`

Followed by:

`[project-name] spark`

To launch your new play area... See `Your project path is important` below for further details.

---

### Prerequisites

Here is the list of prerequisites for your host system:

* Docker
* php
* composer

### Initial setup

Now you are going to need to add the global `~./composer/vendor/bin` to your path if you haven't already done this.

To do this temporarily for the session of your terminal screen:

```
export PATH=$PATH:~/.composer/vendor/bin
````

Or a more permanent solution:

```
echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.bashrc

source ~/.bashrc
```

Or if you use zshrc:

```
echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.zshrc

source ~/.zshrc &&
```
### Your project path is important
* php (not strictly needed, we could organise things to run off docker-compose alone)
* composer (see above)

Where you choose to install the `my-sites-ide` is important. Let's say you wanted to host sites(s) at: `~/Sites/new-site`:
### Getting started

* This would translate to project path of:
`/Users/somebody/Sites/new-site`

* With the project name of
`new-site`

So you would therefore install the `my-site-ide` by issuing the following commands:

* Create the folder if it doesn't already exist:
```
mkdir -p ~/Sites/new-site && cd ~/Sites/new-site
```

* Install the IDE
```
mysites setup
```

* Launch the IDE
```
new-site spark
```

This can take a while for the first time, we are building apache, nginx, php base images for you. The next time you come to use `mysites setup` for a new project the installation time will be super speedy.

Then you are able to control the docker instances through commands we've created under the project namespace. So if your project is `new-sites` typing this into the terminal will give you access to these commands. See `Controlling your my-sites-ide` section below.


### Apple M1/ ARM64 chip support

Note if you want to use this on Arm64 chips, we need to handle mysql differently. Currently only mysql:8.0 is supported:

`mysites setup -f docker-compose-arm.yml`

### Controlling your my-sites-ide

We've made working with your my-sites-ide as easy as possible, as part of the `mysites setup` process we also created these commands under the project namespace.

So once again if your site is hosted at `new-site`, then your new terminal commands will be available under the `new-site` namespace:

```
new-site

Console Tool

Usage:
command [options] [arguments]

Options:
-h, --help Display help for the given command. When no command is given display help for the list command
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
douse Temporarily pause your sites
export Export a database(s)
help Displays help for a command
list Lists commands
panic Kindle won't launch? This is our troubleshooting command
restart Made changes locally? Restart the corresponding docker container
setup Create the initial mysites configuration file
spark Fire up your mysites IDE
status See the status of mysites containers
wordpress
wordpress:create Create a WordPress site
wordpress:delete Nuke an existing site
wordpress:vhost Creates a new Apache2 and/or Nginx virtual host
```
1. `cd ~/Sites`
1. `git clone [email protected]:yiendos/my-sites-ide.git`
1. `cd ~/Sites/my-sites-ide`
1. `git checkout feature/16-pages `
1. `php _mysites/console/bin/mysites setup` (slow first time, building base images... much quicker next pages installation)
1. `my-sites-ide spark`

### Welcome to your new play area

* http://localhost:8080 - apache2
* http://localhost:8081 - nginx
* http://localhost:8080/pages/hello - apache2
* http://localhost:8081/pages/hello - nginx
* http://localhost:8083 - Mailhog
* http://localhost:8084 - phpmyadmin
* http://localhost:3000 - Theia editor
* http://localhost:3000 - Theia editor - Temporarily switched off for this branch to save memory issues on host

Database available at: -H 127.0.0.1 - P 3306 root:root

We hope you feel at home!


### Continuous Deployment as Standard

`my-sites-ide` came from 8 years working with deployment processes (Jenkins, Travis, github actions) and from this the IDE came into being. So going full circle we've included a barebones github actions integration for you.
Expand Down
24 changes: 24 additions & 0 deletions Sites/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

$ascii = <<<EOT
/\
/\ //\\
/\ //\\///\\\ /\
//\\ ///\////\\\\ /\ //\\
/\ / ^ \/^ ^/^ ^ ^ \/^ \/ ^ \
/ ^\ /\ / ^ / ^/ ^ ^ ^ ^\ ^/ ^^ \
/^ \ / ^\/ ^ ^ ^ / ^ ^ ^ \/ ^ ^ \ *
/ ^ ^ \/^ ^\ ^ ^ ^ ^ ^ ^ ____ ^ ^ \ /|\
/ ^ ^ ^ \ ^ _\___________________| |_____^ ^ \ /||o\
/ ^^ ^ ^ ^\ /______________________________\ ^ ^ \ /|o|||\
/ ^ ^^ ^ ^ /________________________________\ ^ /|||||o|\
/^ ^ ^ ^^ ^ ||___|___||||||||||||___|__||| /||o||||||\ |
/ ^ ^ ^ ^ ||___|___||||||||||||___|__||| | | |
/ ^ ^ ^ ^ ^ ^ ||||||||||||||||||||||||||||||oooooooooo| |ooooooo |
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
EOT;

echo "<h1>Welcome home</h1>";
echo "<pre>";
echo $ascii;
echo "</pre>";
92 changes: 92 additions & 0 deletions Sites/pages/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
##
# @package Joomla
# @copyright Copyright (C) 2005 - 2020 Open Source Matters. All rights reserved.
# @license GNU General Public License version 2 or later; see LICENSE.txt
##

##
# READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE!
#
# The line 'Options +FollowSymLinks' may cause problems with some server configurations.
# It is required for the use of Apache mod_rewrite, but it may have already been set by
# your server administrator in a way that disallows changing it in this .htaccess file.
# If using it causes your site to produce an error, comment it out (add # to the
# beginning of the line), reload your site in your browser and test your sef urls. If
# they work, then it has been set by your server administrator and you do not need to
# set it here.
##

## No directory listings
<IfModule mod_autoindex.c>
IndexIgnore *
</IfModule>

## Suppress mime type detection in browsers for unknown types
<IfModule mod_headers.c>
Header always set X-Content-Type-Options "nosniff"
</IfModule>

## Can be commented out if causes errors, see notes above.
Options +FollowSymlinks
Options -Indexes

## Disable inline JavaScript when directly opening SVG files or embedding them with the object-tag
<FilesMatch "\.svg$">
<IfModule mod_headers.c>
Header always set Content-Security-Policy "script-src 'none'"
</IfModule>
</FilesMatch>

## Mod_rewrite in use.

RewriteEngine On

## Begin - Rewrite rules to block out some common exploits.
# If you experience problems on your site then comment out the operations listed
# below by adding a # to the beginning of the line.
# This attempts to block the most common type of exploit `attempts` on Joomla!
#
# Block any script trying to base64_encode data within the URL.
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
# Block any script that includes a <script> tag in URL.
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
# Block any script trying to set a PHP GLOBALS variable via URL.
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block any script trying to modify a _REQUEST variable via URL.
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Return 403 Forbidden header and show the content of the root home page
RewriteRule .* index.php [F]
#
## End - Rewrite rules to block out some common exploits.

## Begin - Custom redirects
#
# If you need to redirect some pages, or set a canonical non-www to
# www redirect (or vice versa), place that code here. Ensure those
# redirects use the correct RewriteRule syntax and the [R=301,L] flags.
#
## End - Custom redirects

##
# Uncomment the following line if your webserver's URL
# is not directly related to physical file paths.
# Update Your Joomla! Directory (just / for root).
##

# RewriteBase /

## Begin - Joomla! core SEF Section.
#
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
#
# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script
RewriteCond %{REQUEST_URI} !^/index\.php
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.php [L]
#
## End - Joomla! core SEF Section.
Loading