Skip to content

Commit d716239

Browse files
setup initial baseline files
1 parent 4702427 commit d716239

11 files changed

+443
-1
lines changed

.cc-metadata.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Whether this GitHub repo is for a CC-led engineering project
2+
engineering_project: true
3+
# Name of the repository/project in English
4+
english_name: creativecommons.org - environment
5+
# All technologies used
6+
technologies: HTML, CSS, Javascript, PHP, Docker, Bash
7+
# Whether this repository should be featured on the CC Open Source site's "Projects" page
8+
featured: false
9+
# Slack channel name (optional key)
10+
slack: ''

.devcontainer/devcontainer.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"postCreateCommand": "echo alias wpcli=\\'docker compose run --rm wordpress-cli --path=/var/www/html\\' >> ~/.bashrc && echo alias composer=\\'docker compose run --rm composer\\' >> ~/.bashrc"
3+
}

.env.example

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# WordPress variables
2+
WP_VERSION=latest
3+
4+
# Module (plugin/theme) variables
5+
WP_MOD_TYPE=theme # theme OR plugin
6+
WP_MOD_NAME=vocabulary-theme # unique & hyphenated

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.DS_Store
2+
.env

CODE_OF_CONDUCT.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Contributor Code of Conduct
2+
3+
The Creative Commons team is committed to fostering a welcoming community. This
4+
project and all other Creative Commons open source projects are governed by our
5+
[Code of Conduct][code_of_conduct]. Please report unacceptable behavior to
6+
[conduct@creativecommons.org](mailto:conduct@creativecommons.org) per our
7+
[reporting guidelines][reporting_guide].
8+
9+
For a history of updates, see the [page history here][updates].
10+
11+
[code_of_conduct]: https://opensource.creativecommons.org/community/code-of-conduct/
12+
[reporting_guide]: https://opensource.creativecommons.org/community/code-of-conduct/enforcement/
13+
[updates]: https://github.com/creativecommons/creativecommons.github.io-source/commits/main/content/community/code-of-conduct/contents.lr

CONTRIBUTING.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Contributing to CC Open Source
2+
3+
Thank you for your interest in contributing to CC Open Source! This document is
4+
a set of guidelines to help you contribute to this project.
5+
6+
7+
## Code of Conduct
8+
9+
By participating in this project, you are expected to uphold our [Code of
10+
Conduct][code_of_conduct].
11+
12+
[code_of_conduct]: https://opensource.creativecommons.org/community/code-of-conduct/
13+
14+
15+
## Project Documentation
16+
17+
The `README` in the root of the repository should contain or link to project
18+
documentation. If you cannot find the documentation you're looking for, please
19+
file a GitHub issue with details of what you'd like to see documented.
20+
21+
22+
## How to Contribute
23+
24+
Please follow the processes in our general [Contributing Code][contributing]
25+
guidelines on the Creative Common Open Source website.
26+
27+
[contributing]: https://opensource.creativecommons.org/contributing-code/
28+
29+
30+
## Questions or Thoughts?
31+
32+
Talk to us on [one of our community forums][community].
33+
34+
[community]: https://opensource.creativecommons.org/community/

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Creative Commons
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+34-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,35 @@
11
# creativecommons.org-environment
2-
Repository for managing the full environment for creativecommons.org (dependencies, etc.)
2+
3+
WordPress Theme implementation of creativecommons.org
4+
5+
(May expand into sibling apps, likely not)
6+
7+
8+
## Docker containers
9+
10+
The [`docker-compose.yml`](docker-comose.yml) file defines the following
11+
containers:
12+
13+
1. cc-wordpress-web ([localhost:8080](http://localhost:8080/))
14+
2. cc-wordpress-db
15+
3. cc-composer
16+
4. cc-phpmyadmin ([localhost:8003](http://localhost:8003/))
17+
5. cc-wpcli
18+
19+
20+
## Setup
21+
22+
1. Create the `.env` file:
23+
```shell
24+
cp .env.example .env
25+
```
26+
2. Update `.env` to set desired values for variables (`WP_VERSION`,
27+
`WP_MOD_TYPE`, `WP_MOD_NAME`, etc.)
28+
3. Build/start Docker:
29+
```shell
30+
docker compose up
31+
```
32+
4. Wait for build and initialization to complete
33+
5. Install WordPress initially through the GUI. (TODO: Script help here)
34+
35+
Plugin/Theme dev work should be done within the `/src` directory.

docker-compose.yml

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# https://docs.docker.com/compose/compose-file/compose-file-v2/
2+
3+
version: '2.4'
4+
5+
services:
6+
7+
wordpress:
8+
container_name: cc-wordpress-web
9+
depends_on:
10+
- database
11+
environment:
12+
WORDPRESS_CONFIG_EXTRA: |
13+
# Use dispatch port by default
14+
if ('${CODESPACE_NAME:-}') {
15+
define('WP_HOME', 'https://${CODESPACE_NAME:-}-8080.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN:-}');
16+
define('WP_SITEURL', 'https://${CODESPACE_NAME:-}-8080.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN:-}');
17+
} else {
18+
define('WP_HOME', 'http://localhost:8080');
19+
define('WP_SITEURL', 'http://localhost:8080');
20+
}
21+
WORDPRESS_DB_HOST: database:3306
22+
WORDPRESS_DB_PASSWORD: root
23+
WORDPRESS_DB_USER: root
24+
WORDPRESS_DB_name: wordpress
25+
WORDPRESS_USER: root
26+
# https://hub.docker.com/_/wordpress
27+
image: wordpress:${WP_VERSION:?err}
28+
networks:
29+
- backend
30+
ports:
31+
- '8080:80'
32+
restart: always
33+
volumes:
34+
- ./src:/var/www/html/wp-content/${WP_MOD_TYPE:?err}s/${WP_MOD_NAME:?err}
35+
- wp_data:/var/www/html
36+
37+
database:
38+
container_name: cc-wordpress-db
39+
environment:
40+
MYSQL_DATABASE: wordpress
41+
MYSQL_ROOT_PASSWORD: root
42+
MYSQL_USER: root
43+
# https://hub.docker.com/_/mariadb
44+
image: mariadb
45+
networks:
46+
- backend
47+
restart: always
48+
volumes:
49+
- db_data:/var/lib/mysql
50+
51+
phpmyadmin:
52+
container_name: cc-phpmyadmin
53+
environment:
54+
MYSQL_ROOT_PASSWORD: root
55+
PMA_HOST: database
56+
PMA_PORT: 3306
57+
# https://hub.docker.com/_/phpmyadmin
58+
image: phpmyadmin/phpmyadmin
59+
networks:
60+
- backend
61+
ports:
62+
- '8003:80'
63+
64+
composer:
65+
command: 'true'
66+
container_name: cc-composer
67+
depends_on:
68+
- database
69+
- wordpress
70+
# https://hub.docker.com/_/composer
71+
image: composer
72+
user: xfs
73+
volumes:
74+
- ./docker/configs/composer.json:/var/www/html/composer.json
75+
- ./docker/configs/composer.lock:/var/www/html/composer.lock
76+
- wp_data:/var/www/html
77+
working_dir: /var/www/html/
78+
79+
wordpress-cli:
80+
container_name: cc-wpcli
81+
depends_on:
82+
- database
83+
- wordpress
84+
environment:
85+
WORDPRESS_DB_HOST: database:3306
86+
WORDPRESS_DB_NAME: wordpress
87+
WORDPRESS_DB_PASSWORD: root
88+
WORDPRESS_DB_USER: root
89+
WORDPRESS_USER: root
90+
# https://hub.docker.com/_/wordpress
91+
image: wordpress:cli
92+
networks:
93+
- backend
94+
user: xfs
95+
volumes:
96+
- wp_data:/var/www/html
97+
98+
volumes:
99+
db_data:
100+
wp_data:
101+
102+
networks:
103+
backend:

docker/configs/composer.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"repositories":[
3+
{
4+
"type":"composer",
5+
"url":"https://wpackagist.org"
6+
}
7+
],
8+
"require": {
9+
"wpackagist-plugin/classic-editor": "^1.6",
10+
"wpackagist-plugin/advanced-custom-fields": "^6.1"
11+
},
12+
"config": {
13+
"allow-plugins": {
14+
"composer/installers": true
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)