Skip to content

Commit

Permalink
Deploy script & Clean ReadMe
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreGauthier committed Jan 6, 2025
1 parent 1d4c054 commit 36cc982
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 113 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ORO_IMAGE_INIT=${ORO_IMAGE}-init

# Variables used internal in instances
ORO_USER_RUNTIME=www-data
ORO_ENV=prod
ORO_ENV=dev

# Data for install
ORO_USER_NAME=admin
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/deploy-demo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Deploy demo

on:
workflow_dispatch:

jobs:
deploy-demo:
name: Deploy demo
runs-on: ubuntu-latest
if: always()
steps:
- name: Deploy in EC2
env:
BRANCH: ${{ format('origin/{0}', github.ref_name) }}
PRIVATE_KEY: ${{ secrets.AWS_DEPLOY_KEY }}
HOSTNAME : ${{ secrets.AWS_HOSTNAME }}
USER_NAME : ${{ secrets.AWS_USER }}
run: |
echo "$PRIVATE_KEY" > private_key && chmod 600 private_key
ssh -o StrictHostKeyChecking=no -i private_key ${USER_NAME}@${HOSTNAME} "
cd /home/ubuntu/ &&
[ -d oro ] || git clone https://github.com/Elastic-Suite/oro-demo.git oro &&
cd /home/ubuntu/oro &&
[ -d src/packages/GallyPlugin ] || git clone https://github.com/Elastic-Suite/gally-oro-connector.git src/packages/GallyPlugin &&
docker system prune -af &&
([[ $(docker volume ls -q | awk '!/_/' | wc -l) -eq 0 ]] || docker volume rm $(docker volume ls -q | awk '!/_/' | tr '\n' ' ')) &&
docker compose down &&
git fetch --all && git reset --hard && git checkout ${{ env.BRANCH }} &&
cd /home/ubuntu/oro/src/packages/GallyPlugin &&
git fetch --all && git reset --hard && git checkout ${{ env.BRANCH }} &&
cd /home/ubuntu/oro &&
docker compose -f compose.yml run --rm php-fpm-app bash -c "source ~/.bashrc; composer install" &&
mkdir -p src/public/media &&
sudo chown ubuntu:ubuntu -R src &&
docker compose -f compose.yml up install &&
docker compose -f compose.yml up -d --build &&
docker compose exec php-fpm-app composer repositories.gally-connector '{ "type": "path", "url": "./packages/GallyPlugin", "options": { "versions": { "gally/oro-plugin": "2.0.0"}} }' &&
docker compose exec php-fpm-app composer require gally/oro-plugin:2.0.0 &&
docker compose exec php-fpm-app bin/console cache:clear
"
110 changes: 5 additions & 105 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ bin/php-cs-fixer fix --diff packages/GallyPlugin/
bin/phpstan --memory-limit=1G analyse -c packages/GallyPlugin/phpstan.neon
bin/phpunit --config phpunit.xml.dist packages/GallyPlugin/ --stop-on-fail
```
Create/edit js files
```shell
docker compose exec php-fpm-app bin/console oro:assets:install --relative-symlink # Only required once on js creation
docker compose exec php-fpm-app bin/console oro:assets:build --watch
```

## How this env was build

Expand All @@ -50,108 +55,3 @@ mv oro src
# Add user id / group id in .env
```

## Prerequisites

Install [Docker](https://docs.docker.com/engine/install/) with [Docker Compose](https://docs.docker.com/compose/install/).

**Note:** The application uses port 80, so make sure that other services do not use it.

## Run Application

#### 1. Download Repository With Docker Compose Configuration File

Check out the git repository:
```bash
git clone https://github.com/oroinc/docker-demo.git
cd docker-demo
```
Or download the archive file and extract it:
```bash
wget https://github.com/oroinc/docker-demo/archive/master.tar.gz -O - | tar -xzf -
cd docker-demo
```

#### 2. Run Application Containers

The configuration is entirely predefined, and you can only change the domain name where the application will be located. By default, it is `oro.demo`. If you need to change the domain, edit the `.env` file and change `ORO_APP_DOMAIN=my-custom-domain.demo`.

Run init service:
```bash
docker compose up restore
```

Alternatively, you can install the application from scratch, but it will require more time and resources.

Run install service:
```bash
docker compose up install
```

You can run the application as soon as it is installed or initialized.

Run application:
```bash
docker compose up application
```

The docker compose will download the required images, create networks and run containers.
Application [orocommerce-application](https://github.com/oroinc/orocommerce-application) is used by default.
You can run other community applications, such as `crm-application`, `platform-application`, or `commerce-crm-application`.
To select another application, set another image in the `.env` file, for example:
```bash
ORO_IMAGE=docker.io/oroinc/crm-application
```
If you want to get the application in a different locale, add the contents of the file `.env-locale-de_DE` or `.env-locale-fr_FR` to `.env` and restart the restore service and application.
```bash
cat .env-locale-de_DE >> .env
```

To track the logs from the php-fpm-app container, run `docker compose logs -f php-fpm-app`. To get the list of containers, run `docker compose ps`.

#### 3. Add a Record to File `/etc/hosts`

```
127.0.0.1 oro.demo
```

#### 4. Open the Application in a Browser

Now, you can open URL [http://oro.demo](http://oro.demo) in your browser.

To access the back-office, use *admin* as both login and password.
To access the storefront, use the credentials of the predefined demo user roles. To log in as a buyer, use *[email protected]* both as your login and password. To log in as a manager, use *[email protected]* both as your login and password.

## Access the Mail Catcher

[Smtp service](https://github.com/mailhog/MailHog) is additionally launched so that you can send emails from the application. It receives all mail and has a web interface that enables you to view it and perform the required actions. The web interface for the mail catcher is available at the address [http://oro.demo/mailcatcher](http://oro.demo/mailcatcher).

## Stop the Application

- To stop and remove all containers, run `docker compose down`.

- To stop and remove all containers with the data saved in volumes, run `docker compose down -v`.

## Troubleshooting

- If you deployed the application before, pull fresh images with `docker compose pull`.

## About this Project

This repository provides a Docker Compose configuration file (compose.yaml) and demonstrates how to run different applications + required services in containers. Oro Inc. provides images with applications Community Edition in public Docker Hub.

**This deployment is NOT intended for a production environment.**

**Docker images with different applications:**
OroCommerce Community Edition: [docker.io/oroinc/orocommerce-application](https://hub.docker.com/r/oroinc/orocommerce-application)
OroCRM Community Edition: [docker.io/oroinc/crm-application](https://hub.docker.com/r/oroinc/crm-application)
OroPlatform Community Edition: [docker.io/oroinc/platform-application](https://hub.docker.com/r/oroinc/platform-application)

One image is used to run containers in several roles: web server, php-fpm, consumer, websocket server, and cron service.
All these services must be running, and the PostgreSQL database must be prepared for a full-fledged application.

License
-------

[MIT][1] Copyright (c) 2013 - 2023, Oro, Inc.

[1]: LICENSE
16 changes: 10 additions & 6 deletions compose.override.yaml → compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,23 @@ x-depends_on: &default-depends_on

services:
web:
ports: !reset []
ports: !reset
- target: 80
mode: host
networks:
default:
aliases:
- ${ORO_APP_DOMAIN}
labels:
- traefik.enable=true
- traefik.http.services.oro5-web.loadbalancer.server.port=80
# Serve oro over http
- traefik.http.routers.oro-http.rule=Host(`${ORO_APP_DOMAIN}`)
- traefik.http.routers.oro-http.entrypoints=http
- traefik.http.routers.oro5-web-http.rule=Host(`${ORO_APP_DOMAIN}`)
- traefik.http.routers.oro5-web-http.entrypoints=http
# Serve oro over https
- traefik.http.routers.oro-https.rule=Host(`${ORO_APP_DOMAIN}`)
- traefik.http.routers.oro-https.entrypoints=https
- traefik.http.routers.oro-https.tls=true
- traefik.http.routers.oro5-web-https.rule=Host(`${ORO_APP_DOMAIN}`)
- traefik.http.routers.oro5-web-https.entrypoints=https
- traefik.http.routers.oro5-web-https.tls=true

php-fpm-app:
build:
Expand All @@ -45,6 +48,7 @@ services:
# Ensure that host.docker.internal is correctly defined on Linux
- host.docker.internal:host-gateway
- gally.local:host-gateway
- gally.connector.local:host-gateway
volumes:
- root_home:/root

Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
"focus-visible": "5.2.0",
"fullcalendar": "3.4.0",
"fuse.js": "6.6.2",
"fusioncharts": "^4.1.2",
"grapesjs": "0.20.1",
"grapesjs-parser-postcss": "1.0.1",
"grapesjs-plugin-export": "1.0.11",
Expand Down

0 comments on commit 36cc982

Please sign in to comment.