Giter Club home page Giter Club logo

cpmp-lib-skeleton's Introduction

CPMP lib skeleton

This is not compatible with Cockpit CMS v2.

See also Cockpit CMS v1 docs, Cockpit CMS v1 repo and Cockpit CMS v2 docs, Cockpit CMS v2 repo.


If you want to keep your docs root clean while using CpMultiplane with Cockpit, you can use this skeleton to rearrange the file structure and to include them as a library. You can use cockpit like before - with some advantages:

  • Add your own favicon to the root folder.
  • Add your own files to the root without messing up the cockpit installation.
  • You can use your root as an own git repository.

If you look for a Cockpit skeleton without CpMultiplane, have a look at the cockpit-lib-skeleton, that I wrote a while ago.

Intended use

This is a skeleton to start your own project. Don't clone this repository. Just download it, modify it and than run git init to create a version controlled project.

Relevant files

Keep index.php, bootstrap.php, defines.php and .htaccess.dist. Also data/cp/storage/data must exist before you can run Cockpit or cli commands. You can remove the other files, if you don't need them for your workflow.

File structure

After doing all steps described under Installation, your file structure should look like this:

.
├── data
|   ├── cp
│   |   ├── addons
│   |   |   ├── CpMultiplaneGUI
│   |   |   ├── FormValidation
│   |   |   └── UniqueSlugs
│   |   ├── config
│   |   └── storage
│   |       ├── cache
│   |       ├── data
│   |       ├── thumbs
│   |       ├── tmp
│   |       └── uploads
|   └── mp
|       └── themes
│           └── my-child-theme
├── lib
│   ├── cockpit
│   ├── CpMultiplane
│   └── vendor --> if installed via composer
│   .htaccess
│   bootstrap.php
│   cp
│   defines.php
│   index.php
│   mp
│   ...

Installation

manually

  • Use this repository as a base or copy index.php, bootstrap.php, defines.php, .htaccess.dist and data/ to your project folder.
  • Copy .htaccess.dist to .htaccess
  • Download CpMultiplane and extract it to lib/CpMultiplane.
  • Download Cockpit and extract it to lib/cockpit.
  • Copy lib/cockpit/cp to cp and to mp so the cli commands from Cockpit and from CpMultiplane work from your root directory.
  • Use the cli to create an admin user ./mp account/create --user admin --password admin --email [email protected]
  • Install addons CpMultiplaneGUI, UniqueSlugs, FormValidation.

via git

I expect, that you use this repo as a base or that you copy index.php, bootstrap.php, defines.php, .htaccess.dist and data/cp/ to your project folder.

cd ~/html
git clone https://github.com/agentejo/cockpit.git lib/cockpit
git clone https://github.com/raffaelj/CpMultiplane.git lib/CpMultiplane
git clone https://github.com/raffaelj/cockpit_CpMultiplaneGUI.git data/cp/addons/CpMultiplaneGUI
git clone https://github.com/raffaelj/cockpit_FormValidation.git data/cp/addons/FormValidation
git clone https://github.com/raffaelj/cockpit_UniqueSlugs.git data/cp/addons/UniqueSlugs
cp .htaccess.dist .htaccess
cp lib/cockpit/cp ./cp
cp ./cp ./mp
./mp account/create --user admin --password admin --email [email protected]

via composer and docker

from a bare directory

mkdir my-project
cd my-project
# composer create-project --ignore-platform-reqs raffaelj/cpmp-lib-skeleton .
composer create-project raffaelj/cpmp-lib-skeleton .

# create default admin user
./mp account/create --user admin --password admin --email [email protected]

from this repository

This is for local development. I expect, that composer and docker are installed.

composer install --no-dev --ignore-platform-reqs

Create a .env file and change the user/group id to your needs.

docker-compose up -d
docker exec -it cpmp bash

# create default admin user
./mp account/create --user admin --password admin --email [email protected]

# or run quickstart routine with dummy data
./mp multiplane/quickstart --template basic
./mp multiplane/create-dummy-data

build

install dependencies:

composer install or composer install --no-dev --ignore-platform-reqs

update dependencies:

composer update or composer update --no-dev --ignore-platform-reqs

Credits/License

Some files and snippets are copied from the core Cockpit CMS, author: Artur Heinze, www.agentejo.com, MIT License

Everything else: Raffael Jesche, www.rlj.me, MIT License

cpmp-lib-skeleton's People

Contributors

raffaelj avatar raruto avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

raruto

cpmp-lib-skeleton's Issues

Local development

Hi Raffael,

I'm having some troubles in trying to start a simple demo server (I can't figure out if it's a problem related to my local config or if it's just a bug), I hope I don't bother you too much...

Here are my steps:

# apache folder
cd D:/htdocs/

# create project folder
mkdir multiplane
cd multiplane

# initialize project structure
composer create-project raffaelj/cpmp-lib-skeleton .

# create admin user
php ./mp account/create --user admin --password admin --email [email protected]

# run quickstart routine
php ./mp multiplane/quickstart --template basic
php ./mp multiplane/create-dummy-data

Until here no strange errors in console, so after that I open http://localhost/multiplane/ and i got the following error:

This site doesn't exist.

The login link at the bottom of this page points to the following url: http://localhost/login/

login

These are the user-defined constants for http://localhost/multiplane/:

// index.php

// bootstrap cockpit or CpMultiplane
require(__DIR__.'/bootstrap.php');
echo '<pre>' . print_r( get_defined_constants(true)['user'], true ) . '</pre>';

Array
(
    [CPMP_COCKPIT_PATH] => /lib/cockpit
    [COCKPIT_DIR] => D:/htdocs/multiplane/lib/cockpit
    [MP_ADMINFOLDER] => cockpit
    [COCKPIT_ENV_ROOT] => D:/htdocs/multiplane/cpdata
    [MP_ENV_ROOT] => D:/htdocs/multiplane
    [MP_BASE_URL] => 
    [COCKPIT_CLI] => 
    [MP_COCKPIT_ADMIN_ROUTE] => /multiplane/
    [COCKPIT_ADMIN] => 
    [MP_DIR] => D:/htdocs/multiplane/lib/CpMultiplane
    [MP_DOCS_ROOT] => D:/htdocs
    [MP_ENV_URL] => D:/htdocs/multiplane
    [MP_CONFIG_DIR] => D:/htdocs/multiplane/config
    [MP_CONFIG_PATH] => D:/htdocs/multiplane/config/config.php
    [MP_SELF_EXPORT] => 
    [COCKPIT_SITE_DIR] => D:/htdocs/multiplane
    [COCKPIT_START_TIME] => 1606666331.2246
    [COCKPIT_DOCS_ROOT] => D:/htdocs
    [COCKPIT_BASE_URL] => /multiplane/lib/cockpit
    [COCKPIT_API_REQUEST] => 0
    [COCKPIT_CONFIG_DIR] => D:/htdocs/multiplane/cpdata/config
    [COCKPIT_BASE_ROUTE] => /multiplane/lib/cockpit
    [COCKPIT_STORAGE_FOLDER] => D:/htdocs/multiplane/cpdata/storage
    [COCKPIT_ADMIN_CP] => 0
    [COCKPIT_PUBLIC_STORAGE_FOLDER] => D:/htdocs/multiplane/cpdata/storage
    [COCKPIT_CONFIG_PATH] => D:/htdocs/multiplane/cpdata/config/config.php
)

and this is the folder structure:

# tree -L 2 -a
.
├── bootstrap.php
├── composer.json
├── composer.lock
├── config
├── cp
├── cpdata
│   ├── addons
│   ├── config
│   └── storage
├── defines.php
├── docker-compose.yml
├── .env.dist
├── .gitignore
├── .htaccess
├── .htaccess.dist
├── index.php
├── lib
│   ├── cockpit
│   ├── CpMultiplane
│   └── vendor
├── LICENSE
├── mp
└── README.md
# tree -apfiL 2
.
[-rwxrwxrwx]  ./bootstrap.php
[-rwxrwxrwx]  ./composer.json
[-rwxrwxrwx]  ./composer.lock
[drwxrwxrwx]  ./config
[-rwxrwxrwx]  ./cp
[drwxrwxrwx]  ./cpdata
[drwxrwxrwx]  ./cpdata/addons
[drwxrwxrwx]  ./cpdata/config
[drwxrwxrwx]  ./cpdata/storage
[-rwxrwxrwx]  ./defines.php
[-rwxrwxrwx]  ./docker-compose.yml
[-rwxrwxrwx]  ./.env.dist
[-rwxrwxrwx]  ./.gitignore
[-rwxrwxrwx]  ./.htaccess
[-rwxrwxrwx]  ./.htaccess.dist
[-rwxrwxrwx]  ./index.php
[drwxrwxrwx]  ./lib
[drwxrwxrwx]  ./lib/cockpit
[drwxrwxrwx]  ./lib/CpMultiplane
[drwxrwxrwx]  ./lib/vendor
[-rwxrwxrwx]  ./LICENSE
[-rwxrwxrwx]  ./mp
[-rwxrwxrwx]  ./README.md

Happy thoughts,
Raruto

Composer 2

Hi Raffael,

following the composer and docker installation i got the following warning coming from the CpMultiplane plugin:

The "oomphinc/composer-installers-extender" plugin was skipped because it requires a Plugin API version ("^1.0") that do
es not match your Composer installation ("2.0.0"). You may need to run composer update with the "--no-plugins" option.
Warning: You forced the install of 1.10.17 via --1, but 2.0.7 is the latest stable version. Updating to it via composer
self-update --stable is recommended.

Any plans regard uptading oomphinc's plugin to version 2?

If needed, here's how to switch between composer versions:

composer self-update --1
composer self-update --2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.