Skip to content

2.x: Using ce-dev-ce-provision-config 2.x #208

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

Merged
merged 20 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
810db5e
2.x: Using the right conditions to build binaries
DionisioFG Nov 6, 2024
ed46823
2.x: Update RELEASE file
DionisioFG Nov 7, 2024
cede0a7
2.x: Fixed how the tags are identified to run a new build
DionisioFG Nov 7, 2024
a24ec88
2.x: Fixed tarballs, mising lib folder
DionisioFG Nov 7, 2024
992f6a4
2.x: Fixed some bits about localgov
DionisioFG Nov 13, 2024
0f935e1
2.x: Getting the latest release available per branch
DionisioFG Nov 13, 2024
cb2141a
Updated install.sh scrip to get the latest version per branch. Fixed …
DionisioFG Nov 13, 2024
ddb1920
Merge branch '2.x' of github.com:codeenigma/ce-dev into 2.x
DionisioFG Dec 17, 2024
c5b822b
Added Drupal 11 template, removed yarn (#203)
DionisioFG Dec 19, 2024
6cdd766
Merge branch '2.x' of github.com:codeenigma/ce-dev into 2.x
DionisioFG Jan 15, 2025
430595a
2.x: Removed yarn from doc and other old stuff
DionisioFG Jan 15, 2025
f02a3b1
Merge branch 'devel-2.x' into 2.x_wiki_update_MR_devel
DionisioFG Jan 15, 2025
d0aad54
2.x: Fixed devel tag
DionisioFG Jan 15, 2025
8f76d57
Merge branch '2.x_wiki_update' into 2.x_wiki_update_MR_devel
DionisioFG Jan 15, 2025
1761fc6
2.x: Using ce-dev-ce-provision-config 2.x
DionisioFG Feb 11, 2025
08f5821
Merge branch '2.x_wiki_update' into 2.x_wiki_update_MR_devel
DionisioFG Feb 11, 2025
b490297
2.x: Added new param ansible_collection_dir
DionisioFG Feb 11, 2025
6982f40
Merge branch '2.x_wiki_update' into 2.x_wiki_update_MR_devel
DionisioFG Feb 11, 2025
039a733
2.x: Added missing var to ce_deploy too
DionisioFG Feb 11, 2025
35af266
Merge branch '2.x_wiki_update' into 2.x_wiki_update_MR_devel
DionisioFG Feb 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 17 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ ce-dev 2.x
======
Local Stack wrapper tool

[![2.x: Linux - Build ce_dev binaries, images and templates (test)](https://github.com/codeenigma/ce-dev/actions/workflows/ce-dev-devel-linux.yml/badge.svg?branch=devel-2.x)](https://github.com/codeenigma/ce-dev/actions/workflows/ce-dev-devel-linux.yml)
[![2.x: Ubuntu - Test image builds on PR](https://github.com/codeenigma/ce-dev/actions/workflows/ubuntu-pr.yml/badge.svg)](https://github.com/codeenigma/ce-dev/actions/workflows/ubuntu-pr.yml)

[![devel-2.x: Ubuntu - Test image builds on PR](https://github.com/codeenigma/ce-dev/actions/workflows/devel-ubuntu-pr.yml/badge.svg)](https://github.com/codeenigma/ce-dev/actions/workflows/devel-ubuntu-pr.yml)

[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=codeenigma_ce-dev&metric=security_rating)](https://sonarcloud.io/dashboard?id=codeenigma_ce-dev)
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=codeenigma_ce-dev&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=codeenigma_ce-dev)
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=codeenigma_ce-dev&metric=bugs)](https://sonarcloud.io/dashboard?id=codeenigma_ce-dev)
Expand All @@ -18,6 +21,7 @@ Local Stack wrapper tool
* Removed drupal 8 and drupal 9 templates.
* The way to assign IPs have changed.
* All the packages used are up to date.
* Removed yarn as dependency.

## Key features
- Allows several projects (or the host) to re-use the same ports
Expand Down Expand Up @@ -48,8 +52,8 @@ Once you make your changes in the source dode ({root}/src folder), you need to c
execute the following commands:

```
yarn clean
yarn build
npm run clean
npm run build
```

This will clean and compile the new js files. A new folder {root}/lib is generated
Expand Down Expand Up @@ -77,9 +81,6 @@ it means you would need to have the local docker images with tag 2.x
dioni@dionice:~/projects/wrap$ docker image ls
[sudo] contraseña para dioni:
REPOSITORY TAG IMAGE ID CREATED SIZE
codeenigma/drupal10-db 2.x 5cae51ec65c0 3 days ago 409MB
codeenigma/drupal10-web 2.x 83cc832fb73d 3 days ago 1.47GB
codeenigma/blank-blank 2.x 5157934972ad 3 days ago 1.26GB
codeenigma/ce-dev 2.x 8753195771fc 3 days ago 691MB
codeenigma/ce-dev-controller 2.x 5aed115a5e74 3 days ago 1.83GB
```
Expand All @@ -95,22 +96,16 @@ If you don't have the local images, you can follow these steps:
```angular2html
/bin/sh docker-images/export.sh --version 2.x --image-name ce-dev --dockerfile-path base
/bin/sh docker-images/export.sh --version 2.x --image-name ce-dev-controller --dockerfile-path controller
/bin/sh templates/test.sh --template ce-dev.compose.yml
```

The last step will generate the drupal10-web, drupal10-db and blank docker images. Also, it will create docker containers
with the same name. You can remove these containers because we only need the images.

Now we can start to test our ce-dev changes as it is described in the previous point 'How to compile'


### Testing a new ce-dev release locally.

If you need to test the creation of releases locally, we can do it using oclif.

oclif is an open source framework for building a command line interface (CLI) in Node.js and Typescript https://oclif.io/

As part of the command we used ```yarn build```, a folder /lib was generated. This folder contains the javascript code
As part of the command we used ```npm run build```, a folder /lib was generated. This folder contains the javascript code
used by oclif.

According to your system, your local ce-dev version will be different. Here the list of available targets:
Expand All @@ -127,7 +122,15 @@ Probably you will use linux-...64 or darwin-...64 version.

Use oclif pack to generate a new release for your system:

i.e: <code>yarn oclif pack tarballs --targets=linux-x64 --no-xz</code>
i.e:
<code>

npm run prepack-oclif

npx oclif pack tarballs --targets=linux-x64 --no-xz

npm run postpack-oclif
</code>

This will generate a tar.gz file inside a new directory named /dir/ce-dev-xxxxxx
You can un-compress and put it where you want. i.e: you can put it in /opt too (where you have the current ce-dev)
Expand Down
7 changes: 4 additions & 3 deletions RELEASE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
2.0.1
2.0.2

## Changes since 2.0.0
## Changes since 2.0.1

* Added Drupal 11 template
* Using https://github.com/codeenigma/ce-dev-ce-provision-config 2.x
* Removed yarn as dependency, using only npm
* Updated references to 2.x-devel with devel-2.x
3 changes: 2 additions & 1 deletion docker-images/controller-ci/provision.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
own_repository_branch: 2.x
own_repository_skip_checkout: false
config_repository: https://github.com/codeenigma/ce-dev-ce-provision-config.git
config_repository_branch: 1.x
config_repository_branch: 2.x
config_repository_skip_checkout: false
username: "{{ _ce_provision_username }}"
install_username: "{{ _ce_provision_username }}"
Expand All @@ -30,6 +30,7 @@
ssh_key_type: rsa
aws_support: true
local_dir: /home/controller/ce-provision
ansible_collections_dir: "/home/ce-dev/ce-deploy/galaxy/ansible_collections"
groups: []
contrib_roles:
- directory: wazuh
Expand Down
4 changes: 3 additions & 1 deletion docker-images/controller-devel/provision.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
new_user: true
key_name: id_rsa.pub
local_dir: /home/ce-dev/ce-deploy
ansible_collections_dir: "/home/ce-dev/ce-deploy/galaxy/ansible_collections"
ce_provision_dir: "/home/ce-dev/ce-provision"
groups: []
galaxy_custom_requirements_file: ""
Expand All @@ -42,7 +43,7 @@
own_repository_branch: 2.x
own_repository_skip_checkout: false
config_repository: https://github.com/codeenigma/ce-dev-ce-provision-config.git
config_repository_branch: 1.x
config_repository_branch: 2.x
config_repository_skip_checkout: false
username: "{{ _ce_provision_username }}"
install_username: "{{ _ce_provision_username }}"
Expand All @@ -53,6 +54,7 @@
ssh_key_type: rsa
aws_support: true
local_dir: /home/ce-dev/ce-provision
ansible_collections_dir: "/home/ce-dev/ce-deploy/galaxy/ansible_collections"
groups: []
contrib_roles:
- directory: wazuh
Expand Down
4 changes: 3 additions & 1 deletion docker-images/controller/provision.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
new_user: true
key_name: id_rsa.pub
local_dir: /home/ce-dev/ce-deploy
ansible_collections_dir: "/home/ce-dev/ce-deploy/galaxy/ansible_collections"
ce_provision_dir: "/home/ce-dev/ce-provision"
groups: []
galaxy_custom_requirements_file: ""
Expand All @@ -42,7 +43,7 @@
own_repository_branch: 2.x
own_repository_skip_checkout: false
config_repository: https://github.com/codeenigma/ce-dev-ce-provision-config.git
config_repository_branch: 1.x
config_repository_branch: 2.x
config_repository_skip_checkout: false
username: "{{ _ce_provision_username }}"
install_username: "{{ _ce_provision_username }}"
Expand All @@ -53,6 +54,7 @@
ssh_key_type: rsa
aws_support: true
local_dir: /home/ce-dev/ce-provision
ansible_collections_dir: "/home/ce-dev/ce-deploy/galaxy/ansible_collections"
groups: []
contrib_roles:
- directory: wazuh
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ce-dev",
"description": "Local Stack wrapper tool",
"version": "2.0.1",
"version": "2.0.2",
"author": "Codeenigma",
"bin": "./bin/run.js",
"bugs": "https://github.com/codeenigma/ce-dev/issues",
Expand Down
6 changes: 4 additions & 2 deletions src/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,10 @@ export default class BuildCmd extends BaseCmd {
if (this.composeConfig['x-ce_dev']) {
containerName = this.composeConfig['x-ce_dev'].project_name + '-' + name
}

let version = AppSettings.ceDevVersion + '.x'
if (this.developmentMode) {
version += '-devel'
version = 'devel-' + version
}

ux.action.start('Committing container ' + containerName + ' as a new image.')
Expand All @@ -98,8 +99,9 @@ export default class BuildCmd extends BaseCmd {
private generateCompose(): void {
let version = AppSettings.ceDevVersion + '.x'
if (this.developmentMode) {
version += '-devel'
version = 'devel-' + version
}

ux.action.start('Generating new compose file ' + this.composeDest + '.')
for (const [name, service] of Object.entries(this.composeConfig.services)) {
const containerName = this.composeConfig['x-ce_dev'].project_name + '-' + name
Expand Down
3 changes: 2 additions & 1 deletion src/commands/push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ export default class PushCmd extends DockerImagesCmd {
private push(): void {
let version = AppSettings.ceDevVersion + '.x'
if (this.developmentMode) {
version += '-devel'
version = 'devel-' + version
}

for (const name of Object.keys(this.composeConfig.services)) {
const containerName = this.composeConfig['x-ce_dev'].project_name + '-' + name
ux.action.start('Pushing image ' + containerName)
Expand Down
6 changes: 4 additions & 2 deletions src/controller-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,9 @@ export default class ControllerManager {
// If in development mode, we use devel version.
let version = AppSettings.ceDevVersion + '.x';
if (this.developmentMode) {
version += '-devel';
version = 'devel-' + version
}

execSync(this.dockerBin + ' pull codeenigma/ce-dev-controller:' + version, {
stdio: 'inherit',
})
Expand All @@ -261,8 +262,9 @@ export default class ControllerManager {
const ipManager = new IPManager(this.config, this.dockerBin)
let version = AppSettings.ceDevVersion + '.x'
if (this.developmentMode) {
version += '-devel'
version = 'devel-' + version
}

return {
networks: {
ce_dev: {
Expand Down