Compare commits
28 Commits
Release_23
...
develop
Author | SHA1 | Date | |
---|---|---|---|
9b2ffa8b2c | |||
9bafc52626 | |||
18ddaa1da4 | |||
be2105a284 | |||
5481cc67a0 | |||
a547fbb631 | |||
0e3f943f1e | |||
ec42479304 | |||
dbb7c1c0fc | |||
410bba4966 | |||
17aee22400 | |||
aaf220dce2 | |||
276a289ca7 | |||
e684365612 | |||
105cc96963 | |||
bdd62aadf5 | |||
390c13608a | |||
345cf31bb3 | |||
c7f5ea0d85 | |||
fc6141e2b9 | |||
5049a01d2a | |||
45d0c9fa80 | |||
1e4b982430 | |||
0a7d248a3e | |||
2177dfd893 | |||
173b50fa6c | |||
d7338b84d3 | |||
0216861579 |
43
Jenkinsfile
vendored
43
Jenkinsfile
vendored
@ -62,23 +62,42 @@ pipeline {
|
||||
}
|
||||
}
|
||||
|
||||
stage('Release Docker image') {
|
||||
stage('Prepare Docker release') {
|
||||
environment {
|
||||
COMPOSER_HOME="${WORKSPACE}/.composer"
|
||||
npm_config_cache="${WORKSPACE}/.npm"
|
||||
}
|
||||
agent {
|
||||
dockerfile {
|
||||
filename 'docker/Dockerfile'
|
||||
dir '.'
|
||||
additionalBuildArgs '--target mapg_base'
|
||||
reuseNode true
|
||||
}
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
sh script: 'git clean -ffdx', label: 'Clean repository'
|
||||
env.VERSION = sh(script: 'git describe --tags --always --match "Release_*" HEAD', returnStdout: true).trim()
|
||||
sh script: 'docker/scripts/release.sh', label: 'Release script'
|
||||
sh script: "rm -rf ${env.COMPOSER_HOME} ${env.npm_config_cache}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def version = sh(script: 'git describe --tags --always --match "Release_*" HEAD', returnStdout: true).trim()
|
||||
def imageUrl = "git.esoko.eu/esoko/mapguesser:${version}"
|
||||
|
||||
sh script: """docker buildx build \
|
||||
-t ${imageUrl} \
|
||||
-f docker/Dockerfile \
|
||||
--target mapg_release \
|
||||
.""",
|
||||
label: 'Build Docker image'
|
||||
|
||||
stage('Release Docker image') {
|
||||
steps {
|
||||
script {
|
||||
withDockerRegistry([credentialsId: 'gitea-system-user', url: 'https://git.esoko.eu/']) {
|
||||
sh script: "docker push ${imageUrl}", label: 'Push Docker image to registry'
|
||||
sh script: 'docker buildx create --use --bootstrap --platform=linux/arm64,linux/amd64 --name multi-platform-builder'
|
||||
sh script: """docker buildx build \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
-f docker/Dockerfile \
|
||||
--target mapg_release \
|
||||
-t git.esoko.eu/esoko/mapguesser:${env.VERSION} \
|
||||
--push \
|
||||
.""",
|
||||
label: 'Build Docker image'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,11 +10,10 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"esoko/soko-web": "0.14",
|
||||
"fzaninotto/faker": "^1.9"
|
||||
"esoko/soko-web": "0.15"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9.6",
|
||||
"phpunit/phpunit": "^10.3",
|
||||
"phpstan/phpstan": "^1.10"
|
||||
},
|
||||
"autoload": {
|
||||
|
900
composer.lock
generated
900
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -1 +0,0 @@
|
||||
<?php //empty on purpose
|
@ -1,9 +1,9 @@
|
||||
FROM ubuntu:focal AS mapg_base
|
||||
FROM ubuntu:22.04 AS mapg_base
|
||||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
RUN apt update --fix-missing && apt install -y curl git unzip mariadb-client nginx \
|
||||
php-apcu php7.4-cli php7.4-curl php7.4-fpm php7.4-mbstring php7.4-mysql php7.4-zip php7.4-xml
|
||||
RUN apt update --fix-missing && apt install -y sudo curl git unzip mariadb-client nginx \
|
||||
php-apcu php8.1-cli php8.1-curl php8.1-fpm php8.1-mbstring php8.1-mysql php8.1-zip php8.1-xml
|
||||
|
||||
RUN mkdir -p /run/php
|
||||
COPY docker/configs/nginx.conf /etc/nginx/sites-available/default
|
||||
@ -20,9 +20,9 @@ FROM mapg_base AS mapg_dev
|
||||
|
||||
RUN apt update --fix-missing && apt install -y php-xdebug
|
||||
|
||||
RUN echo "xdebug.remote_enable = 1" >> /etc/php/7.4/mods-available/xdebug.ini &&\
|
||||
echo "xdebug.remote_autostart = 1" >> /etc/php/7.4/mods-available/xdebug.ini &&\
|
||||
echo "xdebug.remote_connect_back = 1" >> /etc/php/7.4/mods-available/xdebug.ini
|
||||
RUN echo "xdebug.remote_enable = 1" >> /etc/php/8.1/mods-available/xdebug.ini &&\
|
||||
echo "xdebug.remote_autostart = 1" >> /etc/php/8.1/mods-available/xdebug.ini &&\
|
||||
echo "xdebug.remote_connect_back = 1" >> /etc/php/8.1/mods-available/xdebug.ini
|
||||
|
||||
EXPOSE 80
|
||||
EXPOSE 5000
|
||||
@ -30,14 +30,14 @@ EXPOSE 8090
|
||||
EXPOSE 9229
|
||||
ENTRYPOINT docker/scripts/entry-point-dev.sh
|
||||
|
||||
|
||||
FROM mapg_base AS mapg_release
|
||||
|
||||
RUN apt update --fix-missing && apt install -y cron
|
||||
|
||||
WORKDIR /var/www/mapguesser
|
||||
COPY ./ /var/www/mapguesser
|
||||
RUN docker/scripts/release.sh &&\
|
||||
rm -rf /var/www/mapguesser/.git /var/www/mapguesser/.env
|
||||
RUN rm -rf /var/www/mapguesser/.git
|
||||
|
||||
EXPOSE 80
|
||||
EXPOSE 8090
|
||||
|
@ -18,7 +18,7 @@ server {
|
||||
|
||||
location ~ \.php$ {
|
||||
include snippets/fastcgi-php.conf;
|
||||
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
|
||||
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
|
||||
fastcgi_param REQUEST_SCHEME $forwarded_scheme;
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
set -e
|
||||
|
||||
chmod 777 cache
|
||||
|
||||
echo "Installing Composer packages..."
|
||||
if [ -f .env ]; then
|
||||
composer install
|
||||
@ -20,11 +18,22 @@ echo "Installing Yarn packages..."
|
||||
echo "Migrating DB..."
|
||||
./mapg db:migrate
|
||||
|
||||
echo "Set runner user based on owner of .env..."
|
||||
if ! getent group mapg; then
|
||||
USER_GID=$(stat -c "%g" .env)
|
||||
groupadd --gid $USER_GID mapg
|
||||
fi
|
||||
if ! id -u mapg; then
|
||||
USER_UID=$(stat -c "%u" .env)
|
||||
useradd --uid $USER_UID --gid $USER_GID mapg
|
||||
fi
|
||||
sed -i -e "s/^user = .*$/user = mapg/g" -e "s/^group = .*$/group = mapg/g" /etc/php/8.1/fpm/pool.d/www.conf
|
||||
|
||||
set +e
|
||||
|
||||
/usr/sbin/php-fpm7.4 -F &
|
||||
/usr/sbin/php-fpm8.1 -F &
|
||||
/usr/sbin/nginx -g 'daemon off;' &
|
||||
/usr/bin/node --inspect=0.0.0.0:9229 multi &
|
||||
sudo -u mapg -g mapg /usr/bin/node --inspect=0.0.0.0:9229 multi &
|
||||
|
||||
wait -n
|
||||
|
||||
|
@ -8,12 +8,24 @@ echo "Migrating DB..."
|
||||
echo "Installing crontab..."
|
||||
/usr/bin/crontab docker/scripts/cron
|
||||
|
||||
echo "Set runner user based on owner of .env..."
|
||||
if ! getent group mapg; then
|
||||
USER_GID=$(stat -c "%g" .env)
|
||||
groupadd --gid $USER_GID mapg
|
||||
fi
|
||||
if ! id -u mapg; then
|
||||
USER_UID=$(stat -c "%u" .env)
|
||||
useradd --uid $USER_UID --gid $USER_GID mapg
|
||||
fi
|
||||
chown mapg:mapg cache
|
||||
sed -i -e "s/^user = .*$/user = mapg/g" -e "s/^group = .*$/group = mapg/g" /etc/php/8.1/fpm/pool.d/www.conf
|
||||
|
||||
set +e
|
||||
|
||||
/usr/sbin/cron -f &
|
||||
/usr/sbin/php-fpm7.4 -F &
|
||||
/usr/sbin/php-fpm8.1 -F &
|
||||
/usr/sbin/nginx -g 'daemon off;' &
|
||||
/usr/bin/node multi &
|
||||
sudo -u mapg -g mapg /usr/bin/node multi &
|
||||
|
||||
wait -n
|
||||
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
set -e
|
||||
|
||||
chmod 777 cache
|
||||
|
||||
echo "Installing Composer packages..."
|
||||
composer create-project --no-dev
|
||||
|
||||
@ -28,3 +26,5 @@ find public/static/img -type f -iname '*.svg' -exec svgo {} -o {} \;
|
||||
|
||||
echo "Linking view files..."
|
||||
./mapg view:link
|
||||
|
||||
rm .env
|
||||
|
38
multi/package-lock.json
generated
38
multi/package-lock.json
generated
@ -1,17 +1,43 @@
|
||||
{
|
||||
"name": "mapguesser-multi",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"lockfileVersion": 1,
|
||||
"dependencies": {
|
||||
"dotenv": {
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "mapguesser-multi",
|
||||
"license": "GNU AGPL 3.0",
|
||||
"dependencies": {
|
||||
"dotenv": "^8.2.0",
|
||||
"ws": "^7.4.4"
|
||||
}
|
||||
},
|
||||
"node_modules/dotenv": {
|
||||
"version": "8.2.0",
|
||||
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz",
|
||||
"integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw=="
|
||||
"integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"ws": {
|
||||
"node_modules/ws": {
|
||||
"version": "7.4.4",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-7.4.4.tgz",
|
||||
"integrity": "sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw=="
|
||||
"integrity": "sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw==",
|
||||
"engines": {
|
||||
"node": ">=8.3.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"bufferutil": "^4.0.1",
|
||||
"utf-8-validate": "^5.0.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"bufferutil": {
|
||||
"optional": true
|
||||
},
|
||||
"utf-8-validate": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -376,7 +376,7 @@ header>p>span {
|
||||
padding-left: 6px;
|
||||
}
|
||||
|
||||
header>p>span>a:link, header>p>span>a:visited {
|
||||
header>p>span>a:link, header>p>span>a:visited, footer>p>a:link, footer>p>a:visited {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
|
@ -81,13 +81,11 @@ class LoginController
|
||||
|
||||
if (\Container::$request->session()->has('tmp_user_data')) {
|
||||
$tmpUserData = \Container::$request->session()->get('tmp_user_data');
|
||||
|
||||
$data = ['email' => $tmpUserData['email']];
|
||||
} else {
|
||||
$data = [];
|
||||
$tmpUserData = [];
|
||||
}
|
||||
|
||||
return new HtmlContent('login/signup', $data);
|
||||
return new HtmlContent('login/signup', $tmpUserData);
|
||||
}
|
||||
|
||||
public function getSignupSuccess()
|
||||
@ -159,6 +157,13 @@ class LoginController
|
||||
return new JsonContent(['success' => true]);
|
||||
}
|
||||
|
||||
if (
|
||||
filter_var(\Container::$request->post('email'), FILTER_VALIDATE_EMAIL) === false &&
|
||||
preg_match('/^[a-zA-Z0-9_\-\.]+$/', \Container::$request->post('email')) !== 1
|
||||
) {
|
||||
return new JsonContent(['error' => ['errorText' => 'This is not a valid email address or username.']]);
|
||||
}
|
||||
|
||||
$user = $this->userRepository->getByEmailOrUsername(\Container::$request->post('email'));
|
||||
|
||||
if ($user === null) {
|
||||
@ -173,10 +178,14 @@ class LoginController
|
||||
$tmpUser = new User();
|
||||
$tmpUser->setPlainPassword(\Container::$request->post('password'));
|
||||
|
||||
\Container::$request->session()->set('tmp_user_data', [
|
||||
'email' => \Container::$request->post('email'),
|
||||
'password_hashed' => $tmpUser->getPassword()
|
||||
]);
|
||||
$tmpUserData = ['password_hashed' => $tmpUser->getPassword()];
|
||||
if (filter_var(\Container::$request->post('email'), FILTER_VALIDATE_EMAIL) === false) {
|
||||
$tmpUserData['username'] = \Container::$request->post('email');
|
||||
} else {
|
||||
$tmpUserData['email'] = \Container::$request->post('email');
|
||||
}
|
||||
|
||||
\Container::$request->session()->set('tmp_user_data', $tmpUserData);
|
||||
|
||||
return new JsonContent([
|
||||
'redirect' => [
|
||||
@ -498,6 +507,13 @@ class LoginController
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
filter_var(\Container::$request->post('email'), FILTER_VALIDATE_EMAIL) === false &&
|
||||
preg_match('/^[a-zA-Z0-9_\-\.]+$/', \Container::$request->post('email')) !== 1
|
||||
) {
|
||||
return new JsonContent(['error' => ['errorText' => 'This is not a valid email address or username.']]);
|
||||
}
|
||||
|
||||
$user = $this->userRepository->getByEmailOrUsername(\Container::$request->post('email'));
|
||||
|
||||
if ($user === null) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
<h2>Login</h2>
|
||||
<div class="box">
|
||||
<form id="loginForm" action="/login" method="post" data-redirect-on-success="<?= $redirectUrl ?>">
|
||||
<input type="email" class="text big fullWidth" name="email" placeholder="Email address / username" autocomplete="username" required autofocus>
|
||||
<input type="text" class="text big fullWidth" name="email" placeholder="Email address / username" autocomplete="username" required autofocus>
|
||||
<input type="password" class="text big fullWidth marginTop" name="password" placeholder="Password" autocomplete="current-password" required minlength="6">
|
||||
<p id="loginFormError" class="formError justify marginTop"></p>
|
||||
<div class="right marginTop">
|
||||
|
@ -6,7 +6,7 @@
|
||||
<h2>Request password reset</h2>
|
||||
<div class="box">
|
||||
<form id="passwordResetForm" action="/password/requestReset" method="post" data-redirect-on-success="/password/requestReset/success">
|
||||
<input type="email" class="text big fullWidth" name="email" placeholder="Email address / username" autocomplete="username" value="<?= isset($email) ? $email : '' ?>" required autofocus>
|
||||
<input type="text" class="text big fullWidth" name="email" placeholder="Email address / username" autocomplete="username" value="<?= isset($email) ? $email : '' ?>" required autofocus>
|
||||
<?php if (!empty($_ENV['RECAPTCHA_SITEKEY'])): ?>
|
||||
<div class="marginTop">
|
||||
<div class="g-recaptcha" data-sitekey="<?= $_ENV['RECAPTCHA_SITEKEY'] ?>"></div>
|
||||
|
@ -7,16 +7,25 @@
|
||||
<h2>Sign up</h2>
|
||||
<div class="box">
|
||||
<form id="signupForm" action="/signup" method="post" data-redirect-on-success="/signup/success">
|
||||
<?php if (isset($email)): ?>
|
||||
<?php if (isset($email) || isset($username)): ?>
|
||||
<p class="justify">No user found with the given email address / username. Sign up with one click!</p>
|
||||
<input type="email" class="text big fullWidth marginTop" name="email" placeholder="Email address" autocomplete="username" value="<?= $email ?>" required>
|
||||
<input type="password" class="text big fullWidth marginTop" name="password" placeholder="Password confirmation" autocomplete="new-password" required minlength="6" autofocus>
|
||||
<?php if (isset($email)): ?>
|
||||
<input type="email" class="text big fullWidth marginTop" name="email" placeholder="Email address" autocomplete="username" value="<?= $email ?>" required>
|
||||
<?php else: ?>
|
||||
<input type="email" class="text big fullWidth marginTop" name="email" placeholder="Email address" autocomplete="username" required autofocus>
|
||||
<?php endif; ?>
|
||||
<?php if (isset($username)): ?>
|
||||
<input type="username" class="text big fullWidth marginTop" name="username" placeholder="Username" value="<?= $username ?>">
|
||||
<?php else: ?>
|
||||
<input type="username" class="text big fullWidth marginTop" name="username" placeholder="Username" autofocus>
|
||||
<?php endif; ?>
|
||||
<input type="password" class="text big fullWidth marginTop" name="password" placeholder="Password confirmation" autocomplete="new-password" required minlength="6">
|
||||
<?php else: ?>
|
||||
<input type="email" class="text big fullWidth" name="email" placeholder="Email address" autocomplete="username" required autofocus>
|
||||
<input type="username" class="text big fullWidth marginTop" name="username" placeholder="Username">
|
||||
<input type="password" class="text big fullWidth marginTop" name="password" placeholder="Password" autocomplete="new-password" required minlength="6">
|
||||
<input type="password" class="text big fullWidth marginTop" name="password_confirm" placeholder="Password confirmation" autocomplete="new-password" minlength="6">
|
||||
<?php endif; ?>
|
||||
<input type="username" class="text big fullWidth marginTop" name="username" placeholder="Username">
|
||||
<?php if (!empty($_ENV['RECAPTCHA_SITEKEY'])): ?>
|
||||
<div class="marginTop">
|
||||
<div class="g-recaptcha" data-sitekey="<?= $_ENV['RECAPTCHA_SITEKEY'] ?>"></div>
|
||||
|
@ -29,6 +29,6 @@
|
||||
</main>
|
||||
<footer>
|
||||
<p><span class="bold"><?= $_ENV['APP_NAME'] ?></span> <?= str_replace('Release_', '', VERSION) ?></p><!--
|
||||
--><p>© The MapGuesser Contributors <?= (new DateTime(REVISION_DATE))->format('Y') ?></p>
|
||||
--><p>© The <a href="https://git.esoko.eu/esoko/mapguesser" target="_blank">MapGuesser</a> Contributors <?= (new DateTime(REVISION_DATE))->format('Y') ?></p>
|
||||
</footer>
|
||||
@endsection
|
||||
|
Loading…
Reference in New Issue
Block a user