Skip to content

Commit 5e4159d

Browse files
authored
Merge pull request #115 from electerious/develop
v1.7.1
2 parents 3f92c59 + c0c92a3 commit 5e4159d

File tree

14 files changed

+608
-365
lines changed

14 files changed

+608
-365
lines changed

Diff for: .github/FUNDING.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
github: electerious
12
custom: ['https://paypal.me/electerious', 'https://www.buymeacoffee.com/electerious']

Diff for: CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [1.7.1] - 2020-05-15
8+
9+
### Added
10+
11+
- Instructions for using Helm (#109, thanks @suda)
12+
- Instructions for using systemd (#112, thanks @LickABrick)
13+
- Instructions on how to update when hosting on Heroku (#107, thanks @ckipp01)
14+
715
## [1.7.0] - 2020-04-19
816

917
### Added

Diff for: README.md

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Get Ackee up and running…
2121

2222
- […with Docker Compose](docs/Get%20started.md#with-docker-compose)
2323
- […with Docker](docs/Get%20started.md#with-docker)
24+
- […with Helm](docs/Get%20started.md#with-helm)
2425
- […without Docker](docs/Get%20started.md#without-docker)
2526
- […with Heroku](docs/Get%20started.md#with-heroku)
2627

@@ -112,3 +113,4 @@ I am working hard on continuously developing and maintaining Ackee. Please consi
112113
- [Ackee-PHP](https://github.com/BrookeDot/ackee-php) - A PHP Class for Ackee
113114
- [use-ackee](https://github.com/electerious/use-ackee) - Use Ackee in React
114115
- [nuxt-ackee](https://github.com/bdrtsky/nuxt-ackee) - Nuxt.js module for Ackee
116+
- [django-ackee-middleware](https://github.com/suda/django-ackee-middleware) - Django middleware for Ackee

Diff for: docs/Get started.md

+45-7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
- [With Docker Compose](#with-docker-compose)
44
- [With Docker](#with-docker)
5+
- [With Helm](#with-helm)
56
- [Without Docker](#without-docker)
67
- [With Heroku](#with-heroku)
78

@@ -22,7 +23,7 @@ Only those two are required to run Ackee with the existing `docker-compose.yml`.
2223

2324
Run this command in the root of the project to use the predefined `docker-compose.yml`. It contains everything you need, including MongoDB and Ackee.
2425

25-
```
26+
```sh
2627
docker-compose up
2728
```
2829

@@ -45,13 +46,13 @@ Ackee now runs on port `3000` and is only accessible from you local network. It'
4546

4647
Ackee requires a running MongoDB instance. The easiest way to install MongoDB is by using [Docker](https://www.docker.com). Skip this step if you have MongoDB installed or visit the [website of MongoDB](https://www.mongodb.com) for alternative setups.
4748

48-
```
49+
```sh
4950
docker run -p 27017:27017 --name mongo mongo
5051
```
5152

5253
For persistent storage, mount a host directory to the container directory `/data/db`, which is identified as a potential mount point in the mongo Dockerfile. When starting a new container, Docker will use the volume of the previous container and copy it to the new container, ensuring that no data gets lost.
5354

54-
```
55+
```sh
5556
docker run -p 27017:27017 -v /path/to/local/folder:/data/db --name mongo mongo
5657
```
5758

@@ -66,7 +67,7 @@ Explanation:
6667

6768
### 2. Run Ackee
6869

69-
```
70+
```sh
7071
docker run -p 3000:3000 -e ACKEE_MONGODB='mongodb://mongo:27017/ackee' -e ACKEE_USERNAME='username' -e ACKEE_PASSWORD='password' --link mongo --name ackee electerious/ackee
7172
```
7273

@@ -91,6 +92,22 @@ Ackee now runs on port `3000` and is only accessible from you local network. It'
9192
- [SSL and HTTPS](SSL%20and%20HTTPS.md)
9293
- [CORS headers](CORS%20headers.md)
9394

95+
## With Helm
96+
97+
### 1. Create `values.yaml`
98+
99+
Based on the [default `values.yaml`](https://github.com/suda/ackee-chart/blob/master/values.yaml) create your own with overrides as needed.
100+
101+
### 2. Deploy with `helm`
102+
103+
```
104+
helm repo add ackee https://raw.githubusercontent.com/suda/ackee-chart/master
105+
helm repo update
106+
helm install ackee-release ackee/ackee-chart -n ackee -f values.yaml
107+
```
108+
109+
If you're using the `ingress-nginx`, enabling the ingress will set the necessary annotations to enable CORS.
110+
94111
## Without Docker
95112

96113
### 1. Install dependencies
@@ -123,15 +140,15 @@ The username and password variables are used to secure your Ackee interface/API.
123140

124141
Install all required dependencies.
125142

126-
```
143+
```sh
127144
yarn
128145
```
129146

130147
### 4. Run Ackee
131148

132149
Ackee will output the URL it's listening on once the server is running. Visit the URL with your browser and complete the finial steps using the interface.
133150

134-
```
151+
```sh
135152
yarn start
136153
```
137154

@@ -152,4 +169,25 @@ Simply deploy to Heroku by clicking this button:
152169

153170
### 2. Configure Ackee
154171

155-
Ensure that you're using the correct CORS headers by setting [`ACKEE_ALLOW_ORIGIN`](CORS%20headers.md#heroku-or-platforms-as-a-service-configuration).
172+
Ensure that you're using the correct CORS headers by setting [`ACKEE_ALLOW_ORIGIN`](CORS%20headers.md#heroku-or-platforms-as-a-service-configuration).
173+
174+
### 3. Updating Ackee
175+
176+
The easiest way to update Ackee once hosted on Heroku is to clone the repo down, pull the latest changes from Ackee, and then push them back up to Heroku. You'll need the Heroku CLI and Git for this to work.
177+
178+
In your application view, you'll find instructions under the `Deploy` tab on how to clone down the project. It should look something like below:
179+
180+
```sh
181+
heroku login
182+
heroku git:clone -a <your ackee applicaton name>
183+
```
184+
185+
You'll then want to add the Ackee repo as origin, pull the latest changes, and push it back up to Heroku.
186+
187+
```sh
188+
git remote add origin https://github.com/electerious/Ackee.git
189+
git pull origin master
190+
git push origin heroku master
191+
```
192+
193+
After your application re-deploys you'll have the latest version of Ackee!

Diff for: docs/Systemd.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Systemd
2+
3+
This guide shows you how to configure Ackee with systemd. We assume that your Ackee is located and installed in `/opt/Ackee`.
4+
5+
## 1. Make Ackee executable
6+
7+
Make the `index.js` executable with `chmod +x /opt/Ackee/src/index.js`.
8+
9+
## 2. Create the service
10+
11+
Create a file named `ackee.service` in `/etc/systemd/system/`.
12+
13+
```
14+
[Unit]
15+
Description=Ackee
16+
17+
[Service]
18+
ExecStart=/opt/Ackee/src/index.js
19+
Restart=always
20+
User=nobody
21+
Group=nogroup
22+
Environment=PATH=/usr/bin:/usr/local/bin
23+
Environment=NODE_ENV=production
24+
WorkingDirectory=/opt/Ackee
25+
26+
[Install]
27+
WantedBy=multi-user.target
28+
```
29+
30+
# 3. Start the service
31+
32+
Start the service with `systemctl start ackee.service` and check if everything is up and running with `systemctl status ackee.service`.
33+
34+
# 4. Enable the service
35+
36+
Enable the service on boot with `systemctl enable ackee.service`.

Diff for: package.json

+17-16
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "ackee",
33
"private": true,
4-
"version": "1.7.0",
4+
"version": "1.7.1",
55
"authors": [
66
"Tobias Reich <[email protected]>"
77
],
@@ -19,8 +19,8 @@
1919
"url": "https://github.com/electerious/Ackee.git"
2020
},
2121
"funding": {
22-
"type" : "paypal",
23-
"url" : "https://paypal.me/electerious"
22+
"type": "paypal",
23+
"url": "https://paypal.me/electerious"
2424
},
2525
"scripts": {
2626
"start": "node src/index.js",
@@ -34,18 +34,18 @@
3434
"extends": "@electerious/eslint-config"
3535
},
3636
"dependencies": {
37-
"@babel/core": "^7.9.0",
38-
"@babel/preset-env": "^7.9.5",
37+
"@babel/core": "^7.9.6",
38+
"@babel/preset-env": "^7.9.6",
3939
"ackee-tracker": "^3.2.3",
4040
"classnames": "^2.2.6",
41-
"date-fns": "^2.12.0",
41+
"date-fns": "^2.13.0",
4242
"dotenv": "^8.2.0",
4343
"formbase": "^12.0.1",
44-
"immer": "^6.0.3",
44+
"immer": "^6.0.5",
4545
"is-url": "^1.2.4",
4646
"micro": "^9.3.4",
4747
"microrouter": "^3.1.3",
48-
"mongoose": "^5.9.7",
48+
"mongoose": "^5.9.13",
4949
"node-fetch": "^2.6.0",
5050
"node-schedule": "^1.3.2",
5151
"normalize-url": "^5.0.0",
@@ -54,9 +54,10 @@
5454
"prop-types": "^15.7.2",
5555
"react": "^16.13.1",
5656
"react-dom": "^16.13.1",
57-
"react-error-boundary": "^1.2.5",
57+
"react-error-boundary": "^2.2.1",
58+
"react-fast-compare": "^3.1.1",
5859
"react-redux": "^7.2.0",
59-
"react-use": "^14.1.0",
60+
"react-use": "^14.2.0",
6061
"redux": "^4.0.5",
6162
"redux-devtools-extension": "^2.13.8",
6263
"redux-thunk": "^2.3.0",
@@ -66,16 +67,16 @@
6667
"s-ago": "^2.1.0",
6768
"shortid": "^2.2.15",
6869
"signale": "^1.4.0",
69-
"uuid": "^7.0.3"
70+
"uuid": "^8.0.0"
7071
},
7172
"devDependencies": {
72-
"@electerious/eslint-config": "^1.3.2",
73-
"ava": "3.6.0",
74-
"coveralls": "^3.0.11",
75-
"eslint": "^6.8.0",
73+
"@electerious/eslint-config": "^1.3.4",
74+
"ava": "3.8.2",
75+
"coveralls": "^3.1.0",
76+
"eslint": "^7.0.0",
7677
"eslint-plugin-import": "^2.20.2",
7778
"eslint-plugin-react": "^7.19.0",
78-
"eslint-plugin-react-hooks": "^3.0.0",
79+
"eslint-plugin-react-hooks": "^4.0.0",
7980
"eslint-plugin-react-native": "^3.8.1",
8081
"mocked-env": "^1.3.2",
8182
"nodemon": "^2.0.3",

Diff for: src/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/usr/bin/env node
12
'use strict'
23

34
require('dotenv').config()
@@ -59,4 +60,4 @@ mongoose.connect(dbUrl, {
5960
signale.fatal(err)
6061
process.exit(1)
6162

62-
})
63+
})

Diff for: src/ui/scripts/components/Context.js

+10-14
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,23 @@ import PropTypes from 'prop-types'
44
import classNames from 'classnames'
55
import { useClickAway } from 'react-use'
66

7-
import runWhenDefined from '../utils/runWhenDefined'
87
import useMeasure from '../utils/useMeasure'
98

109
export const BUTTON = Symbol()
1110
export const SEPARATOR = Symbol()
1211

12+
const toPixel = (num) => `${ Math.round(num) }px`
13+
1314
const Context = (props) => {
1415

1516
const ref = useRef()
16-
const measurement = useMeasure(props.targetRef)
17+
const measurement = useMeasure(props.targetRef, ref)
1718

1819
useClickAway(ref, props.onAwayClick, [ 'click' ])
1920

21+
const x = measurement == null ? undefined : toPixel(props.x(measurement))
22+
const y = measurement == null ? undefined : toPixel(props.y(measurement))
23+
2024
return createPortal(
2125
h('div', {
2226
ref,
@@ -26,12 +30,8 @@ const Context = (props) => {
2630
'visible': measurement != null
2731
}),
2832
style: {
29-
'--top': runWhenDefined(props.top, measurement),
30-
'--right': runWhenDefined(props.right, measurement),
31-
'--bottom': runWhenDefined(props.bottom, measurement),
32-
'--left': runWhenDefined(props.left, measurement),
33-
'--x': props.x,
34-
'--y': props.y
33+
'--x': x,
34+
'--y': y
3535
}
3636
},
3737
props.items.map((item, index) => {
@@ -68,12 +68,8 @@ Context.propTypes = {
6868
targetRef: PropTypes.shape({
6969
current: PropTypes.instanceOf(Element)
7070
}),
71-
top: PropTypes.func,
72-
right: PropTypes.func,
73-
bottom: PropTypes.func,
74-
left: PropTypes.func,
75-
x: PropTypes.string,
76-
y: PropTypes.string,
71+
x: PropTypes.func.isRequired,
72+
y: PropTypes.func.isRequired,
7773
floating: PropTypes.bool,
7874
items: PropTypes.arrayOf(PropTypes.object).isRequired,
7975
onItemClick: PropTypes.func.isRequired,

Diff for: src/ui/scripts/components/Filter.js

+14-5
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,18 @@ const labels = {
6060
[languages.LANGUAGES_SORTING_RECENT]: 'Recent'
6161
}
6262

63+
const calculateX = (measurement) => {
64+
65+
return measurement.target.relative.x + measurement.target.width / 2 - measurement.element.width / 2
66+
67+
}
68+
69+
const calculateY = (measurement) => {
70+
71+
return measurement.target.relative.y - measurement.element.height - 10
72+
73+
}
74+
6375
const FilterItem = (props) => {
6476

6577
const ref = useRef()
@@ -82,11 +94,8 @@ const FilterItem = (props) => {
8294
),
8395
active === true && h(Context, {
8496
targetRef: ref,
85-
// Manually calculated works better on mobile when element is sticky to the bottom
86-
bottom: () => `calc(4vh + 51px)`,
87-
left: (measurement) => `${ measurement.left + measurement.width / 2 }px`,
88-
x: '-50%',
89-
y: '-10px',
97+
x: calculateX,
98+
y: calculateY,
9099
floating: true,
91100
items: props.items,
92101
onItemClick: close,

Diff for: src/ui/scripts/components/Header.js

+19-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,23 @@ import IconArrowDown from './icons/IconArrowDown'
88
const BUTTON = Symbol()
99
const DROPDOWN = Symbol()
1010

11+
const calculateX = (measurement) => {
12+
13+
return Math.min(
14+
// Ensure that the context stays on the screen
15+
measurement.body.width - measurement.element.width - 10,
16+
// Ensure that the context is pinned to the target
17+
measurement.target.absolute.x + measurement.target.width - measurement.element.width
18+
)
19+
20+
}
21+
22+
const calculateY = (measurement) => {
23+
24+
return measurement.target.absolute.y + measurement.target.height + 10
25+
26+
}
27+
1128
const Spinner = (props) => {
1229

1330
return (
@@ -80,9 +97,8 @@ const Dropdown = (props) => {
8097
),
8198
active === true && h(Context, {
8299
targetRef: ref,
83-
top: (measurement) => `${ measurement.bottom - measurement.scrollY }px`,
84-
right: (measurement) => `${ Math.max(10, measurement.scrollWidth - measurement.right) }px`,
85-
y: '10px',
100+
x: calculateX,
101+
y: calculateY,
86102
items: props.items,
87103
onItemClick: close,
88104
onAwayClick: close

0 commit comments

Comments
 (0)