Skip to content

Commit

Permalink
refactor: remove assets from repository (#4759)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The assets are no longer embedded in source code: javascript, css, font files. Run `yarn install` then `yarn run production` to recreate them from sources, or download a [release file](https://github.com/monicahq/monica/releases) that contains compiled files.

BREAKING CHANGE: For Heroku users: You'll have to manually go to `Settings` > `Buildpacks` and add buildpack: `nodejs`. See [this doc](https://github.com/monicahq/monica/blob/master/docs/installation/providers/heroku.md#update-from-2x-to-3x).

BREAKING CHANGE: See more information about how to install a Monica instance [here](https://github.com/monicahq/monica/tree/master/docs/installation).
  • Loading branch information
asbiin authored Apr 30, 2021
1 parent 4fce445 commit 570dde1
Show file tree
Hide file tree
Showing 56 changed files with 140 additions and 3,178 deletions.
38 changes: 22 additions & 16 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
/vendor
/resources/vendor
.scannerwork/
/node_modules
/public/storage
/persist
Homestead.yaml
Homestead.json
.env
cypress.env.json
/public/css
/public/fonts
/public/hot
/public/js
/public/storage
/public/mix-manifest.json
/resources/vendor
/results
/storage/oauth-private.key
/storage/oauth-public.key
.DS_Store
npm-debug.log*
/results
.deploy.json
yarn-error.log
/tests/cypress/screenshots
/tests/cypress/videos
php-extensions-*.tar.bz2
monicadump.sql
.scannerwork/
.phpunit.result.cache
/vendor
.composer
.env
.deploy.json
.DS_Store
.idea
.phpunit.result.cache
.sentry-release
cypress.env.json
Homestead.yaml
Homestead.json
monicadump.sql
npm-debug.log*
php-extensions-*.tar.bz2
yarn-error.log
10 changes: 9 additions & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
"relationship",
"PRM"
],
"buildpacks": [
{
"url": "heroku/php"
},
{
"url": "heroku/nodejs"
}
],
"addons": [
{
"plan": "jawsdb:kitefin"
Expand All @@ -23,7 +31,7 @@
},
"env": {
"APP_KEY": {
"description": "Please change this to a 32-character string. For example run `pwgen -s 32 1` and copy/paste the value.",
"description": "Please change this to a 32-character string. For example run `echo -n 'base64:'; openssl rand -base64 32` and copy/paste the value.",
"value": "change-me-to-a-random-string----"
},
"APP_URL": {
Expand Down
8 changes: 6 additions & 2 deletions docs/installation/providers/cpanel.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ You should check out a tagged version of Monica since `master` branch may not al

```sh
cd /var/www/monica
# Get latest tags from GitHub
git fetch
# Clone the desired version
git checkout tags/v2.18.0
```

Expand All @@ -97,8 +100,9 @@ Open the cPanel file manager and navigate to the directory in which you want to
- set the `APP_ENV` variable to `production`, `local` is only used for the development version. Beware: setting `APP_ENV` to `production` will force HTTPS. Skip this if you're running Monica locally.
3. Log into the cPanel server via SSH and navigate to the directory in which you want to install Monica.
4. Run `composer install --no-interaction --no-dev` to install all packages.
5. Run `php artisan key:generate` to generate an application key. This will set `APP_KEY` with the right value automatically.
6. Run `php artisan setup:production -v` to run the migrations, seed the database and symlink folders.
5. Run `yarn install` to install frontend packages, then `yarn run production` to build the assets (js, css).
6. Run `php artisan key:generate` to generate an application key. This will set `APP_KEY` with the right value automatically.
7. Run `php artisan setup:production -v` to run the migrations, seed the database and symlink folders.

The `setup:production` command will run migrations scripts for database, and flush all cache for config, route, and view, as an optimization process.
As the configuration of the application is cached, any update on the `.env` file will not be detected after that. You may have to run `php artisan config:cache` manually after every update of `.env` file.
Expand Down
32 changes: 25 additions & 7 deletions docs/installation/providers/debian.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Monica depends on the following:
- [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
- PHP 7.4+
- [Composer](https://getcomposer.org/)
- [Node.js](https://nodejs.org)
- [Yarn](https://yarnpkg.com)
- MySQL / MariaDB

An editor like vim or nano should be useful too.
Expand Down Expand Up @@ -53,6 +55,19 @@ sudo apt install -y php php-bcmath php-curl php-gd php-gmp php-imagick \
sudo apt install -y composer
```

**Node.js:** Install node.js with package manager.

```sh
curl -fsSL https://deb.nodesource.com/setup_14.x | sudo bash -
sudo apt install -y nodejs
```

**Yarn:** Install yarn with npm.

```sh
sudo npm install --global yarn
```

**MariaDB:** Install MariaDB. Note that this only installs the package, but does not setup Mysql. This is done later in the instructions:

```sh
Expand All @@ -77,8 +92,10 @@ Find the latest official version on the [release page](https://github.com/monica

```sh
cd /var/www/monica
# Get latest tags from GitHub
sudo git fetch
# Clone the desired version
sudo git checkout tags/v1.6.2
sudo git checkout tags/v2.18.0
```

### 2. Setup the database
Expand Down Expand Up @@ -125,16 +142,17 @@ exit
`cd /var/www/monica` then run these steps with `sudo`:

1. `cp .env.example .env` to create your own version of all the environment variables needed for the project to work.
1. Update `.env` to your specific needs
2. Update `.env` to your specific needs
- set `DB_USERNAME` and `DB_PASSWORD` with the settings used behind.
- configure a [mailserver](/docs/installation/mail.md) for registration & reminders to work correctly.
- set the `APP_ENV` variable to `production`, `local` is only used for the development version. Beware: setting `APP_ENV` to `production` will force HTTPS. Skip this if you're running Monica locally.
1. Run `composer install --no-interaction --no-dev` to install all packages.
1. Run `php artisan key:generate` to generate an application key. This will set `APP_KEY` with the right value automatically.
1. Run `php artisan setup:production -v` to run the migrations, seed the database and symlink folders.
3. Run `composer install --no-interaction --no-dev` to install all packages.
4. Run `yarn install` to install frontend packages, then `yarn run production` to build the assets (js, css).
5. Run `php artisan key:generate` to generate an application key. This will set `APP_KEY` with the right value automatically.
6. Run `php artisan setup:production -v` to run the migrations, seed the database and symlink folders.
- You can use `email` and `password` parameter to setup a first account directly: `php artisan setup:production --email=your@email.com --password=yourpassword -v`
1. _Optional_: Setup the queues with Redis, Beanstalk or Amazon SQS: see optional instruction of [generic installation](generic.md#setup-queues)
1. _Optional_: Setup the access tokens to use the API follow optional instruction of [generic installation](generic.md#setup-access-tokens)
7. _Optional_: Setup the queues with Redis, Beanstalk or Amazon SQS: see optional instruction of [generic installation](generic.md#setup-queues)
8. _Optional_: Setup the access tokens to use the API follow optional instruction of [generic installation](generic.md#setup-access-tokens)

### 4. Configure cron job

Expand Down
19 changes: 17 additions & 2 deletions docs/installation/providers/generic.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ If you don't want to use Docker, the best way to setup the project is to use the
- [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
- PHP 7.4+
- [Composer](https://getcomposer.org/)
- [Node.js](https://nodejs.org)
- [Yarn](https://yarnpkg.com)
- [MySQL](https://www.mysql.com/)
- Optional: Redis or Beanstalk

Expand Down Expand Up @@ -55,6 +57,15 @@ php composer-setup.php --install-dir=/usr/local/bin/ --filename=composer
php -r "unlink('composer-setup.php');"
```

**Node.js:** Install node.js 14+ minimum


**Yarn:** Install yarn using npm

```sh
npm install --global yarn
```

**Mysql:** Install Mysql 5.7+

### Types of databases
Expand All @@ -78,6 +89,9 @@ You should check out a tagged version of Monica since `master` branch may not al

```sh
cd /var/www/monica
# Get latest tags from GitHub
git fetch
# Clone the desired version
git checkout tags/v2.18.0
```

Expand Down Expand Up @@ -130,8 +144,9 @@ exit
- configure a [mailserver](/docs/installation/mail.md) for registration & reminders to work correctly.
- set the `APP_ENV` variable to `production`, `local` is only used for the development version. Beware: setting `APP_ENV` to `production` will force HTTPS. Skip this if you're running Monica locally.
3. Run `composer install --no-interaction --no-dev` to install all packages.
4. Run `php artisan key:generate` to generate an application key. This will set `APP_KEY` with the right value automatically.
5. Run `php artisan setup:production -v` to run the migrations, seed the database and symlink folders.
4. Run `yarn install` to install frontend packages, then `yarn run production` to build the assets (js, css).
5. Run `php artisan key:generate` to generate an application key. This will set `APP_KEY` with the right value automatically.
6. Run `php artisan setup:production -v` to run the migrations, seed the database and symlink folders.

The `setup:production` command will run migrations scripts for database, and flush all cache for config, route, and view, as an optimization process.
As the configuration of the application is cached, any update on the `.env` file will not be detected after that. You may have to run `php artisan config:cache` manually after every update of `.env` file.
Expand Down
9 changes: 9 additions & 0 deletions docs/installation/providers/heroku.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Monica can be deployed on Heroku using the button below:
- [Optional: Generate a Password grant client for OAuth access](#optional-generate-a-password-grant-client-for-oauth-access)
- [Limitations](#limitations)
- [Updating Heroku instance](#updating-heroku-instance)
- [Update from 2.x to 3.x](#update-from-2x-to-3x)

## Installation

Expand Down Expand Up @@ -126,3 +127,11 @@ You can update your Monica instance to the latest version by cloning the reposit
Clone the Monica repository to your local environment by `git clone https://github.com/monicahq/monica`, and add heroku git repository by `heroku git:remote -a (heroku app name)`. Then, push to heroku by `git push heroku master`. Heroku will build and update the repository, automatically.

See more information about updating Monica (including Heroku-spcific things) [here](https://github.com/monicahq/monica/blob/master/docs/installation/update.md).


## Update from 2.x to 3.x

If you already deployed a 2.x Monica instance, when you will upgrade to 3.x, you will have to manually add `node.js` as a buildpack:
- Go to `Settings`
- Under `Buildpacks`, add a new buildpack, and select `nodejs`
- `heroku/nodejs` will be selected automatically
39 changes: 29 additions & 10 deletions docs/installation/providers/ubuntu.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Monica depends on the following:
- [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
- PHP 7.4+
- [Composer](https://getcomposer.org/)
- [Node.js](https://nodejs.org)
- [Yarn](https://yarnpkg.com)
- [MySQL](https://support.rackspace.com/how-to/installing-mysql-server-on-ubuntu/)

**Apache:** If it doesn't come pre-installed with your server, follow the [instructions here](https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-16-04#step-1-install-apache-and-allow-in-firewall) to setup Apache and config the firewall.
Expand Down Expand Up @@ -53,9 +55,9 @@ Then install php 7.4 with these extensions:

```sh
sudo apt update
sudo apt install -y php7.4 php7.4-bcmath php7.4-cli php7.4-curl php7.4-common php7.4-fpm \
php7.4-gd php7.4-gmp php7.4-imagick php7.4-intl php7.4-json php7.4-mbstring \
php7.4-mysql php7.4-opcache php7.4-redis php7.4-xml php7.4-zip
sudo apt install -y php7.4 php7.4-bcmath php7.4-cli php7.4-curl php7.4-common \
php7.4-fpm php7.4-gd php7.4-gmp php7.4-imagick php7.4-intl php7.4-json \
php7.4-mbstring php7.4-mysql php7.4-opcache php7.4-redis php7.4-xml php7.4-zip
```

**Composer:** After you're done installing PHP, you'll need the [Composer](https://getcomposer.org/download/) dependency manager.
Expand All @@ -69,6 +71,19 @@ rm -f composer-setup.php

(or you can follow instruction on [getcomposer.org](https://getcomposer.org/download/) page)

**Node.js:** Install node.js with package manager.

```sh
curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt install -y nodejs
```

**Yarn:** Install yarn with npm.

```sh
sudo npm install --global yarn
```

**Mysql:** Install Mysql 5.7. Note that this only installs the package, but does not setup Mysql. This is done later in the instructions:

```sh
Expand Down Expand Up @@ -97,7 +112,10 @@ You should check out a tagged version of Monica since `master` branch may not al

```sh
cd /var/www/monica
git checkout tags/v2.2.1
# Get latest tags from GitHub
git fetch
# Clone the desired version
git checkout tags/v2.18.0
```

### 2. Setup the database
Expand Down Expand Up @@ -138,16 +156,17 @@ exit
`cd /var/www/monica` then run these steps:

1. `cp .env.example .env` to create your own version of all the environment variables needed for the project to work.
1. Update `.env` to your specific needs
2. Update `.env` to your specific needs
- set `DB_USERNAME` and `DB_PASSWORD` with the settings used behind.
- configure a [mailserver](/docs/installation/mail.md) for registration & reminders to work correctly.
- set the `APP_ENV` variable to `production`, `local` is only used for the development version. Beware: setting `APP_ENV` to `production` will force HTTPS. Skip this if you're running Monica locally.
1. Run `composer install --no-interaction --no-dev` to install all packages.
1. Run `php artisan key:generate` to generate an application key. This will set `APP_KEY` with the right value automatically.
1. Run `php artisan setup:production -v` to run the migrations, seed the database and symlink folders.
3. Run `composer install --no-interaction --no-dev` to install all packages.
4. Run `yarn install` to install frontend packages, then `yarn run production` to build the assets (js, css).
5. Run `php artisan key:generate` to generate an application key. This will set `APP_KEY` with the right value automatically.
6. Run `php artisan setup:production -v` to run the migrations, seed the database and symlink folders.
- You can use `email` and `password` parameter to setup a first account directly: `php artisan setup:production --email=your@email.com --password=yourpassword -v`
1. _Optional_: Setup the queues with Redis, Beanstalk or Amazon SQS: see optional instruction of [generic installation](generic.md#setup-queues)
1. _Optional_: Setup the access tokens to use the API follow optional instruction of [generic installation](generic.md#setup-access-tokens)
7. _Optional_: Setup the queues with Redis, Beanstalk or Amazon SQS: see optional instruction of [generic installation](generic.md#setup-queues)
8. _Optional_: Setup the access tokens to use the API follow optional instruction of [generic installation](generic.md#setup-access-tokens)

### 4. Configure cron job

Expand Down
15 changes: 8 additions & 7 deletions docs/installation/update.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,27 @@ Monica uses the concept of releases and tries to follow
or if you have installed Monica on your own server, you need to follow the steps below to update it, **every single time**, or you will run into problems.

1. Always make a backup of your data before upgrading.
1. Check that your backup is valid.
1. Read the [release notes](https://github.com/monicahq/monica/blob/master/CHANGELOG.md) to check for breaking changes.
1. Update sources:
2. Check that your backup is valid.
3. Read the [release notes](https://github.com/monicahq/monica/blob/master/CHANGELOG.md) to check for breaking changes.
4. Update sources:
1. Consider check out a tagged version of Monica since `master` branch may not always be stable.
Find the latest official version on the [release page](https://github.com/monicahq/monica/releases)
```sh
# Get latest tags from GitHub
git fetch
# Clone the desired version
git checkout tags/v1.6.2
git checkout tags/v2.18.0
```
1. Or check out `master`
2. Or check out `master`
```sh
git pull origin master
```
1. Update the dependencies of the project:
5. Update the dependencies of the project:
```sh
composer install --no-interaction --no-dev
```
1. Then, run the following command to make the proper update:
6. Run `yarn install` to install frontend packages, then `yarn run production` to build the assets (js, css).
7. Then, run the following command to make the proper update:
```sh
php artisan monica:update --force
```
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"prod": "yarn production",
"production": "mix --production",
"preproduction": "php artisan lang:generate -vvv",
"heroku-postbuild": "yarn run production",
"e2e": "cypress run",
"e2e:chrome": "cypress run --browser chrome",
"e2e:record": "cypress run --record",
Expand All @@ -19,12 +20,12 @@
"inst": "yarn install --frozen-lockfile",
"lint": "eslint --ext .js,.vue *.js .*.js resources/js/",
"lint:cypress": "eslint --ext .js tests/cypress/",
"lint:all": "yarn lint & yarn lint:cypress",
"lint:fix": "yarn lint --fix & yarn lint:cypress --fix",
"lint:all": "yarn run lint & yarn run lint:cypress",
"lint:fix": "yarn run lint --fix & yarn run lint:cypress --fix",
"snyk-protect": "snyk protect",
"prepublish": "yarn run snyk-protect",
"delete:reports": "rm results/cypress/* || true",
"pree2e": "npm run delete:reports",
"pree2e": "yarn run delete:reports",
"migrate": "DB_CONNECTION=testing php artisan migrate:fresh && DB_CONNECTION=testing php artisan db:seed",
"pretest": "yarn run migrate",
"test": "vendor/bin/phpunit",
Expand Down
29 changes: 0 additions & 29 deletions public/css/app-ltr.css

This file was deleted.

29 changes: 0 additions & 29 deletions public/css/app-rtl.css

This file was deleted.

1 change: 0 additions & 1 deletion public/css/stripe.css

This file was deleted.

Binary file not shown.
Loading

0 comments on commit 570dde1

Please sign in to comment.