Skip to content

Commit

Permalink
setup dev. environment - added compose file and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kiranparajuli589 committed Feb 14, 2022
1 parent 7476c27 commit 4fe8c2f
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 0 deletions.
67 changes: 67 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,70 @@ The account configuration happens in the "Connected accounts" user settings sect
#### Background jobs

To be able to periodically check activity in OpenProject (when "notifications for activity in my work packages" is enabled), you need to choose the "Cron" background job method and set a system cron task calling cron.php as explained in the [documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/background_jobs_configuration.html#cron).

## Development
Develop using docker compose

Requirements:
- Node.js
- Docker, Docker Compose
- OpenProject server instance running in the host machine
- OpenProject Integration app

### Environments
- **APP_DIR**
- description: location where the `integration_openproject` repository is cloned
- default: `./../integration_openproject`

### Start compose
**Note:** If your host has running apache or nginx, you need to stop it before starting the `docker-compose`.

```shell
APP_DIR='/path/to/app' docker-compose up -d
```

After this, you should be able to access nextcloud server at [http://localhost](http://localhost).

### Setup NC server

> **Note:** These steps will only be necessary for the first setup.
#### Fix permissions
User `www-data` should have _write_ permission to modify `apps` & `custom_apps` directories inside the server directory.

```shell
# "integration_openproject_nc" is the name of our nc server container
docker exec integration_openproject_nc chown www-data custom_apps/ -R
```

#### Create admin
For the database, **PostgreSQL** is used with the following credentials:
- **Database:** `nextcloud`
- **User:** `nextcloud`
- **Password:** `nextcloud`

1. browse to [http://localhost](http://localhost)
2. create admin user
3. get an installed NC server

#### Enable integration app
You can browse as admin to the apps center and enable it using the webUI. Or, you can just use the terminal as:

```shell
docker exec --user www-data integration_openproject_nc php occ a:e integration_openproject
```

If you want to allow local remote servers:

```shell
docker exec --user www-data integration_openproject_nc php occ config:system:set allow_local_remote_servers --value 1
```

### Start Developing
Now you can watch for the app code changes using:

```shell
npm run watch
```

... and start developing.
55 changes: 55 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
version: '3.9'

services:
db:
image: postgres:alpine
container_name: integration_openproject_db
restart: always
ports:
- "5433:5432"
volumes:
- db:/var/lib/postgresql/data
environment:
- POSTGRES_DB=nextcloud
- POSTGRES_USER=nextcloud
- POSTGRES_PASSWORD=nextcloud

redis:
image: redis:alpine
container_name: integration_openproject_redis
restart: always
ports:
- "6379:6379"

nextcloud:
image: nextcloud:apache
container_name: integration_openproject_nc
restart: always
network_mode: "host"
volumes:
- nextcloud:/var/www/html
- ${APP_DIR:-./../integration_openproject}:/var/www/html/custom_apps/integration_openproject
environment:
- POSTGRES_HOST=localhost:5433
- REDIS_HOST=localhost
- POSTGRES_DB=nextcloud
- POSTGRES_USER=nextcloud
- POSTGRES_PASSWORD=nextcloud
depends_on:
- db
- redis

cron:
image: nextcloud:apache
container_name: integration_openproject_cron
restart: always
volumes:
- nextcloud:/var/www/html
entrypoint: /cron.sh
depends_on:
- db
- redis

volumes:
db:
nextcloud:

0 comments on commit 4fe8c2f

Please sign in to comment.