Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

femiwiki: Rename the names of secrets #872

Merged
merged 3 commits into from
Oct 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docker-femiwiki.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

- name: Edit configuration
run: |
mv development/secret.php.example development/secret.php
mv development/secrets.php.example development/secrets.php
mv dockers/femiwiki/LocalSettings.php development
mv dockers/femiwiki/Hotfix.php development
sed -i -r 's~ghcr\.io\/femiwiki\/femiwiki:.+~ghcr\.io\/femiwiki\/femiwiki:docker-test~' docker-compose.yml
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# secret
# Maybe contains secrets
/development/secret.php
/development/secrets.php
/development/LocalSettings.php
/development/Hotfix.php
/development/analytics-credentials-file.json
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Caddy를 실행할 경우에는 Caddyfile을 `/srv/femiwiki.com/Caddyfile`로
```bash
docker swarm init

cp development/secret.php.example development/secret.php
cp development/secrets.php.example development/secrets.php
cp dockers/mediawiki/LocalSettings.php development/
cp dockers/femiwiki/Hotfix.php development/

Expand Down Expand Up @@ -96,7 +96,7 @@ of the [GNU Affero General Public License v3.0] or any later version. See
[docker swarm]: https://docs.docker.com/engine/swarm/
[docker composer]: https://docs.docker.com/compose/
[femiwiki/ami]: https://github.com/femiwiki/ami
[secret.php]: development/secret.php.example
[secrets.php]: development/secrets.php.example
[how to deploy weekly femiwiki to production]: https://github.com/femiwiki/femiwiki/blob/main/how-to-deploy-weekly-femi-wiki-to-production.md
[php-fpm]: https://php-fpm.org/
[caddy]: https://caddyserver.com/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

// Database settings
$wgDBserver = getenv( 'NOMAD_UPSTREAM_ADDR_mysql' ) ?: 'mysql';
$wgDBuser = 'DB_USERNAME';
$wgDBpassword = 'DB_PASSWORD';
$wgDBserver = getenv( 'WG_DB_SERVER' ) ?: 'mysql';
$wgDBuser = getenv( 'WG_DB_USER' ) ?: 'DB_USERNAME';
$wgDBpassword = getenv( 'WG_DB_PASSWORD' ) ?: 'DB_PASSWORD';

// SMTP Password
$wgSMTP['password'] = 'SMTP_PASSWORD';
Expand Down
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ services:
fastcgi:
image: ghcr.io/femiwiki/femiwiki:latest
volumes:
# Mount secret.php, LocalSettings.php and site-list.xml
# Mount secrets.php, LocalSettings.php and site-list.xml
- ./development:/a:ro
- l18n_cache:/tmp/cache
environment:
Expand All @@ -40,12 +40,12 @@ services:
environment:
- MYSQL_ROOT_PASSWORD=localfemiwikipassword
- MYSQL_DATABASE=femiwiki
- MYSQL_USER=DB_USERNAME # secret.php.example에 적힌 기본값
- MYSQL_PASSWORD=DB_PASSWORD # secret.php.example에 적힌 기본값
- MYSQL_USER=DB_USERNAME # secrets.php.example에 적힌 기본값
- MYSQL_PASSWORD=DB_PASSWORD # secrets.php.example에 적힌 기본값
networks:
default:
aliases:
- DB_HOSTNAME # secret.php.example에 적힌 기본값
- DB_HOSTNAME # secrets.php.example에 적힌 기본값
memcached:
image: memcached:1-alpine

Expand Down
5 changes: 4 additions & 1 deletion dockers/femiwiki/LocalSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,10 @@
//
// Load secret.php
//
require_once '/a/secret.php';
if ( file_exists( '/a/secret.php' ) ) {
require_once '/a/secret.php';
}
require_once '/a/secrets.php';

//
// Overwrite server url
Expand Down
6 changes: 3 additions & 3 deletions dockers/femiwiki/run
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ echo 'Starting Femiwiki ...'
# Run Install.php
if [ -z "${MEDIAWIKI_SKIP_INSTALL:-}" ]; then
echo 'Start installing Mediawiki ...'
DB_HOSTNAME="$(php -r 'require "/a/secret.php"; echo $wgDBserver;')"
DB_USERNAME="$(php -r 'require "/a/secret.php"; echo $wgDBuser;')"
DB_PASSWORD="$(php -r 'require "/a/secret.php"; echo $wgDBpassword;')"
DB_HOSTNAME="$(php -r 'require "/a/secrets.php"; echo $wgDBserver;')"
DB_USERNAME="$(php -r 'require "/a/secrets.php"; echo $wgDBuser;')"
DB_PASSWORD="$(php -r 'require "/a/secrets.php"; echo $wgDBpassword;')"
php /srv/femiwiki.com/maintenance/install.php \
--lang ko \
--scriptpath '/w' \
Expand Down
2 changes: 1 addition & 1 deletion dockers/mediawiki/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ COPY cron/generate-sitemap \
RUN mkdir -p /mediawiki/sitemap &&\
chown www-data:www-data /mediawiki/sitemap

# secret.php should be mounted to '/a/secret.php'
# secrets.php should be mounted to '/a/secrets.php'
VOLUME /a
Loading