Skip to content

Commit

Permalink
Release v2.0.0 (#532)
Browse files Browse the repository at this point in the history
* [Admin]: CAES-1225: Fix docker build

* [Admin]: CAES-1225: Fix docker build

* [Admin]: CAES-1222: Separated lists admin to two single pages

* [Admin]: CAES-1222: Fixed admin login (#400)

* [Admin]: CAES-1221: Added filters to admin

* [Admin]: CAES-1221: Upgrade composer

* [Admin]: CAES-1240: Added items page to admin.

* [Admin]: CAES-1237: Rename form field.

* [Admin]: CAES-1243, CAES-1240, CAES-1221: Remove extra buttons, fixed filters, refactoring.

* [Admin]: CAES-1242: Change page titles

* [Admin]: CAES-1241: Fixed sort associated field.

* [Admin]: CAES-1246: Fixed error message and changed format.

* [Admin]: CAES-1246: Fixed error message and changed format.

* [Admin]: CAES-1244: Removed extra columns, add count users of team column.

* [2FA]: CAES-1248: Rework fingerprint, refactoring.

* [Composer]: CAES-1251: Update composer packages

* [Composer]: CAES-1251: Update composer packages

* Pin dependencies (#392)

Co-authored-by: Renovate Bot <[email protected]>

* [Composer]: CAES-1251: Fixed OPTIONS error, readme (#410)

* [Composer]: CAES-1251: Fixed OPTIONS error, readme

* [Composer]: CAES-1251: Fixed 2FA check path

* [Composer]: CAES-1251: Added docs to API

* [Composer]: CAES-1251: Fixed composer install

* [Composer]: CAES-1251: Composer update

* [Composer]: CAES-1256: Added validation to edit team

* [Refactoring]: CAES-1255: Refactoring rabbitmq.

* [Refactoring]: CAES-1265: Setting default list while create item without listId.

* [List]: CAES-1267: Fixed validation while create list.

* [Refactoring]: CAES-1268: Refactoring update item.

* [Refactoring]: CAES-1268: Refactoring update item.

* [Item]: CAES-1272: Implemented validation relatedItem

* [Item]: CAES-1273: Cascade remove after remove system item from admin.

* [Item]: CAES-1275: Implemented endpoint to leave team.

* [Item]: CAES-1277: Changed items view.

* [Item]: CAES-1277: Changed items view.

* [Item]: CAES-1277: Some fixes views.

* [Item]: CAES-1237: Resolved conflicts

* [Admin]: CAES-1282: Fixed edit team error.

* [Admin]: CAES-1306: Fixed user search

* A few improvements

Signed-off-by: Aleksandr Beshkenadze <[email protected]>

* [Item]: CAES-1015: Fixed create item.

* [Composer]: Composer update

* [Team] CAES-1301: Auto adding domain admin to teams.

* [Team] CAES-1301: Fixed tests

* [Team] CAES-1287: Show all teams to anyone user.

* Update dependency phpstan/phpstan to v0.12.47 (#439)

Co-authored-by: Renovate Bot <[email protected]>

* [Admin] CAES-1311: Fixed editing team from admin.

* [Admin] CAES-1311: Set renovate/* bratch to drone build after create

* [User] CAES-1312: Set default hash length if not exists env

* [User] CAES-1311: Disable test remove personal system item

* [Test] CAES-1311: Fixed tests

* [Test] CAES-1311: Fixed tests

* [Item] CAES-1284: Add ownerId

* [Item] CAES-1284: Add ownerId to create or edit item.

* [Item] CAES-1284: Added type keypair

* [Item] CAES-1284: Added type keypair, rework workflow

* [Item] CAES-1284: Validate unique keypair on team

* [Item] CAES-1284: Validate unique keypair on team

* [Item] CAES-1284: Cs-fixer

* [User] CAES-1301: Reverted, added filter by role to endpoint of get all users.

* [User] CAES-1284: Rename view keys.

* Update dependency nelmio/api-doc-bundle to v3.7.4

* [User] CAES-1283: Fixed type of list for personal lists

* [Item] CAES-1284: Added teamId to ItemView

* [Team] CAES-1324: Should not remove default team

* Blazinf fast the dev env in a container

Signed-off-by: Aleksandr Beshkenadze <[email protected]>

* [Team] CAES-1284: Rework workflow, permissions

* [Team] CAES-1323: Added pinned toggle to team

* Update TeamRepository.php

Refactoring

* [Team] CAES-1325: Implemented endpoint to create team and keypair together.

* [Lists] CAES-1327: Fixed relationship default lists

* [Security] CAES-1328: Refactoring backup codes.

* [Security] CAES-1328: Refactoring backup codes.

* [Security] CAES-1334: Remove extra types.

* [List] CAES-1337: Refactoring list view.

* [Form] CAES-1334: Refactoring form error.

* [Form] CAES-1334: cs-fixer fix

* [Form] CAES-1334: Refactoring

* [Admin] CAES-1327: Excluded lists from admin tables.

* [Form] CAES-1334: Refactoring create and edit item form.

* [Refactoring] CAES-1335: Remove extra endpoints.

* [Refactoring] CAES-1335: Refactoring create invited user.

* [Refactoring] CAES-1335: Refactoring create invited user.

* [Refactoring] CAES-1336: Refactoring child_item and sharing.

* [Team] CAES-1349: Added team pinned route to HATEOS

* [Item] CAES-1351: Implemented endpoints to get keypairs

* [Team] CAES-1355: Reworked add member, implemented batch add members to team

* [Team] CAES-1355: Refactoring

* [Team] CAES-1355: Refactoring

* [Team] CAES-1358: Refactoring endpoint pin to team

* [Composer] Composer update

* [Form] CAES-1359: Refactoring (#470)

* [Form] CAES-1359: Refactoring move item form

* [Form] CAES-1359: Refactoring structure

* [Form] CAES-1359: Refactoring structure events

* [Team] CAES-1364: Fixed show team keypairs

* [Team] CAES-1361: Fixed validate create team with keypair.

* [Item] CAES-1365: Fixed validate create personal keypairs. (#475)

* [Team] CAES-1366: Added team leave to hateos

* [User] CAES-1374: Added hateoas to user team view (#478)

* [User] CAES-1359: Refactoring update user keys form. (#477)

* [Item] CAES-1375: Implemented endpoint to create keypair to user while sharing (#479)

* @aburov-4xxi [Item] CAES-1375: Added share route to hateoas. (#480)

* [Item] CAES-1375: Implemented endpoint to create keypair to user while sharing

* [Item] CAES-1375: Added share route to hateoas.

* [Item] CAES-1377: Added hateoas to share team item.

* [Item] CAES-1379: Added public key to view of search user.

* [User] CAES-1385: Added domain filter to get users endpoint.

* [User] CAES-1388: Implemented new manager role to user.

* [Item] CAES-1389: Override label to inbox list and listId to share item. (#489)

* [Team] CAES-1323: Inversion default toggle. (#490)

* [Team] CAES-1323: Inversion default toggle.

* [Team] CAES-1323: Fixed tests

Co-authored-by: Aleksandr Beshkenadze <[email protected]>

* [Form] CAES-1359: Refactoring form

* [2FA] CAES-1391: Implemented accept save backup codes after reset 2fa.

* [2FA] CAES-1391: Refactoring.

* [Item] CAES-1392: Implemented title field to item.

* [Team] CAES-1388: Fixed manager access to team

* [Form] CAES-1359: Refactoring form.

* [Item] CAES-1395: Fixed hateos for create item to inbox list.

* [Team] CAES-1398: Fixed leave team by admin.

* [Composer] Update composer.

* [Composer] Update composer.

* [Composer] CAES-1400: Fixed srp prepare login. (#500)

* [2fa] CAES-1400: Fixed 2fa (#501)

* [Composer] CAES-1400: Fixed srp prepare login.

* [Composer] CAES-1400: Fixed 2fa

* [User] CAES-1402: Fixed views of user and member

* [Form] CAES-1359: Form refactoring, removed create team endpoint.

* [Team] CAES-1404: Disable toggle if admin leave team

* [Team] CAES-1408: Implemented filter to get members without keypairs.

* [User] CAES-1402: Fixed self user view.

* [User] CAES-1402: Refactoring.

* [Team] CAES-1402: Refactoring.

* [Team] CAES-1402: Rename userRole to teamRole

* [Team] CAES-1402: Refactoring view.

* [User] CAES-1429: Fixed validate registration.

* [Team] CAES-1435: Fixed permission to manager

* [Team] CAES-1445: Implemented query filters to get all items, refactoring.

* [Item] CAES-1411: Implemented endpoint to create keypairs for team. (#508)

* [Item] CAES-1411: Implemented endpoint to create keypairs for team.

* [Item] CAES-1411: Refactoring.

* [Team] CAES-1411: Added validation to create team keypair.

* [Test] CAES-1407: Refactoring tests. (#524)

* [Test] CAES-1407: Refactoring tests.

* [Test] CAES-1407: Fix composer

* [Access] CAES-1424: Rework access to domain admin.

* [Access] CAES-1424: Fix tests

* [Access] CAES-1447: Fixed team view.

* [Item] CAES-1452: Implemented get batch items endpoint.

* Add the local vscode settings

Signed-off-by: Aleksandr Beshkenadze <[email protected]>

* [User] CAES-1458: Rename roles to domainRoles to create user

* [Item] CAES-1484: Overriding favorite shared item. (#529)

* [Item] CAES-1483: Refresh last item to keypairs.

* [Item] CAES-1486: Fixed anon access to endpoints.

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: Aleksandr Beshkenadze <[email protected]>
Co-authored-by: Aleksandr Beshkenadze <[email protected]>
  • Loading branch information
5 people authored Nov 16, 2020
1 parent 1406760 commit 25f44f0
Show file tree
Hide file tree
Showing 585 changed files with 32,387 additions and 16,541 deletions.
3 changes: 1 addition & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
.rancher-pipeline.yml
./*.md
./*.yml
!./codeception.yml
!./codeception.dist.yml
phpunit.xml.dist
Dockerfile
docker-compose.yml
README.md
.env.*
.env
vendor/*
var/cache/*
Expand Down
6 changes: 3 additions & 3 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@ steps:
when:
branch: [ develop ]

- <<: *stepMasterDeploy
when:
branch: [ master ]
#- <<: *stepMasterDeploy
# when:
# branch: [ master ]

- <<: *stepNotifyToSlack
when:
Expand Down
19 changes: 15 additions & 4 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ APP_SECRET=
BACKUP_CODE_SALT=
INVITATION_SALT=
JWT_PASSPHRASE=
CORS_ALLOW_ORIGIN=*

#### Google Authentication (OAuth2)
GOOGLE_ID=
Expand All @@ -48,7 +49,7 @@ MAILER_PASSWORD=
## Optional variables
#### App environment
#APP_NAME='Caesar App'
#BACKUP_CODE_HASH_LENGTH=10
BACKUP_CODE_HASH_LENGTH=10
#TRUSTED_PROXIES=127.0.0.1,127.0.0.2
#TRUSTED_HOSTS=localhost,example.com
#[email protected]
Expand All @@ -58,11 +59,11 @@ MAILER_PASSWORD=
#JWT_PUBLIC_KEY=var/jwt/private.pem=
#JWT_SECRET_KEY=var/jwt/private.pem=
#### When registering, a user with such an email will be assigned as admin
#DOMAIN_ADMIN_EMAIL=
DOMAIN_ADMIN_EMAIL=

#### Redis version 5.0.4
#REDIS_HOST=redis
#REDIS_PORT=6379
REDIS_HOST=redis
REDIS_PORT=6379

#### Test Data Base Configuration
#TEST_POSTGRES_DB=test
Expand All @@ -75,3 +76,13 @@ MAILER_PASSWORD=
## DevPresets
SERVER_HTTP_PORT=80
DATABASE_PORT=5432

#### Json RPC
JSON_RPC_SECRET=

# Two weeks in seconds
FINGERPRINT_LIFETIME=1209600

###> symfony/messenger ###
MESSENGER_TRANSPORT_DSN=amqp://${RABBITMQ_DEFAULT_USER}:${RABBITMQ_DEFAULT_PASS}@${RABBITMQ_HOST}:5672/%2f/messages?connection_timeout=1&lazy=true
###< symfony/messenger ###
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea
docker-compose.override.yml

###> symfony/framework-bundle ###
.env
Expand Down Expand Up @@ -33,4 +34,7 @@ yarn-error.log

###> tests ###
!/tests/_envs
###< tests ###
codeception.yml
###< tests ###
src/.preload.php
.vscode/settings.json
12 changes: 7 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ RUN apk --update add \
gpgme \
libzip-dev \
postgresql-dev \
rabbitmq-c \
rabbitmq-c-dev \
zip

RUN docker-php-ext-install \
Expand All @@ -24,11 +26,11 @@ RUN docker-php-ext-install \
zip \
sockets

RUN pecl install gnupg redis \
&& docker-php-ext-enable redis
RUN pecl install gnupg redis amqp \
&& docker-php-ext-enable redis amqp

# Composer part
COPY --from=composer /usr/bin/composer /usr/bin/composer
COPY --from=composer:1 /usr/bin/composer /usr/bin/composer
ENV COMPOSER_MEMORY_LIMIT -1
# ENV COMPOSER_ALLOW_SUPERUSER 1
RUN composer global require hirak/prestissimo --prefer-dist --no-progress --no-suggest --optimize-autoloader --no-interaction --no-plugins --no-scripts
Expand Down Expand Up @@ -61,7 +63,7 @@ COPY tests/_scripts/init_db.sh /usr/local/bin
COPY tests/_scripts/wait-for-it.sh /usr/local/bin

COPY . .
RUN composer install
RUN APP_ENV=test composer install
RUN vendor/bin/php-cs-fixer fix --config=.php_cs.dist -v --dry-run --using-cache=no

RUN bash init_db.sh postgres & wait-for-it.sh 127.0.0.1:5432 -- echo "postgres is up" \
Expand All @@ -71,7 +73,7 @@ RUN bash init_db.sh postgres & wait-for-it.sh 127.0.0.1:5432 -- echo "postgres i
&& vendor/bin/codecept run api

## ---- Webpack Encore ----
FROM node:8-alpine AS yarn-enc
FROM node:10-alpine AS yarn-enc
COPY . .
RUN yarn install && yarn encore production
## ---- Dependencies ----
Expand Down
53 changes: 26 additions & 27 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# ---- Base Image ----
FROM php:7.4-fpm-alpine AS base
RUN mkdir -p /var/www/html /var/www/html/public/static /var/www/html/var/cache /var/www/html/var/logs /var/www/html/var/sessions && chown -R www-data /var/www/html
# Set working directory
WORKDIR /var/www/html

ARG UID=1000
ARG GID=1000
RUN apk --update add \
build-base \
autoconf \
Expand All @@ -13,22 +13,29 @@ RUN apk --update add \
gpgme \
libzip-dev \
postgresql-dev \
zip

RUN docker-php-ext-install \
rabbitmq-c \
rabbitmq-c-dev \
zip \
shadow \
\
&& docker-php-ext-install -j$(nproc) \
intl \
bcmath\
opcache \
pdo \
pdo_pgsql \
zip \
sockets

RUN pecl install gnupg redis \
&& docker-php-ext-enable redis
sockets \
\
&& pecl install gnupg redis amqp \
&& docker-php-ext-enable redis amqp \
\
&& usermod -u $UID www-data

RUN mkdir -p /var/www/html /var/www/html/vendor /var/www/html/public/static /var/www/html/var/cache /var/www/html/var/log /var/www/html/var/sessions /var/www/html/var/jwt \
&& chown -R www-data /var/www/html /var/www/html/vendor /var/www/html/var/cache /var/www/html/var/jwt
# Composer part
COPY --from=composer /usr/bin/composer /usr/bin/composer
COPY --from=composer:1 /usr/bin/composer /usr/bin/composer
ENV COMPOSER_MEMORY_LIMIT -1
# ENV COMPOSER_ALLOW_SUPERUSER 1
RUN composer global require hirak/prestissimo --prefer-dist --no-progress --no-suggest --optimize-autoloader --no-interaction --no-plugins --no-scripts
Expand All @@ -39,8 +46,6 @@ ENV APP_ENV=prod
COPY composer.json .
COPY composer.lock .



ARG XDEBUG_REMOTE_HOST=172.17.0.1
ARG XDEBUG_REMOTE_ENABLE=1
ARG XDEBUG_REMOTE_AUTOSTART=1
Expand All @@ -65,26 +70,20 @@ RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS coreutils \
&& echo "xdebug.max_nesting_level=9999" >> /usr/local/etc/php/conf.d/xdebug.ini \
&& apk del .build-deps

FROM node:8-alpine AS yarn-enc
## ---- Webpack Encore ----
FROM node:lts-alpine AS yarn-enc
COPY . .
RUN yarn install && yarn encore production
# ---- Dependencies ----
FROM base AS dependencies
# install vendors
USER www-data
RUN APP_ENV=prod composer install --prefer-dist --no-plugins --no-scripts --no-dev --optimize-autoloader

# ---- Release ----
FROM base AS release
EXPOSE 9000
USER www-data
# copy production vendors
COPY --chown=www-data:www-data . .
COPY --chown=www-data:www-data --from=dependencies /var/www/html/vendor /var/www/html/vendor
COPY --from=yarn-enc ./public/build /var/www/html/public/build
WORKDIR /var/www/html
COPY --chown=www-data:www-data src src
COPY --chown=www-data:www-data --from=yarn-enc ./public/build /var/www/html/public/build
COPY ./config/docker/php/symfony.ini /usr/local/etc/php/conf.d
# COPY ./config/docker/php/symfony.pool.conf /usr/local/etc/php-fpm.d/
COPY --chown=www-data:www-data entrypoint.sh /usr/local/bin/
RUN php bin/console assets:install public
COPY bin/fix-permissions.sh /usr/local/bin/
COPY entrypoint.sh /usr/local/bin/
USER www-data
# expose port and define CMD
EXPOSE 9000
ENTRYPOINT ["entrypoint.sh"]
109 changes: 78 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,103 @@
Caesar
==========
# Caesar.Team server application

Here you can find all information needed to istall and run the Caesar.Team server appliction on your own.

Feel free to visit our [Homepage](https://github.com/caesar-team/caesar.team)

## Requirements

* [Docker and Docker Compose](https://docs.docker.com/engine/installation)
* [MacOS Only]: Docker Sync (run `gem install docker-sync` to install it)
- [Docker and Docker Compose](https://docs.docker.com/engine/installation)
- [MacOS Only]: Docker Sync (run `gem install docker-sync` to install it)

## Stack

- PHP 7.4
- PostgreSQL 9
- RabbitMQ 3
- Redis 5

## Installation

### 1. Start Containers and install dependencies
On Linux:
### 1. Update .env:

- Create a config file .env by .env.dist

```bash
cp .env.dist .env
```

- Fill required values by instruction inside .env
- Set DOMAIN_ADMIN_EMAIL this email used for registration domain admin

### 2. Generate the RSA keys for JWT:

```bash
mkdir -p var/jwt
openssl genrsa -out var/jwt/private.pem -aes256 4096
openssl rsa -pubout -in var/jwt/private.pem -out var/jwt/public.pem
```

Update JWT_PASSPHRASE setting in .env file

### 3. Start Containers and install dependencies

On Linux/Windows:

```bash
docker-compose up -d
```

On MacOS:

```bash
docker-sync-stack start
```

### 2. Update .env:
- Create a config file .env by .env.dist
- Fill required values by instruction inside .env
### 4. Install vendors

### 3. Install vendors
```bash
docker-compose exec php composer install
```

### 4. Run migrations, install fixtures
### 5. Run migrations, install required default fixtures

```bash
docker-compose exec php bin/console doctrine:migrations:migrate
docker-compose exec php bin/console doctrine:fixtures:load
```

### 5. Generate the SSH keys for JWT:
### 6. Access to the admin panel:

Create and promote super admin user:

```bash
mkdir -p var/jwt
openssl genrsa -out var/jwt/private.pem -aes256 4096
openssl rsa -pubout -in var/jwt/private.pem -out var/jwt/public.pem
docker-compose exec php bin/console app:user:create [email protected] [email protected] password --super-admin
```

Update JWT_PASSPHRASE setting in .env file
Promote an existing user:

```bash
docker-compose exec php bin/console fos:user:promote --super username ROLE_ADMIN
```

Available roles:

- ROLE_ADMIN
- ROLE_READ_ONLY_USER
- ROLE_SUPER_ADMIN

### 7. Open project

### 6. Open project
Just go to [http://localhost](http://localhost)

#### Run tests:
### 8. Open API DOC

Auth by admin and go to [http://localhost/api/doc](http://localhost/api/doc)

## Tests

Run migrations

```bash
docker-compose exec php bin/console doctrine:migrations:migrate --env=test
```
Expand All @@ -57,23 +108,19 @@ docker-compose exec php bin/codecept run unit
docker-compose exec php bin/codecept run api
```

#### Access to the admin panel:
Create and promote admin user: `bin/console app:user:create`
## Contribution

Promote an existing user: `bin/console fos:user:promote`

Available roles:
- ROLE_ADMIN
- ROLE_READ_ONLY_USER
- ROLE_SUPER_ADMIN
#### PHP Static Analysis Tool

Ex: `bin/console fos:user:promote username ROLE_ADMIN`
```bash
docker-compose exec php vendor/bin/phpstan analyse
docker-compose exec php vendor/bin/psalm --show-info=false
```

### 7. Contribution
#### Coding standard

#### PHP Static Analysis Tool
Using php-cs-fixer

```bash
docker-compose exec php vendor/bin/phpstan analyse
docker-compose exec php vendor/bin/psalm --show-info=false
docker-compose exec php vendor/bin/php-cs-fixer fix
```
Loading

0 comments on commit 25f44f0

Please sign in to comment.