怎样安装指定版本PostgreSQL

2018年8月9日 由 Amon 没有评论 »

参考:https://www.jb51.net/article/104829.htm

【安装(编译)】

以安装PostgreSQL v8.1.23为例:

wget https://ftp.postgresql.org/pub/source/v8.1.23/postgresql-8.1.23.tar.gz && tar zxvf postgresql-8.1.23.tar.gz && cd postgresql-8.1.23
./configure --prefix=/usr/local/pgsql --disable-debug –enable-thread-safety

如果你需要编译PostgreSQL的JDBC支持的话,必须拥有一个JDK, Apache Ant工具,设定了JAVA_HOME和ANT_HOME环境变量,然后再配置的时候使用–with-java来配置,如果设置正确的话,PostgreSQL的JDBC驱动将出现在$prefix/share/java下面。

比如:

JAVA_HOME=/opt/j2sdk
ANT_HOME=/opt/ant

PostgreSQL的配置脚本可以接受很多的参数,这些参数用来告诉configure脚本哪些特性要编译,哪些特性不需要,具体的参数信息的说明可以通过执行./configure –help来得到。
下面解释一下上面配置命令的参数的意义。

1. –prefix=/opt/pgsql :用来决定编译后的PostgreSQL程序安装的根目录,当make完成之后,make install将把程序安装到/opt/pgsql下面,并在下面建立相应的目录来存放程序的可执行文件,开发库,头文件等目录,象下面这样:bin doc include lib man share

2. –disable-debug :告诉configure脚本在执行编译的时候不要编译调试信息,当然这个选项不是控制是否生成用来进行代码跟踪的调试信息,而是控制在程序执行过程中不要输出那些用来调试的信息。这样可以提高程序的运行效率。如果想编译一个优化的不包括用来进行代码跟踪的调试信息的版本,你需要在执行你的configure脚本的时候,设定你的CFLAGS,CXXFLAGS,CPPFLAGS等环境变量,使其不包括-g选项。而使用-O2,或者-O3来代替。

3. –enable-thread-safe 选项告诉configure脚本用来编译线程安全的客户库。

当配置脚本执行完之后,我们就可以执行make来真正的构建PostgreSQL数据库服务器。

执行:

make

当make结束之后,如果出现了下面的内容,那么表示你选择的特性已经被正确的编译完成了。

All of PostgreSQL successfully made. Ready to install.

接下来:

make install

完成之后:

PostgreSQL installation complete.

安装已经成功完成。

察看安装目录下面的目录结构,可以看到bin doc include lib man share这样的目录。

1. bin下面,存放了用来执行一些PostgreSQL服务或者相关操作的命令。
2. doc下面安装的是随PostgreSQL发布的文档,使用的是html格式,从7.4版本开始,PostgreSQL的文档被合并到了一个大的文档,而不是以前那种分成各种不同手册的形式。
3. include下面包含的是用C/C++开发PostgreSQL应用程序要使用的头文件。
4. lib下面存放的是运行PostgreSQL数据库服务器或者相关工具所需要的库文件。
5. man下面是相关命令或者工具的手册页。
6. share下面存放的是一些公共的数据,如果你编译了PostgreSQL的JDBC支持,那么这里面就会有一个java目录,里面会有postgresql.jar文件,是PostgreSQL的JDBC驱动程序。

PostgreSQL的初始配置

在成功的安装了数据库之后,我们需要作一些初始化工作,这样我们才能正常的启动数据库服务器,开发我们的数据库应用。

首先我们要设置PATH,因为我们的程序没有安装到已有的PATH的下面,所以我们需要添加 $prefix/bin 到系统的 PATH 中,这样我们的程序就可以直接使用相应的文件。但是光添加了路径,我们的程序在运行的时候还不能找到所需要的库,所以我们需要修改系统查找的库路径的信息。在Linux下面,这可以通过两种方式来实现,一是修改环境变量LD_LIBRARY_PATH,这样我们就可以在/etc/profile里面添加一句:

export LD_LIBRARY_PATH=/opt/pgsql/lib:$LD_LIBRARY_PATH

。或者我们可以使用另外一种方式,将PostgreSQL的库路径添加到 /etc/ld.so.conf 文件里面,然后执行一下 ldconfig 命令,这样系统就会创建在这个文件总所有路径下面的库的信息缓存,当系统需要寻找系统的库的时候,会首先找到这个缓存,然后就可以定位到正确的路径来装载所需的运行库。

另外,如果我们希望能使用man来查询手册页,那么还需要设置MANPATH这个环境变量,这样我们就可以直接通过man psql来查询psql这个命令怎么使用了。你可以在系统级的脚本上修改这个环境变量,或者也可以在你自己用户目录下的启动脚本来修改这个环境变量,使用下面的命令就可以了

export MANPATH=/opt/pgsql/man:$MANPATH

PostgreSQL建议用户使用一个单独的用户帐号来运行PostgreSQL的服务器,一般推荐postgres用户,因为在很多脚本里面都使用了这个用户帐号。所以接下来我们要创建postgres用户。根据你系统的文档找出合适的添加用户的方法。

/usr/sbin/useradd postgres
passwd postgres

设置postgres用户的密码,在后面讲到启动和停止数据库服务器的时候会使用到这个密码。所以一定要记住。在你修改了数据库的某些配置之后,如果你想重新启动数据库,启动脚本会问你这个密码。

一般情况下我们希望PostgreSQL能把数据库文件放在一个独立的位置,而不是postgres用户的主目录。(当然我们也可以让他们使用同一个目录)。接下来我们创建一个目录用来存放PostgreSQL的数据库文件和PostgreSQL服务起运行时所产生的文件,在下面的例子中我们把这个目录放到/var/lib下面,并且命名为pgsql/data,执行下面的命令来创建这个目录:

mkdir -p /var/lib/pgsql/data

创建了目录之后,因为这个目录要被postgres用户使用,所以我们改变这个目录的权限,把它的所属权改为postgres,执行命令

chown postgres /var/lib/pgsql/data。

在完成了上面的步骤之后,我们就可以执行initdb命令来初始化PostgreSQL服务器的设置,执行下面的命令:

su - postgres //切换到postgres用户来执行下面的命令。
initdb -D /var/lib/pgsql/data

输出结果如下:

The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale zh_CN.GB18030.

fixing permissions on existing directory /var/lib/pgsql/data/... ok
creating directory /var/lib/pgsql/data//base... ok
creating directory /var/lib/pgsql/data//global... ok
creating directory /var/lib/pgsql/data//pg_xlog... ok
creating directory /var/lib/pgsql/data//pg_clog... ok
selecting default max_connections... 100
selecting default shared_buffers... 1000
creating configuration files... ok
creating template1 database in /var/lib/pgsql/data//base/1... ok
initializing pg_shadow... ok
enabling unlimited row size for system tables... ok
initializing pg_depend... ok
creating system views... ok
loading pg_description... ok
creating conversions... ok
setting privileges on built-in objects... ok
creating information schema... ok
vacuuming database template1... ok
copying template1 to template0... ok

Success. You can now start the database server using:

/opt/pgsql/bin/postmaster -D /var/lib/pgsql/data/
or
/opt/pgsql/bin/pg_ctl -D /var/lib/pgsql/data/ -l logfile start

我们可以看到在成功的初始话数据库之后,这个命令同时提供了启动数据库服务器的方法,接下来我们使用pg_ctl方法来启动数据库服务器了。

/opt/pgsql/bin/pg_ctl -D /var/lib/pgsql/data/ -l logfile start

如果成功启动了数据库服务器,通过

ps -aux

输出:

postgres 1426 0.0 0.3 18580 1796 pts/1 S 14:57 0:00 /opt/pgsql/bin/postmaster -D /var/lib/pgsql/data
postgres 1429 0.0 0.3 9380 1584 pts/1 S 14:57 0:00 postgres: stats buffer process
postgres 1430 0.0 0.3 8528 1624 pts/1 S 14:57 0:00 postgres: stats collector process

使用下面的命令停止数据库服务器进程:

/opt/pgsql/bin/pg_ctl -D /var/lib/pgsql/data/ -l logfile stop

使用脚本来使数据库服务器随系统启动而自动启动。在PostgreSQL的源码包的contrib/start-scripts目录下面我们可以看到freebsd linux PostgreSQL.darwin StartupParameters.plist.darwin 4个文件,这些文件时用来作为系统启动脚本的,在这里我们用linux来做说明。

在这里的操作使用你编译PostgreSQL数据库时的用户身份。

cd $HOME/src/postgresql-7.4/contrib/start-scripts
su //切换到root用户
cp linux /etc/rc.d/init.d/postgres //把linux改名为postgres拷贝到系统的启动脚本的目录。
cd /etc/rc.d/init.d

使用你熟习的编辑器来编辑postgres启动脚本:

29 ## EDIT FROM HERE
30
31 # Installation prefix
32 prefix=/opt/pgsql
33
34 # Data directory
35 PGDATA="/var/lib/pgsql/data"
36
37 # Who to run pg_ctl as, should be "postgres".
38 PGUSER=postgres
39
40 # Where to keep a log file
41 PGLOG="$PGDATA/serverlog"
42
43 ## STOP EDITING HERE

在这里我们要修改prefix,PGDATA,PGUSER的值,prefix就是我们在configure源码时指定的prefix,PGDATA就是我们initdb命令-D参数指定的路径,PGUSER是我们用来启动数据库服务器的用户。

chmod +x postgres //使脚本具有可执行权限

如果希望在Linux启动的运行级别3的时候自动启动PostgreSQL数据库服务器,以root用户继续执行下面的命令。

cd /etc/rc.d/rc3.d/
ln -sf ../init.d/postgres S25postgres

当然S后面的数值可以根据你的需要来设定,但是这个数值一定要比PostgreSQL服务器依赖的服务器的数值小,比如你希望使用syslog,如果syslog服务是S12,那么postgres的值就要小于S12。

以后我们也可以通过/etc/rc.d/init.d/postgres 来启动和停止数据库服务器,如果你执行这个命令的身份不是root,那么就会问你启动PostgreSQL服务器用户的密码。

到这里我们基本上完成了PostgreSQL数据库服务器的安装和初始化过程。

怎样部署CoCCA

2018年8月9日 由 Amon 没有评论 »

【结论】

貌似http://wiki.cocca.org.nz/不能解析,也就无法获得最新的CoCCA软件包,仅能从Google镜像中恢复说明文档。

经与CoCCA开发方交流,CoCCA目前仅对在IANA注册在案的TLD管理机构开放,而且需要签订商业合同或者公益援助。

CoCCA SRS的负责人 Garth Miller 建议从 FRED 系统入手:

如果你只是出于学习研究的目的,想测试EPP、WHOIS、RDAP等,我建议你试试 https://fred.nic.cz/ 。不少TLD也选择了它作为域名管理系统。

在SourceForge上的CoCCA代码太过陈旧,存在不少RFC合规性问题。并不建议使用它学习或者用于生产环境。新版本的CoCCA几乎完整重写。

结论:为期3天的CoCCA研究告一段落?至少搞定了PostgreSQL/phpPGAdmin。

参考:http://amon.org/fred
参考:http://amon.org/wp-admin/post.php?post=9967&action=edit

【介绍】

CoCCA代表国家代码管理员理事会(Council of County Code Administrators)。CoCCA建立于2004年,是一个互联网基础设施支持公司,由一系列ccTLD管理组织联合组成。

这个我们创建并维护的注册局软件是业内部署最广泛的ccTLD注册局解决方案。目前,CoCCA SRS被用于54个ccTLD和6个gTLD。

CoCCA软件可以托管,或者部署在本地。

CoCCA提供商业化支持,包括培训、托管、数据迁移、失效备援、灾难恢复和投诉解决服务。

【源码】

下载:https://sourceforge.net/projects/coccaopenreg/
版本:最新版本v2.6.16;公开版本v2.2.9

下载:https://wiki.cocca.org.nz/mediawiki/index.php/CoCCA_SRS_Software
版本:最新,但无法访问。

构成:CoCCA注册局开发包 CoCCAtools-v2.2.9.zip
下载:https://master.dl.sourceforge.net/project/coccaopenreg/CoCCA%20Registry%20-%20Stable/V2.2.9/CoCCAtools-v2.2.9.zip

构成:CoCCA注册商开发包 CoCCARegistrarTools-v1.1.2_Production.zip & CoCCARegistrarSRC-v1.1.2.zip & RegistrarInstall_v1.1.2.pdf
下载:https://master.dl.sourceforge.net/project/coccaopenreg/CoCCA%20Registrar%20Package/Registrar_v1.1.2_Production/CoCCARegistrarTools-v1.1.2_Production.zip

【安装】

必要环境

1. PostgreSQL 8.1或更高版本

参考:http://amon.org/postgresql
参考:http://amon.org/phppgadmin

2. java 1.5或更高版本

参考:http://amon.org/java

3. Resin 3.1.1更高版本

参考:http://amon.org/resin

必要环境

wget https://master.dl.sourceforge.net/project/coccaopenreg/CoCCA%20Registry%20-%20Stable/V2.2.9/CoCCAtools-v2.2.9.zip && unzip CoCCAtools-v2.2.9.zip

Notes on Security �

In a production environment the registry should be behind a firewall and the registry database should be on an internal network.

* the firewall should only allow access from a known IP via port 700 and 443 for EPP registrars and 443 only for registrars only using the GUI. A combination hardware appliance and use of the OS firewall is recommended. The database server should only allow connections from the EPP and backup servers.

* registrars using the GUI should be provided with two-factor authentication keys.

Only trusted parties should have access to the registry via secure certificates, trusted IP’s and a user name and password PLUS a two factor authentication for GUI access. If you only grant access to a handful of trusted parties with whom you have an contract or are accredited security is simply addressed. Make sure the client accounts and registry staff have the correct level of access to avoid any accidental bulk changes / deletions.

If you have a registrar that is “hacking” or creating other mischief you really have a problem. We use best practice in designing the code and subscribe to and check all releases against – http://www.scanalert.com/ for known issues or coding flaws.

Automated incremental backups every 10-15 min as well as a full daily backup to a backup server is highly recommended. CoCCA offers an off-site backup server to members if they wish to use this facility. Grabing a “snap shot” each time you do the zone generation is also not a bad idea…

Regularly update the OS and the registry code – Aotea makes updates available once a month or more to members, mostly to add features but also to address any security issues that have been identified.

Database preparation �

1. Create two databases, one for a dns server and one for the main registry functionality. I’ll use epp and pdns for the names respectively. From a terminal window on a *nix system, you can try

createdb epp
createdb pdns

2. Create the pdns role if it doesn’t exist. The SQL statement for this is

create role pdns;

Binary File Installation �
EPP Server �

We assume a directory structure like that in the download. If it is not the same, paths will need to be changed where applicable.

1. Edit the configuration file (CoCCAtools/EPP Server/epp/conf/epp.conf.xml).
1. The db-object-pool element will need to be changed to connect to the database created previously
2. The secure-store element will need to be changed to use your keystore
3. Setup classpath to include all files in the lib directory
4. Start the server (from command line)

java -server -Xmx512m cx.cocca.epp.EppServer conf/epp.conf.xml > log/epp.log

where ‘conf/epp.conf.xml’ is the configuration file and log/epp.log is the log file. We’ve provided a script, CoCCAtools/EPP Server/epp/epp-run.sh, that sets the classpath, starts the server.
2. Web Interface
1. Configure resin to use ssl
1. Create a keystore file. The following command (run from the command line) is sufficient. When asked for your first and last name, give the domain name you will be using for the site.

keytool -genkey -keyalg RSA -keystore server.keystore

2. Add the following to the $RESIN_HOME/conf/resin.conf file. If you are using a basic resin setup, add it beneath the tag. Change the path and password to the location of the server.keystore file you just created and the password you provided while creating the keystore file respectively.




jks
path/server.keystore password

2. Configure the registry application to recognize the epp server’s ssl certificate. You will not need to do this if you’ve replaced the epp server’s keystore with one containing a valid SSL certificate provided by a Certificate Authority (Thawte, Verisign, etc.)
1. Add the following to the $RESIN_HOME/conf/resin.conf file. Add them anywhere beneath the resin tag, but not in a place enclosed by another tag.



edit the path in the second line to wherever the cocca.tools.keystore is located on your machine (“path to CoCCATools”/EPP Server/epp/cert/cocca.tools.keystore)

3. Edit resin.conf file to include database elements similar to the following. You can put these elements inside a specific element (e.g. ), or just before the element.


jdbc/registry

org.postgresql.Driver
jdbc:postgresql://localhost/epp
postgres pass



jdbc/pdns

org.postgresql.Driver
jdbc:postgresql://localhost/pdns
postgres pass

the url, user, and password elements will need to be changed to connect to the databases you’ve setup. The jndi-name elements must be kept the same.
4. add postgres driver to server’s lib directory

cp CoCCAtools/Web\ App/lib/dependencies/postgresql-8.2-506.jdbc3.jar $RESIN_HOME/lib

5. Deploy the provided registry.war file. This can be by placing it in the resin_home/webapps directory.
6. Start Resin
7. Login to the application (at https://localhost/registry/index.jsp … replacing localhost with the name of the server you installed it on). You’ll be asked to give information necessary to running the system. Once that is complete, you’ll be up and running!

If you have questions concerning the changes to the resin.conf file, please look at the sample_resin.conf included in the download. Specifically, look at the lines enclosed by the following:
********************** Begin – required for CoCCATools *****************
… and …
********************** End – required for CoCCATools *******************

【证书】

使用Java的keystore工具生成EPP连接所用的SSL证书

CoCCA使用Java的keystore工具完成SSL部署,证书在Web访问或者EPP访问时都说必须的。

查证:https://epp.whois.ai/login.jsp 使用的证书颁发机构 thawte DV SSL CA – G2.

第一步:创建keystore,生成CSR,发送到证书颁发机构。

用于创建和管理证书的是Java keytool,位于 /opt/cocca-8/java/bin

下载:https://cfhcable.dl.sourceforge.net/project/coccaopenreg/CoCCA%20Registry%20-%20Stable/V2.2.9/CoCCAtools-v2.2.9.zip

We create the keystore and CSR with the following command:(example generate Certificate for .OTE CoCCA)

./keytool -genkey -alias server -keyalg RSA -keysize 2048 -keystore registry_cocca_ote.jks -dname “CN=registry.cocca.ote,OU=Naming and Numbering, O=CoCCA Registry Systems , L=Aculand, ST=Aculand, C=NZ” && ./keytool -certreq -alias server -file registry_cocca_ote.csr -keystore registry_cocca_ote.jks

( create password when prompted – it prompts for 2, use the same for both.. )

Step 2

send the CSR file away for signing, example digicert

Step 3

When the authority sends you files back import the intermediate certificate and the singed certificate for your domain as :

./keytool -import -trustcacerts -alias intermediate -file DigiCertCA.crt -keystore registry_cocca_ote.jks ( enter password )

./keytool -import -trustcacerts -alias server -file registry_cocca_ote.crt -keystore registry_cocca.ote.jks

( enter password ) Copy the keystore to /opt/cocca-8/keys

Step 4

Edit the webserver ( resin ) to point to the new keystore

/opt/cocca-8/resin/conf/resin.xml

look for this section …


jks
/opt/cocca-8/keys/registry_cocca.ote.jks ****** TLSv1,TLSv1.1,TLSv1.2

Stop and Start resin /opt/cocca-8/ctlscript.sh stop resin / start

Step 5

Edit the EPP certificate settings in the CoCCA UI.

Config > EPP

Enter the path and password as appropriate, As the following figure:File:ConfigureEPP.jpg

【参考】

参考:https://wiki.cocca.org.nz/mediawiki/index.php/CoCCA_FAQ
参考:https://wiki.almworks.com/display/kb/How+to+Connect+to+Server+using+SSL+and+Client+Certificate

参考:https://stackoverflow.com/questions/8973880/connect-to-epp-server-with-php-using-ssl
参考:https://stackoverflow.com/questions/42194244/error-connecting-to-epp-server-using-openssl-s-client

源码:随机背景图 PHP实现

2018年8月8日 由 Amon 没有评论 »

参考:http://amon.org/randombg 实证未遂。缺少文件。
参考:http://amon.org/rotatebg ‎实证成功。

【介绍】

参考:https://alistapart.com/article/randomizer
代码:https://alistapart.com/d/randomizer/rotate.txt
演示:https://host.sonspring.com/css-rotator/

【源码】

在存储背景图片的文件夹中创建文件,rotate.php :

<?php

	$folder = '.';
    $extList = array();
	$extList['jpg'] = 'image/jpeg';

$img = null;

if (substr($folder,-1) != '/') {
	$folder = $folder.'/';
}

if (isset($_GET['img'])) {
	$imageInfo = pathinfo($_GET['img']);
	if (
	    isset( $extList[ strtolower( $imageInfo['extension'] ) ] ) &&
        file_exists( $folder.$imageInfo['basename'] )
    ) {
		$img = $folder.$imageInfo['basename'];
	}
} else {
	$fileList = array();
	$handle = opendir($folder);
	while ( false !== ( $file = readdir($handle) ) ) {
		$file_info = pathinfo($file);
		if (
		    isset( $extList[ strtolower( $file_info['extension'] ) ] )
		) {
			$fileList[] = $file;
		}
	}
	closedir($handle);

	if (count($fileList) > 0) {
		$imageNumber = time() % count($fileList);
		$img = $folder.$fileList[$imageNumber];
	}
}

if ($img!=null) {
	$imageInfo = pathinfo($img);
	$contentType = 'Content-type: '.$extList[ $imageInfo['extension'] ];
	header ($contentType);
	readfile($img);
} else {
	if ( function_exists('imagecreate') ) {
		header ("Content-type: image/png");
		$im = @imagecreate (100, 100)
		    or die ("Cannot initialize new GD image stream");
		$background_color = imagecolorallocate ($im, 255, 255, 255);
		$text_color = imagecolorallocate ($im, 0,0,0);
		imagestring ($im, 2, 5, 5,  "IMAGE ERROR", $text_color);
		imagepng ($im);
		imagedestroy($im);
	}
}

?>

【使用】

在页面或者CSS中指向 rotate.php ,页面即可在每次加载时切换不同图片 :

<img src="http://example.com/rotate.php">

如需加载指定图片:

<img src="http://example.com/rotate.php?img=gorilla.jpg">

什么是RRP域名状态

2018年8月7日 由 Amon 没有评论 »

【介绍】

域名状态主要有EPP域名状态和RRP域名状态两种版本。

EPP域名状态:可扩展规定协议域名状态代码;Extensible Provisioning Protocol (EPP) Domain Status Codes。
RRP域名状态:注册局-注册商协议域名状态代码;Registry Registrar Protocol (RRP) Domain Status Codes。

参考:http://amon.org/epp
参考:http://amon.org/rrp

相比RRP状态,EPP状态更容易理解、更加详细,如:CLIENT DELETE PROHIBITED表示客户端不可以删除域名。

EPP状态中的SERVER和CLIENT分别对应RRP协议中的注册局和注册商。

RRP由Verisign开发定义,用于.com/.net域名状态,部分国家域名也采用该方法。

【解释】

RRP域名状态有八种:

ACTIVE: 正常/激活

REGISTRY-LOCK: 注册局锁定(域名转移、更新、续费、删除至少有一项不能操作,域名可以进行解析使用)

REGISTRAR-LOCK: 注册商锁定(域名转移、更新、续费、删除至少有一项不能操作,域名可以进行解析使用)

REGISTRY-HOLD: 注册局留置(有争议域名或者有问题域名,不能进行任何操作)

REGISTRAR-HOLD: 注册商留置(过期域名,可以进行续费操作)

REDEMPTIONPERIOD: 赎回期 (域名过期30后由注册局设置,此状态保持30天,之后进入”即将删除”)

PENDINGRESTORE: 即将恢复 (注册局接到注册商的restorer命令,此此状态保持7天)

PENDINGDELETE: 即将删除

英文文档:

ACTIVE: The registry sets this status. The domain can be modified by the registrar. The domain can be renewed. The domain will be included in the zone if the domain has been delegated to at least one name server.

REGISTRY-LOCK: The registry sets this status. The domain can not be modified or deleted by the registrar. The registry must remove the REGISTRY-LOCK status for the registrar to modify the domain. The domain can be renewed. The domain will be included in the zone if the domain has been delegated to at least one name server.

REGISTRAR-LOCK: The sponsoring registrar sets this status. The domain can not be modified or deleted. The registrar must remove REGISTRAR-LOCK status to modify the domain. The domain can be renewed. The domain will be included in the zone.

REGISTRY-HOLD: The registry sets this status. The domain can not be modified or deleted by the registrar. The registry must remove the REGISTRY-HOLD status for the registrar to modify the domain. The domain can be renewed. The domain will not be included in the zone.

REGISTRAR-HOLD: The sponsoring registrar sets this status. The domain can not be modified or deleted. The registrar must remove REGISTRAR-HOLD status to modify the domain. The domain can be renewed. The domain will not be included in the zone.

REDEMPTIONPERIOD: The registry sets this status when a registrar requests that the domain name be deleted from the registry and the domain has been registered for more than 5 calendar days (if the delete request is received within 5 days of initial domain registration it will instead be deleted immediately). The domain will not be included in the zone. The domain can not be modified or purged; it can only be restored. Any other registrar requests to modify or otherwise update the domain will be rejected. The domain will be held in this status for a maximum of 30 calendar days.

PENDINGRESTORE: The registry sets this status after a registrar requests restoration of a domain that is in REDEMPTIONPERIOD status. The domain will be included in the zone. Registrar requests to modify or otherwise update the domain will be rejected. The domain will be held in this status while the registry waits for the registrar to provide required restoration documentation. If the registrar fails to provide documentation to the registry within 7 calendar days to confirm the restoration request, the domain will revert to REDEMPTIONPERIOD status. The domain status will be set to ACTIVE only if the registrar provides documentation to the registry within 7 calendar days to confirm the restoration request.

PENDINGDELETE: The registry sets this status after a domain has been set in REDEMPTIONPERIOD status and the domain has not been restored by the registrar. The domain will not be included in the zone. Once in this status all registrar requests to modify or otherwise update the domain will be rejected. The domain will be purged from the registry database after being in this status for 5 calendar days.

源码:随机背景图 Node.js实现

2018年8月7日 由 Amon 没有评论 »

参考:http://amon.org/randombg 实证未遂。缺少文件。
参考:http://amon.org/rotatebg ‎实证成功。

【介绍】

官网:https://picsum.photos/
源码:https://github.com/DMarby/picsum-photos
图库:https://picsum.photos/images

讨论:https://www.v2ex.com/t/168131

【部署】

参考:http://amon.org/nodejs

先安装必要的包:

npm link async
npm link sharp
npm link moment

临时创建源码中缺少的文件夹和文件:

/opt/unsplash-it/images.json
/opt/photos/metadata.json

执行命令:

node index.js

【用法】

Put your image size (width & height) after our URL and you’ll get a placeholder.

https://picsum.photos/200/300

To get a square image, just put the size you want.

https://picsum.photos/200

Random image

https://picsum.photos/200/300/?random

Grayscale

Use the /g/ path to greyscale the image.

https://picsum.photos/g/200/300

List images

https://picsum.photos/list

Specific Image

Get a specific image by appending ?image to the end of the url.

https://picsum.photos/200/300?image=0

Blurred image

Get a blurred image by appending ?blur to the end of the url.

https://picsum.photos/200/300/?blur

Crop Gravity

Select the cropping gravity by adding ?gravity to the end of the url.

Valid options are: north, east, south, west, center

https://picsum.photos/200/300/?gravity=east